@airtop/sdk 0.1.37 → 0.1.38-beta0
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 +9 -10
- package/api/errors/index.d.ts +2 -2
- package/api/errors/index.js +2 -2
- package/api/resources/automations/client/Client.js +4 -4
- package/api/resources/files/client/Client.js +4 -4
- package/api/resources/profiles/client/Client.js +1 -1
- package/api/resources/requests/client/Client.js +1 -1
- package/api/resources/sessions/client/Client.js +6 -6
- package/api/resources/sessions/types/SessionsEventsResponse.d.ts +7 -4
- package/api/resources/sessions/types/SessionsEventsResponseCaptchaEvent.d.ts +11 -0
- package/api/resources/sessions/types/SessionsEventsResponseCaptchaEvent.js +5 -0
- package/api/resources/sessions/types/index.d.ts +2 -1
- package/api/resources/sessions/types/index.js +2 -1
- package/api/resources/windows/client/Client.d.ts +126 -0
- package/api/resources/windows/client/Client.js +577 -21
- package/api/resources/windows/client/requests/AsyncClickRequest.d.ts +29 -0
- package/api/resources/windows/client/requests/AsyncClickRequest.js +5 -0
- package/api/resources/windows/client/requests/AsyncHoverRequest.d.ts +27 -0
- package/api/resources/windows/client/requests/AsyncHoverRequest.js +5 -0
- package/api/resources/windows/client/requests/AsyncMonitorRequest.d.ts +27 -0
- package/api/resources/windows/client/requests/AsyncMonitorRequest.js +5 -0
- package/api/resources/windows/client/requests/AsyncPageQueryRequest.d.ts +29 -0
- package/api/resources/windows/client/requests/AsyncPageQueryRequest.js +5 -0
- package/api/resources/windows/client/requests/AsyncPaginatedExtractionRequest.d.ts +27 -0
- package/api/resources/windows/client/requests/AsyncPaginatedExtractionRequest.js +5 -0
- package/api/resources/windows/client/requests/AsyncPromptContentRequest.d.ts +29 -0
- package/api/resources/windows/client/requests/AsyncPromptContentRequest.js +5 -0
- package/api/resources/windows/client/requests/AsyncScreenshotRequest.d.ts +23 -0
- package/api/resources/windows/client/requests/AsyncScreenshotRequest.js +5 -0
- package/api/resources/windows/client/requests/AsyncSummarizeContentRequest.d.ts +25 -0
- package/api/resources/windows/client/requests/AsyncSummarizeContentRequest.js +5 -0
- package/api/resources/windows/client/requests/AsyncTypeRequest.d.ts +37 -0
- package/api/resources/windows/client/requests/AsyncTypeRequest.js +5 -0
- package/api/resources/windows/client/requests/OperatorPromptV1Body.d.ts +25 -0
- package/api/resources/windows/client/requests/OperatorPromptV1Body.js +5 -0
- package/api/resources/windows/client/requests/index.d.ts +10 -0
- package/api/types/AsyncOperatorPromptResponseEnvelope.d.ts +9 -0
- package/api/types/AsyncOperatorPromptResponseEnvelope.js +5 -0
- package/api/types/CaptchaEventMessage.d.ts +24 -0
- package/api/types/CaptchaEventMessage.js +5 -0
- package/api/types/CaptchaEventMessageStatus.d.ts +12 -0
- package/api/types/CaptchaEventMessageStatus.js +11 -0
- package/api/types/SessionConfigV1.d.ts +2 -0
- package/api/types/index.d.ts +3 -0
- package/api/types/index.js +3 -0
- package/dist/api/errors/index.d.ts +2 -2
- package/dist/api/errors/index.js +2 -2
- package/dist/api/resources/automations/client/Client.js +4 -4
- package/dist/api/resources/files/client/Client.js +4 -4
- package/dist/api/resources/profiles/client/Client.js +1 -1
- package/dist/api/resources/requests/client/Client.js +1 -1
- package/dist/api/resources/sessions/client/Client.js +6 -6
- package/dist/api/resources/sessions/types/SessionsEventsResponse.d.ts +7 -4
- package/dist/api/resources/sessions/types/SessionsEventsResponseCaptchaEvent.d.ts +11 -0
- package/dist/api/resources/sessions/types/SessionsEventsResponseCaptchaEvent.js +5 -0
- package/dist/api/resources/sessions/types/index.d.ts +2 -1
- package/dist/api/resources/sessions/types/index.js +2 -1
- package/dist/api/resources/windows/client/Client.d.ts +126 -0
- package/dist/api/resources/windows/client/Client.js +577 -21
- package/dist/api/resources/windows/client/requests/AsyncClickRequest.d.ts +29 -0
- package/dist/api/resources/windows/client/requests/AsyncClickRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/AsyncHoverRequest.d.ts +27 -0
- package/dist/api/resources/windows/client/requests/AsyncHoverRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/AsyncMonitorRequest.d.ts +27 -0
- package/dist/api/resources/windows/client/requests/AsyncMonitorRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/AsyncPageQueryRequest.d.ts +29 -0
- package/dist/api/resources/windows/client/requests/AsyncPageQueryRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/AsyncPaginatedExtractionRequest.d.ts +27 -0
- package/dist/api/resources/windows/client/requests/AsyncPaginatedExtractionRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/AsyncPromptContentRequest.d.ts +29 -0
- package/dist/api/resources/windows/client/requests/AsyncPromptContentRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/AsyncScreenshotRequest.d.ts +23 -0
- package/dist/api/resources/windows/client/requests/AsyncScreenshotRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/AsyncSummarizeContentRequest.d.ts +25 -0
- package/dist/api/resources/windows/client/requests/AsyncSummarizeContentRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/AsyncTypeRequest.d.ts +37 -0
- package/dist/api/resources/windows/client/requests/AsyncTypeRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/OperatorPromptV1Body.d.ts +25 -0
- package/dist/api/resources/windows/client/requests/OperatorPromptV1Body.js +5 -0
- package/dist/api/resources/windows/client/requests/index.d.ts +10 -0
- package/dist/api/types/AsyncOperatorPromptResponseEnvelope.d.ts +9 -0
- package/dist/api/types/AsyncOperatorPromptResponseEnvelope.js +5 -0
- package/dist/api/types/CaptchaEventMessage.d.ts +24 -0
- package/dist/api/types/CaptchaEventMessage.js +5 -0
- package/dist/api/types/CaptchaEventMessageStatus.d.ts +12 -0
- package/dist/api/types/CaptchaEventMessageStatus.js +11 -0
- package/dist/api/types/SessionConfigV1.d.ts +2 -0
- package/dist/api/types/index.d.ts +3 -0
- package/dist/api/types/index.js +3 -0
- package/dist/serialization/resources/sessions/types/SessionsEventsResponse.d.ts +9 -5
- package/dist/serialization/resources/sessions/types/SessionsEventsResponse.js +4 -2
- package/dist/serialization/resources/sessions/types/SessionsEventsResponseCaptchaEvent.d.ts +15 -0
- package/dist/serialization/resources/sessions/types/SessionsEventsResponseCaptchaEvent.js +46 -0
- package/dist/serialization/resources/sessions/types/index.d.ts +2 -1
- package/dist/serialization/resources/sessions/types/index.js +2 -1
- package/dist/serialization/resources/windows/client/requests/AsyncClickRequest.d.ts +20 -0
- package/dist/serialization/resources/windows/client/requests/AsyncClickRequest.js +51 -0
- package/dist/serialization/resources/windows/client/requests/AsyncHoverRequest.d.ts +19 -0
- package/dist/serialization/resources/windows/client/requests/AsyncHoverRequest.js +50 -0
- package/dist/serialization/resources/windows/client/requests/AsyncMonitorRequest.d.ts +19 -0
- package/dist/serialization/resources/windows/client/requests/AsyncMonitorRequest.js +50 -0
- package/dist/serialization/resources/windows/client/requests/AsyncPageQueryRequest.d.ts +20 -0
- package/dist/serialization/resources/windows/client/requests/AsyncPageQueryRequest.js +51 -0
- package/dist/serialization/resources/windows/client/requests/AsyncPaginatedExtractionRequest.d.ts +19 -0
- package/dist/serialization/resources/windows/client/requests/AsyncPaginatedExtractionRequest.js +50 -0
- package/dist/serialization/resources/windows/client/requests/AsyncPromptContentRequest.d.ts +20 -0
- package/dist/serialization/resources/windows/client/requests/AsyncPromptContentRequest.js +51 -0
- package/dist/serialization/resources/windows/client/requests/AsyncScreenshotRequest.d.ts +18 -0
- package/dist/serialization/resources/windows/client/requests/AsyncScreenshotRequest.js +49 -0
- package/dist/serialization/resources/windows/client/requests/AsyncSummarizeContentRequest.d.ts +19 -0
- package/dist/serialization/resources/windows/client/requests/AsyncSummarizeContentRequest.js +50 -0
- package/dist/serialization/resources/windows/client/requests/AsyncTypeRequest.d.ts +24 -0
- package/dist/serialization/resources/windows/client/requests/AsyncTypeRequest.js +55 -0
- package/dist/serialization/resources/windows/client/requests/OperatorPromptV1Body.d.ts +17 -0
- package/dist/serialization/resources/windows/client/requests/OperatorPromptV1Body.js +48 -0
- package/dist/serialization/resources/windows/client/requests/index.d.ts +10 -0
- package/dist/serialization/resources/windows/client/requests/index.js +21 -1
- package/dist/serialization/types/AsyncOperatorPromptResponseEnvelope.d.ts +15 -0
- package/dist/serialization/types/AsyncOperatorPromptResponseEnvelope.js +46 -0
- package/dist/serialization/types/CaptchaEventMessage.d.ts +21 -0
- package/dist/serialization/types/CaptchaEventMessage.js +52 -0
- package/dist/serialization/types/CaptchaEventMessageStatus.d.ts +10 -0
- package/dist/serialization/types/CaptchaEventMessageStatus.js +41 -0
- package/dist/serialization/types/SessionConfigV1.d.ts +1 -0
- package/dist/serialization/types/SessionConfigV1.js +1 -0
- package/dist/serialization/types/index.d.ts +3 -0
- package/dist/serialization/types/index.js +3 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/reference.md +765 -23
- package/serialization/resources/sessions/types/SessionsEventsResponse.d.ts +9 -5
- package/serialization/resources/sessions/types/SessionsEventsResponse.js +4 -2
- package/serialization/resources/sessions/types/SessionsEventsResponseCaptchaEvent.d.ts +15 -0
- package/serialization/resources/sessions/types/SessionsEventsResponseCaptchaEvent.js +46 -0
- package/serialization/resources/sessions/types/index.d.ts +2 -1
- package/serialization/resources/sessions/types/index.js +2 -1
- package/serialization/resources/windows/client/requests/AsyncClickRequest.d.ts +20 -0
- package/serialization/resources/windows/client/requests/AsyncClickRequest.js +51 -0
- package/serialization/resources/windows/client/requests/AsyncHoverRequest.d.ts +19 -0
- package/serialization/resources/windows/client/requests/AsyncHoverRequest.js +50 -0
- package/serialization/resources/windows/client/requests/AsyncMonitorRequest.d.ts +19 -0
- package/serialization/resources/windows/client/requests/AsyncMonitorRequest.js +50 -0
- package/serialization/resources/windows/client/requests/AsyncPageQueryRequest.d.ts +20 -0
- package/serialization/resources/windows/client/requests/AsyncPageQueryRequest.js +51 -0
- package/serialization/resources/windows/client/requests/AsyncPaginatedExtractionRequest.d.ts +19 -0
- package/serialization/resources/windows/client/requests/AsyncPaginatedExtractionRequest.js +50 -0
- package/serialization/resources/windows/client/requests/AsyncPromptContentRequest.d.ts +20 -0
- package/serialization/resources/windows/client/requests/AsyncPromptContentRequest.js +51 -0
- package/serialization/resources/windows/client/requests/AsyncScreenshotRequest.d.ts +18 -0
- package/serialization/resources/windows/client/requests/AsyncScreenshotRequest.js +49 -0
- package/serialization/resources/windows/client/requests/AsyncSummarizeContentRequest.d.ts +19 -0
- package/serialization/resources/windows/client/requests/AsyncSummarizeContentRequest.js +50 -0
- package/serialization/resources/windows/client/requests/AsyncTypeRequest.d.ts +24 -0
- package/serialization/resources/windows/client/requests/AsyncTypeRequest.js +55 -0
- package/serialization/resources/windows/client/requests/OperatorPromptV1Body.d.ts +17 -0
- package/serialization/resources/windows/client/requests/OperatorPromptV1Body.js +48 -0
- package/serialization/resources/windows/client/requests/index.d.ts +10 -0
- package/serialization/resources/windows/client/requests/index.js +21 -1
- package/serialization/types/AsyncOperatorPromptResponseEnvelope.d.ts +15 -0
- package/serialization/types/AsyncOperatorPromptResponseEnvelope.js +46 -0
- package/serialization/types/CaptchaEventMessage.d.ts +21 -0
- package/serialization/types/CaptchaEventMessage.js +52 -0
- package/serialization/types/CaptchaEventMessageStatus.d.ts +10 -0
- package/serialization/types/CaptchaEventMessageStatus.js +41 -0
- package/serialization/types/SessionConfigV1.d.ts +1 -0
- package/serialization/types/SessionConfigV1.js +1 -0
- package/serialization/types/index.d.ts +3 -0
- package/serialization/types/index.js +3 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
@@ -58,6 +58,63 @@ class Windows {
|
|
58
58
|
constructor(_options) {
|
59
59
|
this._options = _options;
|
60
60
|
}
|
61
|
+
/**
|
62
|
+
* Execute a click interaction in a specific browser window asynchronously
|
63
|
+
*
|
64
|
+
* @param {string} sessionId - The session id for the window.
|
65
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
66
|
+
* @param {Airtop.AsyncClickRequest} request
|
67
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
68
|
+
*
|
69
|
+
* @example
|
70
|
+
* await client.windows.asyncClick("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
71
|
+
* elementDescription: "The login button"
|
72
|
+
* })
|
73
|
+
*/
|
74
|
+
asyncClick(sessionId, windowId, request, requestOptions) {
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
76
|
+
var _a, _b, _c;
|
77
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
78
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/click`),
|
79
|
+
method: "POST",
|
80
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
81
|
+
contentType: "application/json",
|
82
|
+
requestType: "json",
|
83
|
+
body: serializers.AsyncClickRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
84
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
85
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
86
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
87
|
+
});
|
88
|
+
if (_response.ok) {
|
89
|
+
return serializers.AsyncSessionAiResponseEnvelope.parseOrThrow(_response.body, {
|
90
|
+
unrecognizedObjectKeys: "passthrough",
|
91
|
+
allowUnrecognizedUnionMembers: true,
|
92
|
+
allowUnrecognizedEnumValues: true,
|
93
|
+
skipValidation: true,
|
94
|
+
breadcrumbsPrefix: ["response"],
|
95
|
+
});
|
96
|
+
}
|
97
|
+
if (_response.error.reason === "status-code") {
|
98
|
+
throw new errors.AirtopError({
|
99
|
+
statusCode: _response.error.statusCode,
|
100
|
+
body: _response.error.body,
|
101
|
+
});
|
102
|
+
}
|
103
|
+
switch (_response.error.reason) {
|
104
|
+
case "non-json":
|
105
|
+
throw new errors.AirtopError({
|
106
|
+
statusCode: _response.error.statusCode,
|
107
|
+
body: _response.error.rawBody,
|
108
|
+
});
|
109
|
+
case "timeout":
|
110
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /async/sessions/{sessionId}/windows/{windowId}/click.");
|
111
|
+
case "unknown":
|
112
|
+
throw new errors.AirtopError({
|
113
|
+
message: _response.error.errorMessage,
|
114
|
+
});
|
115
|
+
}
|
116
|
+
});
|
117
|
+
}
|
61
118
|
/**
|
62
119
|
* Create an automation of a browser window asynchronously
|
63
120
|
*
|
@@ -75,7 +132,7 @@ class Windows {
|
|
75
132
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
76
133
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/create-automation`),
|
77
134
|
method: "POST",
|
78
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
135
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
79
136
|
contentType: "application/json",
|
80
137
|
requestType: "json",
|
81
138
|
body: serializers.AsyncCreateAutomationRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
@@ -130,7 +187,7 @@ class Windows {
|
|
130
187
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
131
188
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/create-form-filler`),
|
132
189
|
method: "POST",
|
133
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
190
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
134
191
|
contentType: "application/json",
|
135
192
|
requestType: "json",
|
136
193
|
body: serializers.AsyncCreateFormFillerRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
@@ -187,7 +244,7 @@ class Windows {
|
|
187
244
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
188
245
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/execute-automation`),
|
189
246
|
method: "POST",
|
190
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
247
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
191
248
|
contentType: "application/json",
|
192
249
|
requestType: "json",
|
193
250
|
body: serializers.AsyncExecuteAutomationRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
@@ -244,7 +301,7 @@ class Windows {
|
|
244
301
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
245
302
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/fill-form`),
|
246
303
|
method: "POST",
|
247
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
304
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
248
305
|
contentType: "application/json",
|
249
306
|
requestType: "json",
|
250
307
|
body: serializers.AsyncFillFormRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
@@ -282,6 +339,448 @@ class Windows {
|
|
282
339
|
}
|
283
340
|
});
|
284
341
|
}
|
342
|
+
/**
|
343
|
+
* @param {string} sessionId - The session id for the window.
|
344
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
345
|
+
* @param {Airtop.AsyncHoverRequest} request
|
346
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
347
|
+
*
|
348
|
+
* @example
|
349
|
+
* await client.windows.asyncHover("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
350
|
+
* elementDescription: "The search box input in the top right corner"
|
351
|
+
* })
|
352
|
+
*/
|
353
|
+
asyncHover(sessionId, windowId, request, requestOptions) {
|
354
|
+
return __awaiter(this, void 0, void 0, function* () {
|
355
|
+
var _a, _b, _c;
|
356
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
357
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/hover`),
|
358
|
+
method: "POST",
|
359
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
360
|
+
contentType: "application/json",
|
361
|
+
requestType: "json",
|
362
|
+
body: serializers.AsyncHoverRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
363
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
364
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
365
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
366
|
+
});
|
367
|
+
if (_response.ok) {
|
368
|
+
return serializers.AsyncSessionAiResponseEnvelope.parseOrThrow(_response.body, {
|
369
|
+
unrecognizedObjectKeys: "passthrough",
|
370
|
+
allowUnrecognizedUnionMembers: true,
|
371
|
+
allowUnrecognizedEnumValues: true,
|
372
|
+
skipValidation: true,
|
373
|
+
breadcrumbsPrefix: ["response"],
|
374
|
+
});
|
375
|
+
}
|
376
|
+
if (_response.error.reason === "status-code") {
|
377
|
+
throw new errors.AirtopError({
|
378
|
+
statusCode: _response.error.statusCode,
|
379
|
+
body: _response.error.body,
|
380
|
+
});
|
381
|
+
}
|
382
|
+
switch (_response.error.reason) {
|
383
|
+
case "non-json":
|
384
|
+
throw new errors.AirtopError({
|
385
|
+
statusCode: _response.error.statusCode,
|
386
|
+
body: _response.error.rawBody,
|
387
|
+
});
|
388
|
+
case "timeout":
|
389
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /async/sessions/{sessionId}/windows/{windowId}/hover.");
|
390
|
+
case "unknown":
|
391
|
+
throw new errors.AirtopError({
|
392
|
+
message: _response.error.errorMessage,
|
393
|
+
});
|
394
|
+
}
|
395
|
+
});
|
396
|
+
}
|
397
|
+
/**
|
398
|
+
* @param {string} sessionId - The session id for the window.
|
399
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
400
|
+
* @param {Airtop.AsyncMonitorRequest} request
|
401
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
402
|
+
*
|
403
|
+
* @example
|
404
|
+
* await client.windows.asyncMonitor("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
405
|
+
* condition: "Determine if the user appears to be signed in to the website"
|
406
|
+
* })
|
407
|
+
*/
|
408
|
+
asyncMonitor(sessionId, windowId, request, requestOptions) {
|
409
|
+
return __awaiter(this, void 0, void 0, function* () {
|
410
|
+
var _a, _b, _c;
|
411
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
412
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/monitor`),
|
413
|
+
method: "POST",
|
414
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
415
|
+
contentType: "application/json",
|
416
|
+
requestType: "json",
|
417
|
+
body: serializers.AsyncMonitorRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
418
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
419
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
420
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
421
|
+
});
|
422
|
+
if (_response.ok) {
|
423
|
+
return serializers.AsyncSessionAiResponseEnvelope.parseOrThrow(_response.body, {
|
424
|
+
unrecognizedObjectKeys: "passthrough",
|
425
|
+
allowUnrecognizedUnionMembers: true,
|
426
|
+
allowUnrecognizedEnumValues: true,
|
427
|
+
skipValidation: true,
|
428
|
+
breadcrumbsPrefix: ["response"],
|
429
|
+
});
|
430
|
+
}
|
431
|
+
if (_response.error.reason === "status-code") {
|
432
|
+
throw new errors.AirtopError({
|
433
|
+
statusCode: _response.error.statusCode,
|
434
|
+
body: _response.error.body,
|
435
|
+
});
|
436
|
+
}
|
437
|
+
switch (_response.error.reason) {
|
438
|
+
case "non-json":
|
439
|
+
throw new errors.AirtopError({
|
440
|
+
statusCode: _response.error.statusCode,
|
441
|
+
body: _response.error.rawBody,
|
442
|
+
});
|
443
|
+
case "timeout":
|
444
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /async/sessions/{sessionId}/windows/{windowId}/monitor.");
|
445
|
+
case "unknown":
|
446
|
+
throw new errors.AirtopError({
|
447
|
+
message: _response.error.errorMessage,
|
448
|
+
});
|
449
|
+
}
|
450
|
+
});
|
451
|
+
}
|
452
|
+
/**
|
453
|
+
* @param {string} sessionId - The session id for the window.
|
454
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
455
|
+
* @param {Airtop.AsyncPageQueryRequest} request
|
456
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
457
|
+
*
|
458
|
+
* @example
|
459
|
+
* await client.windows.asyncPageQuery("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
460
|
+
* prompt: "What is the main idea of this page?"
|
461
|
+
* })
|
462
|
+
*/
|
463
|
+
asyncPageQuery(sessionId, windowId, request, requestOptions) {
|
464
|
+
return __awaiter(this, void 0, void 0, function* () {
|
465
|
+
var _a, _b, _c;
|
466
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
467
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/page-query`),
|
468
|
+
method: "POST",
|
469
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
470
|
+
contentType: "application/json",
|
471
|
+
requestType: "json",
|
472
|
+
body: serializers.AsyncPageQueryRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
473
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
474
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
475
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
476
|
+
});
|
477
|
+
if (_response.ok) {
|
478
|
+
return serializers.AsyncSessionAiResponseEnvelope.parseOrThrow(_response.body, {
|
479
|
+
unrecognizedObjectKeys: "passthrough",
|
480
|
+
allowUnrecognizedUnionMembers: true,
|
481
|
+
allowUnrecognizedEnumValues: true,
|
482
|
+
skipValidation: true,
|
483
|
+
breadcrumbsPrefix: ["response"],
|
484
|
+
});
|
485
|
+
}
|
486
|
+
if (_response.error.reason === "status-code") {
|
487
|
+
throw new errors.AirtopError({
|
488
|
+
statusCode: _response.error.statusCode,
|
489
|
+
body: _response.error.body,
|
490
|
+
});
|
491
|
+
}
|
492
|
+
switch (_response.error.reason) {
|
493
|
+
case "non-json":
|
494
|
+
throw new errors.AirtopError({
|
495
|
+
statusCode: _response.error.statusCode,
|
496
|
+
body: _response.error.rawBody,
|
497
|
+
});
|
498
|
+
case "timeout":
|
499
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /async/sessions/{sessionId}/windows/{windowId}/page-query.");
|
500
|
+
case "unknown":
|
501
|
+
throw new errors.AirtopError({
|
502
|
+
message: _response.error.errorMessage,
|
503
|
+
});
|
504
|
+
}
|
505
|
+
});
|
506
|
+
}
|
507
|
+
/**
|
508
|
+
* @param {string} sessionId - The session id for the window.
|
509
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
510
|
+
* @param {Airtop.AsyncPaginatedExtractionRequest} request
|
511
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
512
|
+
*
|
513
|
+
* @example
|
514
|
+
* await client.windows.asyncPaginatedExtraction("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
515
|
+
* prompt: "This site contains a list of results about <provide details about the list>. Navigate through 3 pages of results and return the title and <provide details about the data you want to extract> about each result in this list."
|
516
|
+
* })
|
517
|
+
*/
|
518
|
+
asyncPaginatedExtraction(sessionId, windowId, request, requestOptions) {
|
519
|
+
return __awaiter(this, void 0, void 0, function* () {
|
520
|
+
var _a, _b, _c;
|
521
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
522
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/paginated-extraction`),
|
523
|
+
method: "POST",
|
524
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
525
|
+
contentType: "application/json",
|
526
|
+
requestType: "json",
|
527
|
+
body: serializers.AsyncPaginatedExtractionRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
528
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
529
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
530
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
531
|
+
});
|
532
|
+
if (_response.ok) {
|
533
|
+
return serializers.AsyncSessionAiResponseEnvelope.parseOrThrow(_response.body, {
|
534
|
+
unrecognizedObjectKeys: "passthrough",
|
535
|
+
allowUnrecognizedUnionMembers: true,
|
536
|
+
allowUnrecognizedEnumValues: true,
|
537
|
+
skipValidation: true,
|
538
|
+
breadcrumbsPrefix: ["response"],
|
539
|
+
});
|
540
|
+
}
|
541
|
+
if (_response.error.reason === "status-code") {
|
542
|
+
throw new errors.AirtopError({
|
543
|
+
statusCode: _response.error.statusCode,
|
544
|
+
body: _response.error.body,
|
545
|
+
});
|
546
|
+
}
|
547
|
+
switch (_response.error.reason) {
|
548
|
+
case "non-json":
|
549
|
+
throw new errors.AirtopError({
|
550
|
+
statusCode: _response.error.statusCode,
|
551
|
+
body: _response.error.rawBody,
|
552
|
+
});
|
553
|
+
case "timeout":
|
554
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /async/sessions/{sessionId}/windows/{windowId}/paginated-extraction.");
|
555
|
+
case "unknown":
|
556
|
+
throw new errors.AirtopError({
|
557
|
+
message: _response.error.errorMessage,
|
558
|
+
});
|
559
|
+
}
|
560
|
+
});
|
561
|
+
}
|
562
|
+
/**
|
563
|
+
* This endpoint is deprecated. Please use the `pageQuery` endpoint instead.
|
564
|
+
*
|
565
|
+
* @param {string} sessionId - The session id for the window.
|
566
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
567
|
+
* @param {Airtop.AsyncPromptContentRequest} request
|
568
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
569
|
+
*
|
570
|
+
* @example
|
571
|
+
* await client.windows.asyncPromptContent("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
572
|
+
* prompt: "What is the main idea of this page?"
|
573
|
+
* })
|
574
|
+
*/
|
575
|
+
asyncPromptContent(sessionId, windowId, request, requestOptions) {
|
576
|
+
return __awaiter(this, void 0, void 0, function* () {
|
577
|
+
var _a, _b, _c;
|
578
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
579
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/prompt-content`),
|
580
|
+
method: "POST",
|
581
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
582
|
+
contentType: "application/json",
|
583
|
+
requestType: "json",
|
584
|
+
body: serializers.AsyncPromptContentRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
585
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
586
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
587
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
588
|
+
});
|
589
|
+
if (_response.ok) {
|
590
|
+
return serializers.AsyncSessionAiResponseEnvelope.parseOrThrow(_response.body, {
|
591
|
+
unrecognizedObjectKeys: "passthrough",
|
592
|
+
allowUnrecognizedUnionMembers: true,
|
593
|
+
allowUnrecognizedEnumValues: true,
|
594
|
+
skipValidation: true,
|
595
|
+
breadcrumbsPrefix: ["response"],
|
596
|
+
});
|
597
|
+
}
|
598
|
+
if (_response.error.reason === "status-code") {
|
599
|
+
throw new errors.AirtopError({
|
600
|
+
statusCode: _response.error.statusCode,
|
601
|
+
body: _response.error.body,
|
602
|
+
});
|
603
|
+
}
|
604
|
+
switch (_response.error.reason) {
|
605
|
+
case "non-json":
|
606
|
+
throw new errors.AirtopError({
|
607
|
+
statusCode: _response.error.statusCode,
|
608
|
+
body: _response.error.rawBody,
|
609
|
+
});
|
610
|
+
case "timeout":
|
611
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /async/sessions/{sessionId}/windows/{windowId}/prompt-content.");
|
612
|
+
case "unknown":
|
613
|
+
throw new errors.AirtopError({
|
614
|
+
message: _response.error.errorMessage,
|
615
|
+
});
|
616
|
+
}
|
617
|
+
});
|
618
|
+
}
|
619
|
+
/**
|
620
|
+
* Take a screenshot of the current viewport of a browser window asynchronously
|
621
|
+
*
|
622
|
+
* @param {string} sessionId - The session id for the window.
|
623
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
624
|
+
* @param {Airtop.AsyncScreenshotRequest} request
|
625
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
626
|
+
*
|
627
|
+
* @example
|
628
|
+
* await client.windows.asyncScreenshot("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430")
|
629
|
+
*/
|
630
|
+
asyncScreenshot(sessionId_1, windowId_1) {
|
631
|
+
return __awaiter(this, arguments, void 0, function* (sessionId, windowId, request = {}, requestOptions) {
|
632
|
+
var _a, _b, _c;
|
633
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
634
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/screenshot`),
|
635
|
+
method: "POST",
|
636
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
637
|
+
contentType: "application/json",
|
638
|
+
requestType: "json",
|
639
|
+
body: serializers.AsyncScreenshotRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
640
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
641
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
642
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
643
|
+
});
|
644
|
+
if (_response.ok) {
|
645
|
+
return serializers.AsyncSessionAiResponseEnvelope.parseOrThrow(_response.body, {
|
646
|
+
unrecognizedObjectKeys: "passthrough",
|
647
|
+
allowUnrecognizedUnionMembers: true,
|
648
|
+
allowUnrecognizedEnumValues: true,
|
649
|
+
skipValidation: true,
|
650
|
+
breadcrumbsPrefix: ["response"],
|
651
|
+
});
|
652
|
+
}
|
653
|
+
if (_response.error.reason === "status-code") {
|
654
|
+
throw new errors.AirtopError({
|
655
|
+
statusCode: _response.error.statusCode,
|
656
|
+
body: _response.error.body,
|
657
|
+
});
|
658
|
+
}
|
659
|
+
switch (_response.error.reason) {
|
660
|
+
case "non-json":
|
661
|
+
throw new errors.AirtopError({
|
662
|
+
statusCode: _response.error.statusCode,
|
663
|
+
body: _response.error.rawBody,
|
664
|
+
});
|
665
|
+
case "timeout":
|
666
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /async/sessions/{sessionId}/windows/{windowId}/screenshot.");
|
667
|
+
case "unknown":
|
668
|
+
throw new errors.AirtopError({
|
669
|
+
message: _response.error.errorMessage,
|
670
|
+
});
|
671
|
+
}
|
672
|
+
});
|
673
|
+
}
|
674
|
+
/**
|
675
|
+
* This endpoint is deprecated. Please use the `pageQuery` endpoint and ask for a summary in the prompt instead.
|
676
|
+
*
|
677
|
+
* @param {string} sessionId - The session id for the window.
|
678
|
+
* @param {string} windowId - The Airtop window id of the browser window to summarize.
|
679
|
+
* @param {Airtop.AsyncSummarizeContentRequest} request
|
680
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
681
|
+
*
|
682
|
+
* @example
|
683
|
+
* await client.windows.asyncSummarizeContent("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430")
|
684
|
+
*/
|
685
|
+
asyncSummarizeContent(sessionId_1, windowId_1) {
|
686
|
+
return __awaiter(this, arguments, void 0, function* (sessionId, windowId, request = {}, requestOptions) {
|
687
|
+
var _a, _b, _c;
|
688
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
689
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/summarize-content`),
|
690
|
+
method: "POST",
|
691
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
692
|
+
contentType: "application/json",
|
693
|
+
requestType: "json",
|
694
|
+
body: serializers.AsyncSummarizeContentRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
695
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
696
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
697
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
698
|
+
});
|
699
|
+
if (_response.ok) {
|
700
|
+
return serializers.AsyncSessionAiResponseEnvelope.parseOrThrow(_response.body, {
|
701
|
+
unrecognizedObjectKeys: "passthrough",
|
702
|
+
allowUnrecognizedUnionMembers: true,
|
703
|
+
allowUnrecognizedEnumValues: true,
|
704
|
+
skipValidation: true,
|
705
|
+
breadcrumbsPrefix: ["response"],
|
706
|
+
});
|
707
|
+
}
|
708
|
+
if (_response.error.reason === "status-code") {
|
709
|
+
throw new errors.AirtopError({
|
710
|
+
statusCode: _response.error.statusCode,
|
711
|
+
body: _response.error.body,
|
712
|
+
});
|
713
|
+
}
|
714
|
+
switch (_response.error.reason) {
|
715
|
+
case "non-json":
|
716
|
+
throw new errors.AirtopError({
|
717
|
+
statusCode: _response.error.statusCode,
|
718
|
+
body: _response.error.rawBody,
|
719
|
+
});
|
720
|
+
case "timeout":
|
721
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /async/sessions/{sessionId}/windows/{windowId}/summarize-content.");
|
722
|
+
case "unknown":
|
723
|
+
throw new errors.AirtopError({
|
724
|
+
message: _response.error.errorMessage,
|
725
|
+
});
|
726
|
+
}
|
727
|
+
});
|
728
|
+
}
|
729
|
+
/**
|
730
|
+
* @param {string} sessionId - The session id for the window.
|
731
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
732
|
+
* @param {Airtop.AsyncTypeRequest} request
|
733
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
734
|
+
*
|
735
|
+
* @example
|
736
|
+
* await client.windows.asyncType("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
737
|
+
* text: "Example text"
|
738
|
+
* })
|
739
|
+
*/
|
740
|
+
asyncType(sessionId, windowId, request, requestOptions) {
|
741
|
+
return __awaiter(this, void 0, void 0, function* () {
|
742
|
+
var _a, _b, _c;
|
743
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
744
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/type`),
|
745
|
+
method: "POST",
|
746
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
747
|
+
contentType: "application/json",
|
748
|
+
requestType: "json",
|
749
|
+
body: serializers.AsyncTypeRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
750
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
751
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
752
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
753
|
+
});
|
754
|
+
if (_response.ok) {
|
755
|
+
return serializers.AsyncSessionAiResponseEnvelope.parseOrThrow(_response.body, {
|
756
|
+
unrecognizedObjectKeys: "passthrough",
|
757
|
+
allowUnrecognizedUnionMembers: true,
|
758
|
+
allowUnrecognizedEnumValues: true,
|
759
|
+
skipValidation: true,
|
760
|
+
breadcrumbsPrefix: ["response"],
|
761
|
+
});
|
762
|
+
}
|
763
|
+
if (_response.error.reason === "status-code") {
|
764
|
+
throw new errors.AirtopError({
|
765
|
+
statusCode: _response.error.statusCode,
|
766
|
+
body: _response.error.body,
|
767
|
+
});
|
768
|
+
}
|
769
|
+
switch (_response.error.reason) {
|
770
|
+
case "non-json":
|
771
|
+
throw new errors.AirtopError({
|
772
|
+
statusCode: _response.error.statusCode,
|
773
|
+
body: _response.error.rawBody,
|
774
|
+
});
|
775
|
+
case "timeout":
|
776
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /async/sessions/{sessionId}/windows/{windowId}/type.");
|
777
|
+
case "unknown":
|
778
|
+
throw new errors.AirtopError({
|
779
|
+
message: _response.error.errorMessage,
|
780
|
+
});
|
781
|
+
}
|
782
|
+
});
|
783
|
+
}
|
285
784
|
/**
|
286
785
|
* Creates a new browser window in a session. Optionally, you can specify a url to load on the window upon creation.
|
287
786
|
*
|
@@ -298,7 +797,7 @@ class Windows {
|
|
298
797
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
299
798
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `sessions/${encodeURIComponent(sessionId)}/windows`),
|
300
799
|
method: "POST",
|
301
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
800
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
302
801
|
contentType: "application/json",
|
303
802
|
requestType: "json",
|
304
803
|
body: serializers.CreateWindowInputV1Body.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
@@ -366,7 +865,7 @@ class Windows {
|
|
366
865
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
367
866
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}`),
|
368
867
|
method: "GET",
|
369
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
868
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
370
869
|
contentType: "application/json",
|
371
870
|
queryParameters: _queryParams,
|
372
871
|
requestType: "json",
|
@@ -423,7 +922,7 @@ class Windows {
|
|
423
922
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
424
923
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}`),
|
425
924
|
method: "POST",
|
426
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
925
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
427
926
|
contentType: "application/json",
|
428
927
|
requestType: "json",
|
429
928
|
body: serializers.WindowLoadUrlV1Body.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
@@ -477,7 +976,7 @@ class Windows {
|
|
477
976
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
478
977
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}`),
|
479
978
|
method: "DELETE",
|
480
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
979
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
481
980
|
contentType: "application/json",
|
482
981
|
requestType: "json",
|
483
982
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
@@ -533,7 +1032,7 @@ class Windows {
|
|
533
1032
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
534
1033
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/click`),
|
535
1034
|
method: "POST",
|
536
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
1035
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
537
1036
|
contentType: "application/json",
|
538
1037
|
requestType: "json",
|
539
1038
|
body: serializers.SessionClickHandlerRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
@@ -588,7 +1087,7 @@ class Windows {
|
|
588
1087
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
589
1088
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/create-form-filler`),
|
590
1089
|
method: "POST",
|
591
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
1090
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
592
1091
|
contentType: "application/json",
|
593
1092
|
requestType: "json",
|
594
1093
|
body: serializers.CreateFormFillerRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
@@ -645,7 +1144,7 @@ class Windows {
|
|
645
1144
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
646
1145
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/fill-form`),
|
647
1146
|
method: "POST",
|
648
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
1147
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
649
1148
|
contentType: "application/json",
|
650
1149
|
requestType: "json",
|
651
1150
|
body: serializers.FillFormRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
@@ -702,7 +1201,7 @@ class Windows {
|
|
702
1201
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
703
1202
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/hover`),
|
704
1203
|
method: "POST",
|
705
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
1204
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
706
1205
|
contentType: "application/json",
|
707
1206
|
requestType: "json",
|
708
1207
|
body: serializers.SessionHoverHandlerRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
@@ -757,7 +1256,7 @@ class Windows {
|
|
757
1256
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
758
1257
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/monitor`),
|
759
1258
|
method: "POST",
|
760
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
1259
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
761
1260
|
contentType: "application/json",
|
762
1261
|
requestType: "json",
|
763
1262
|
body: serializers.SessionMonitorHandlerRequestBody.jsonOrThrow(request, {
|
@@ -797,6 +1296,63 @@ class Windows {
|
|
797
1296
|
}
|
798
1297
|
});
|
799
1298
|
}
|
1299
|
+
/**
|
1300
|
+
* Prompt OpenAI Operator
|
1301
|
+
*
|
1302
|
+
* @param {string} sessionId - ID of the session that owns the window.
|
1303
|
+
* @param {string} windowId - Airtop window ID of the browser window.
|
1304
|
+
* @param {Airtop.OperatorPromptV1Body} request
|
1305
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
1306
|
+
*
|
1307
|
+
* @example
|
1308
|
+
* await client.windows.operatorPrompt("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "7334da2a-91b0-42c5-6156-76a5eba87430", {
|
1309
|
+
* prompt: "What is the latest news about OpenAI?"
|
1310
|
+
* })
|
1311
|
+
*/
|
1312
|
+
operatorPrompt(sessionId, windowId, request, requestOptions) {
|
1313
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1314
|
+
var _a, _b, _c;
|
1315
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
1316
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/operator`),
|
1317
|
+
method: "POST",
|
1318
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
1319
|
+
contentType: "application/json",
|
1320
|
+
requestType: "json",
|
1321
|
+
body: serializers.OperatorPromptV1Body.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
1322
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
1323
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
1324
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
1325
|
+
});
|
1326
|
+
if (_response.ok) {
|
1327
|
+
return serializers.AsyncOperatorPromptResponseEnvelope.parseOrThrow(_response.body, {
|
1328
|
+
unrecognizedObjectKeys: "passthrough",
|
1329
|
+
allowUnrecognizedUnionMembers: true,
|
1330
|
+
allowUnrecognizedEnumValues: true,
|
1331
|
+
skipValidation: true,
|
1332
|
+
breadcrumbsPrefix: ["response"],
|
1333
|
+
});
|
1334
|
+
}
|
1335
|
+
if (_response.error.reason === "status-code") {
|
1336
|
+
throw new errors.AirtopError({
|
1337
|
+
statusCode: _response.error.statusCode,
|
1338
|
+
body: _response.error.body,
|
1339
|
+
});
|
1340
|
+
}
|
1341
|
+
switch (_response.error.reason) {
|
1342
|
+
case "non-json":
|
1343
|
+
throw new errors.AirtopError({
|
1344
|
+
statusCode: _response.error.statusCode,
|
1345
|
+
body: _response.error.rawBody,
|
1346
|
+
});
|
1347
|
+
case "timeout":
|
1348
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /sessions/{sessionId}/windows/{windowId}/operator.");
|
1349
|
+
case "unknown":
|
1350
|
+
throw new errors.AirtopError({
|
1351
|
+
message: _response.error.errorMessage,
|
1352
|
+
});
|
1353
|
+
}
|
1354
|
+
});
|
1355
|
+
}
|
800
1356
|
/**
|
801
1357
|
* Submit a prompt that queries the content of a specific browser window. You may extract content from the page, or ask a question about the page and allow the AI to answer it (ex. Is the user logged in?).
|
802
1358
|
*
|
@@ -816,7 +1372,7 @@ class Windows {
|
|
816
1372
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
817
1373
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/page-query`),
|
818
1374
|
method: "POST",
|
819
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
1375
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
820
1376
|
contentType: "application/json",
|
821
1377
|
requestType: "json",
|
822
1378
|
body: serializers.SessionPageQueryHandlerRequestBody.jsonOrThrow(request, {
|
@@ -875,7 +1431,7 @@ class Windows {
|
|
875
1431
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
876
1432
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/paginated-extraction`),
|
877
1433
|
method: "POST",
|
878
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
1434
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
879
1435
|
contentType: "application/json",
|
880
1436
|
requestType: "json",
|
881
1437
|
body: serializers.SessionPaginatedExtractionHandlerRequestBody.jsonOrThrow(request, {
|
@@ -934,7 +1490,7 @@ class Windows {
|
|
934
1490
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
935
1491
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/prompt-content`),
|
936
1492
|
method: "POST",
|
937
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
1493
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
938
1494
|
contentType: "application/json",
|
939
1495
|
requestType: "json",
|
940
1496
|
body: serializers.SessionPageQueryHandlerRequestBody.jsonOrThrow(request, {
|
@@ -991,7 +1547,7 @@ class Windows {
|
|
991
1547
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
992
1548
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/scrape-content`),
|
993
1549
|
method: "POST",
|
994
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
1550
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
995
1551
|
contentType: "application/json",
|
996
1552
|
requestType: "json",
|
997
1553
|
body: serializers.ScrapeContentRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
@@ -1046,7 +1602,7 @@ class Windows {
|
|
1046
1602
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
1047
1603
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/screenshot`),
|
1048
1604
|
method: "POST",
|
1049
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
1605
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
1050
1606
|
contentType: "application/json",
|
1051
1607
|
requestType: "json",
|
1052
1608
|
body: serializers.SessionScreenshotHandlerRequestBody.jsonOrThrow(request, {
|
@@ -1103,7 +1659,7 @@ class Windows {
|
|
1103
1659
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
1104
1660
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/scroll`),
|
1105
1661
|
method: "POST",
|
1106
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
1662
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
1107
1663
|
contentType: "application/json",
|
1108
1664
|
requestType: "json",
|
1109
1665
|
body: serializers.SessionScrollHandlerRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
@@ -1158,7 +1714,7 @@ class Windows {
|
|
1158
1714
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
1159
1715
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/summarize-content`),
|
1160
1716
|
method: "POST",
|
1161
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
1717
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
1162
1718
|
contentType: "application/json",
|
1163
1719
|
requestType: "json",
|
1164
1720
|
body: serializers.SessionSummaryHandlerRequestBody.jsonOrThrow(request, {
|
@@ -1217,7 +1773,7 @@ class Windows {
|
|
1217
1773
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
1218
1774
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AirtopEnvironment.Default, `sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/type`),
|
1219
1775
|
method: "POST",
|
1220
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
1776
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.38-beta0", "User-Agent": "@airtop/sdk/0.1.38-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
1221
1777
|
contentType: "application/json",
|
1222
1778
|
requestType: "json",
|
1223
1779
|
body: serializers.SessionTypeHandlerRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|