@airtop/sdk 0.1.41 → 0.1.42-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/resources/automations/client/Client.js +4 -4
- package/api/resources/files/client/Client.js +5 -5
- package/api/resources/files/client/requests/CreateFileRestInputV1.d.ts +1 -1
- 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 +4 -4
- package/api/resources/sessions/types/index.d.ts +1 -1
- package/api/resources/sessions/types/index.js +1 -1
- package/api/resources/windows/client/Client.d.ts +233 -5
- package/api/resources/windows/client/Client.js +1173 -214
- package/api/resources/windows/client/requests/ActRequest.d.ts +30 -0
- package/api/resources/windows/client/requests/ActRequest.js +5 -0
- 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/AsyncFileInputRequest.d.ts +33 -0
- package/api/resources/windows/client/requests/AsyncFileInputRequest.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/ExtractRequest.d.ts +30 -0
- package/api/resources/windows/client/requests/ExtractRequest.js +5 -0
- package/api/resources/windows/client/requests/FindManyRequest.d.ts +30 -0
- package/api/resources/windows/client/requests/FindManyRequest.js +5 -0
- package/api/resources/windows/client/requests/FindOneRequest.d.ts +30 -0
- package/api/resources/windows/client/requests/FindOneRequest.js +5 -0
- package/api/resources/windows/client/requests/LlmRequest.d.ts +25 -0
- package/api/resources/windows/client/requests/LlmRequest.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/SessionFileInputHandlerRequestBody.d.ts +4 -4
- package/api/resources/windows/client/requests/WaitForPageRequest.d.ts +23 -0
- package/api/resources/windows/client/requests/WaitForPageRequest.js +5 -0
- package/api/resources/windows/client/requests/index.d.ts +17 -0
- package/api/resources/windows/types/WaitForPageRequestTargetStatus.d.ts +11 -0
- package/api/resources/windows/types/WaitForPageRequestTargetStatus.js +10 -0
- package/api/resources/windows/types/index.d.ts +1 -0
- package/api/resources/windows/types/index.js +1 -0
- package/api/types/AsyncOperatorPromptResponseEnvelope.d.ts +9 -0
- package/api/types/AsyncOperatorPromptResponseEnvelope.js +5 -0
- package/api/types/FileEventData.d.ts +7 -0
- package/api/types/FileEventData.js +5 -0
- package/api/types/FileEventMessage.d.ts +2 -1
- package/api/types/index.d.ts +2 -0
- package/api/types/index.js +2 -0
- package/dist/api/resources/automations/client/Client.js +4 -4
- package/dist/api/resources/files/client/Client.js +5 -5
- package/dist/api/resources/files/client/requests/CreateFileRestInputV1.d.ts +1 -1
- 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 +4 -4
- package/dist/api/resources/sessions/types/index.d.ts +1 -1
- package/dist/api/resources/sessions/types/index.js +1 -1
- package/dist/api/resources/windows/client/Client.d.ts +233 -5
- package/dist/api/resources/windows/client/Client.js +1173 -214
- package/dist/api/resources/windows/client/requests/ActRequest.d.ts +30 -0
- package/dist/api/resources/windows/client/requests/ActRequest.js +5 -0
- 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/AsyncFileInputRequest.d.ts +33 -0
- package/dist/api/resources/windows/client/requests/AsyncFileInputRequest.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/ExtractRequest.d.ts +30 -0
- package/dist/api/resources/windows/client/requests/ExtractRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/FindManyRequest.d.ts +30 -0
- package/dist/api/resources/windows/client/requests/FindManyRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/FindOneRequest.d.ts +30 -0
- package/dist/api/resources/windows/client/requests/FindOneRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/LlmRequest.d.ts +25 -0
- package/dist/api/resources/windows/client/requests/LlmRequest.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/SessionFileInputHandlerRequestBody.d.ts +4 -4
- package/dist/api/resources/windows/client/requests/WaitForPageRequest.d.ts +23 -0
- package/dist/api/resources/windows/client/requests/WaitForPageRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/index.d.ts +17 -0
- package/dist/api/resources/windows/types/WaitForPageRequestTargetStatus.d.ts +11 -0
- package/dist/api/resources/windows/types/WaitForPageRequestTargetStatus.js +10 -0
- package/dist/api/resources/windows/types/index.d.ts +1 -0
- package/dist/api/resources/windows/types/index.js +1 -0
- package/dist/api/types/AsyncOperatorPromptResponseEnvelope.d.ts +9 -0
- package/dist/api/types/AsyncOperatorPromptResponseEnvelope.js +5 -0
- package/dist/api/types/FileEventData.d.ts +7 -0
- package/dist/api/types/FileEventData.js +5 -0
- package/dist/api/types/FileEventMessage.d.ts +2 -1
- package/dist/api/types/index.d.ts +2 -0
- package/dist/api/types/index.js +2 -0
- package/dist/serialization/resources/sessions/types/SessionsEventsResponse.d.ts +5 -5
- package/dist/serialization/resources/sessions/types/SessionsEventsResponse.js +2 -2
- package/dist/serialization/resources/sessions/types/index.d.ts +1 -1
- package/dist/serialization/resources/sessions/types/index.js +1 -1
- package/dist/serialization/resources/windows/client/requests/ActRequest.d.ts +19 -0
- package/dist/serialization/resources/windows/client/requests/ActRequest.js +50 -0
- 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/AsyncFileInputRequest.d.ts +23 -0
- package/dist/serialization/resources/windows/client/requests/AsyncFileInputRequest.js +54 -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/ExtractRequest.d.ts +19 -0
- package/dist/serialization/resources/windows/client/requests/ExtractRequest.js +50 -0
- package/dist/serialization/resources/windows/client/requests/FindManyRequest.d.ts +19 -0
- package/dist/serialization/resources/windows/client/requests/FindManyRequest.js +50 -0
- package/dist/serialization/resources/windows/client/requests/FindOneRequest.d.ts +19 -0
- package/dist/serialization/resources/windows/client/requests/FindOneRequest.js +50 -0
- package/dist/serialization/resources/windows/client/requests/LlmRequest.d.ts +17 -0
- package/dist/serialization/resources/windows/client/requests/LlmRequest.js +48 -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/SessionFileInputHandlerRequestBody.d.ts +2 -1
- package/dist/serialization/resources/windows/client/requests/SessionFileInputHandlerRequestBody.js +2 -1
- package/dist/serialization/resources/windows/client/requests/WaitForPageRequest.d.ts +18 -0
- package/dist/serialization/resources/windows/client/requests/WaitForPageRequest.js +49 -0
- package/dist/serialization/resources/windows/client/requests/index.d.ts +17 -0
- package/dist/serialization/resources/windows/client/requests/index.js +35 -1
- package/dist/serialization/resources/windows/types/WaitForPageRequestTargetStatus.d.ts +10 -0
- package/dist/serialization/resources/windows/types/WaitForPageRequestTargetStatus.js +41 -0
- package/dist/serialization/resources/windows/types/index.d.ts +1 -0
- package/dist/serialization/resources/windows/types/index.js +1 -0
- package/dist/serialization/types/AsyncOperatorPromptResponseEnvelope.d.ts +15 -0
- package/dist/serialization/types/AsyncOperatorPromptResponseEnvelope.js +46 -0
- package/dist/serialization/types/FileEventData.d.ts +13 -0
- package/dist/serialization/types/FileEventData.js +44 -0
- package/dist/serialization/types/FileEventMessage.d.ts +2 -1
- package/dist/serialization/types/FileEventMessage.js +2 -1
- package/dist/serialization/types/index.d.ts +2 -0
- package/dist/serialization/types/index.js +2 -0
- package/dist/utils/upload.js +12 -7
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wrapper/AirtopSessions.js +12 -5
- package/package.json +1 -1
- package/reference.md +1457 -144
- package/serialization/resources/sessions/types/SessionsEventsResponse.d.ts +5 -5
- package/serialization/resources/sessions/types/SessionsEventsResponse.js +2 -2
- package/serialization/resources/sessions/types/index.d.ts +1 -1
- package/serialization/resources/sessions/types/index.js +1 -1
- package/serialization/resources/windows/client/requests/ActRequest.d.ts +19 -0
- package/serialization/resources/windows/client/requests/ActRequest.js +50 -0
- 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/AsyncFileInputRequest.d.ts +23 -0
- package/serialization/resources/windows/client/requests/AsyncFileInputRequest.js +54 -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/ExtractRequest.d.ts +19 -0
- package/serialization/resources/windows/client/requests/ExtractRequest.js +50 -0
- package/serialization/resources/windows/client/requests/FindManyRequest.d.ts +19 -0
- package/serialization/resources/windows/client/requests/FindManyRequest.js +50 -0
- package/serialization/resources/windows/client/requests/FindOneRequest.d.ts +19 -0
- package/serialization/resources/windows/client/requests/FindOneRequest.js +50 -0
- package/serialization/resources/windows/client/requests/LlmRequest.d.ts +17 -0
- package/serialization/resources/windows/client/requests/LlmRequest.js +48 -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/SessionFileInputHandlerRequestBody.d.ts +2 -1
- package/serialization/resources/windows/client/requests/SessionFileInputHandlerRequestBody.js +2 -1
- package/serialization/resources/windows/client/requests/WaitForPageRequest.d.ts +18 -0
- package/serialization/resources/windows/client/requests/WaitForPageRequest.js +49 -0
- package/serialization/resources/windows/client/requests/index.d.ts +17 -0
- package/serialization/resources/windows/client/requests/index.js +35 -1
- package/serialization/resources/windows/types/WaitForPageRequestTargetStatus.d.ts +10 -0
- package/serialization/resources/windows/types/WaitForPageRequestTargetStatus.js +41 -0
- package/serialization/resources/windows/types/index.d.ts +1 -0
- package/serialization/resources/windows/types/index.js +1 -0
- package/serialization/types/AsyncOperatorPromptResponseEnvelope.d.ts +15 -0
- package/serialization/types/AsyncOperatorPromptResponseEnvelope.js +46 -0
- package/serialization/types/FileEventData.d.ts +13 -0
- package/serialization/types/FileEventData.js +44 -0
- package/serialization/types/FileEventMessage.d.ts +2 -1
- package/serialization/types/FileEventMessage.js +2 -1
- package/serialization/types/index.d.ts +2 -0
- package/serialization/types/index.js +2 -0
- package/utils/upload.js +12 -7
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/wrapper/AirtopSessions.js +12 -5
@@ -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, `v1/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.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-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 /v1/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, `v1/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.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-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, `v1/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.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-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, `v1/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.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-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" }),
|
@@ -225,6 +282,61 @@ class Windows {
|
|
225
282
|
}
|
226
283
|
});
|
227
284
|
}
|
285
|
+
/**
|
286
|
+
* Execute a file input interaction in a specific browser window asynchronously
|
287
|
+
*
|
288
|
+
* @param {string} sessionId - The session id for the window.
|
289
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
290
|
+
* @param {Airtop.AsyncFileInputRequest} request
|
291
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
292
|
+
*
|
293
|
+
* @example
|
294
|
+
* await client.windows.asyncFileInput("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430")
|
295
|
+
*/
|
296
|
+
asyncFileInput(sessionId_1, windowId_1) {
|
297
|
+
return __awaiter(this, arguments, void 0, function* (sessionId, windowId, request = {}, requestOptions) {
|
298
|
+
var _a, _b, _c;
|
299
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
300
|
+
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, `v1/async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/file-input`),
|
301
|
+
method: "POST",
|
302
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
303
|
+
contentType: "application/json",
|
304
|
+
requestType: "json",
|
305
|
+
body: serializers.AsyncFileInputRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
306
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
307
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
308
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
309
|
+
});
|
310
|
+
if (_response.ok) {
|
311
|
+
return serializers.AsyncSessionAiResponseEnvelope.parseOrThrow(_response.body, {
|
312
|
+
unrecognizedObjectKeys: "passthrough",
|
313
|
+
allowUnrecognizedUnionMembers: true,
|
314
|
+
allowUnrecognizedEnumValues: true,
|
315
|
+
skipValidation: true,
|
316
|
+
breadcrumbsPrefix: ["response"],
|
317
|
+
});
|
318
|
+
}
|
319
|
+
if (_response.error.reason === "status-code") {
|
320
|
+
throw new errors.AirtopError({
|
321
|
+
statusCode: _response.error.statusCode,
|
322
|
+
body: _response.error.body,
|
323
|
+
});
|
324
|
+
}
|
325
|
+
switch (_response.error.reason) {
|
326
|
+
case "non-json":
|
327
|
+
throw new errors.AirtopError({
|
328
|
+
statusCode: _response.error.statusCode,
|
329
|
+
body: _response.error.rawBody,
|
330
|
+
});
|
331
|
+
case "timeout":
|
332
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/async/sessions/{sessionId}/windows/{windowId}/file-input.");
|
333
|
+
case "unknown":
|
334
|
+
throw new errors.AirtopError({
|
335
|
+
message: _response.error.errorMessage,
|
336
|
+
});
|
337
|
+
}
|
338
|
+
});
|
339
|
+
}
|
228
340
|
/**
|
229
341
|
* Fill a form of a browser window asynchronously using a form-filler automation
|
230
342
|
*
|
@@ -244,7 +356,7 @@ class Windows {
|
|
244
356
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
245
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, `v1/async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/fill-form`),
|
246
358
|
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.
|
359
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
248
360
|
contentType: "application/json",
|
249
361
|
requestType: "json",
|
250
362
|
body: serializers.AsyncFillFormRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
@@ -283,31 +395,32 @@ class Windows {
|
|
283
395
|
});
|
284
396
|
}
|
285
397
|
/**
|
286
|
-
*
|
287
|
-
*
|
288
|
-
* @param {
|
289
|
-
* @param {Airtop.CreateWindowInputV1Body} request
|
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.AsyncHoverRequest} request
|
290
401
|
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
291
402
|
*
|
292
403
|
* @example
|
293
|
-
* await client.windows.
|
404
|
+
* await client.windows.asyncHover("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
405
|
+
* elementDescription: "The search box input in the top right corner"
|
406
|
+
* })
|
294
407
|
*/
|
295
|
-
|
296
|
-
return __awaiter(this,
|
408
|
+
asyncHover(sessionId, windowId, request, requestOptions) {
|
409
|
+
return __awaiter(this, void 0, void 0, function* () {
|
297
410
|
var _a, _b, _c;
|
298
411
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
299
|
-
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows`),
|
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, `v1/async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/hover`),
|
300
413
|
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.
|
414
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
302
415
|
contentType: "application/json",
|
303
416
|
requestType: "json",
|
304
|
-
body: serializers.
|
417
|
+
body: serializers.AsyncHoverRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
305
418
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
306
419
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
307
420
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
308
421
|
});
|
309
422
|
if (_response.ok) {
|
310
|
-
return serializers.
|
423
|
+
return serializers.AsyncSessionAiResponseEnvelope.parseOrThrow(_response.body, {
|
311
424
|
unrecognizedObjectKeys: "passthrough",
|
312
425
|
allowUnrecognizedUnionMembers: true,
|
313
426
|
allowUnrecognizedEnumValues: true,
|
@@ -328,7 +441,7 @@ class Windows {
|
|
328
441
|
body: _response.error.rawBody,
|
329
442
|
});
|
330
443
|
case "timeout":
|
331
|
-
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows.");
|
444
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/async/sessions/{sessionId}/windows/{windowId}/hover.");
|
332
445
|
case "unknown":
|
333
446
|
throw new errors.AirtopError({
|
334
447
|
message: _response.error.errorMessage,
|
@@ -337,45 +450,142 @@ class Windows {
|
|
337
450
|
});
|
338
451
|
}
|
339
452
|
/**
|
340
|
-
*
|
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.AsyncMonitorRequest} request
|
456
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
341
457
|
*
|
342
|
-
* @
|
343
|
-
*
|
344
|
-
*
|
458
|
+
* @example
|
459
|
+
* await client.windows.asyncMonitor("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
460
|
+
* condition: "Determine if the user appears to be signed in to the website"
|
461
|
+
* })
|
462
|
+
*/
|
463
|
+
asyncMonitor(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, `v1/async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/monitor`),
|
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.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-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.AsyncMonitorRequest.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 /v1/async/sessions/{sessionId}/windows/{windowId}/monitor.");
|
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.AsyncPageQueryRequest} request
|
345
511
|
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
346
512
|
*
|
347
513
|
* @example
|
348
|
-
* await client.windows.
|
349
|
-
*
|
514
|
+
* await client.windows.asyncPageQuery("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
515
|
+
* prompt: "What is the main idea of this page?"
|
350
516
|
* })
|
351
517
|
*/
|
352
|
-
|
353
|
-
return __awaiter(this,
|
518
|
+
asyncPageQuery(sessionId, windowId, request, requestOptions) {
|
519
|
+
return __awaiter(this, void 0, void 0, function* () {
|
354
520
|
var _a, _b, _c;
|
355
|
-
const
|
356
|
-
|
357
|
-
|
358
|
-
|
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, `v1/async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/page-query`),
|
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.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-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.AsyncPageQueryRequest.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
|
+
});
|
359
540
|
}
|
360
|
-
if (
|
361
|
-
|
541
|
+
if (_response.error.reason === "status-code") {
|
542
|
+
throw new errors.AirtopError({
|
543
|
+
statusCode: _response.error.statusCode,
|
544
|
+
body: _response.error.body,
|
545
|
+
});
|
362
546
|
}
|
363
|
-
|
364
|
-
|
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 /v1/async/sessions/{sessionId}/windows/{windowId}/page-query.");
|
555
|
+
case "unknown":
|
556
|
+
throw new errors.AirtopError({
|
557
|
+
message: _response.error.errorMessage,
|
558
|
+
});
|
365
559
|
}
|
560
|
+
});
|
561
|
+
}
|
562
|
+
/**
|
563
|
+
* @param {string} sessionId - The session id for the window.
|
564
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
565
|
+
* @param {Airtop.AsyncPaginatedExtractionRequest} request
|
566
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
567
|
+
*
|
568
|
+
* @example
|
569
|
+
* await client.windows.asyncPaginatedExtraction("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
570
|
+
* 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."
|
571
|
+
* })
|
572
|
+
*/
|
573
|
+
asyncPaginatedExtraction(sessionId, windowId, request, requestOptions) {
|
574
|
+
return __awaiter(this, void 0, void 0, function* () {
|
575
|
+
var _a, _b, _c;
|
366
576
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
367
|
-
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}`),
|
368
|
-
method: "
|
369
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
577
|
+
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, `v1/async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/paginated-extraction`),
|
578
|
+
method: "POST",
|
579
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
370
580
|
contentType: "application/json",
|
371
|
-
queryParameters: _queryParams,
|
372
581
|
requestType: "json",
|
582
|
+
body: serializers.AsyncPaginatedExtractionRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
373
583
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
374
584
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
375
585
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
376
586
|
});
|
377
587
|
if (_response.ok) {
|
378
|
-
return serializers.
|
588
|
+
return serializers.AsyncSessionAiResponseEnvelope.parseOrThrow(_response.body, {
|
379
589
|
unrecognizedObjectKeys: "passthrough",
|
380
590
|
allowUnrecognizedUnionMembers: true,
|
381
591
|
allowUnrecognizedEnumValues: true,
|
@@ -396,7 +606,7 @@ class Windows {
|
|
396
606
|
body: _response.error.rawBody,
|
397
607
|
});
|
398
608
|
case "timeout":
|
399
|
-
throw new errors.AirtopTimeoutError("Timeout exceeded when calling
|
609
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/async/sessions/{sessionId}/windows/{windowId}/paginated-extraction.");
|
400
610
|
case "unknown":
|
401
611
|
throw new errors.AirtopError({
|
402
612
|
message: _response.error.errorMessage,
|
@@ -405,34 +615,777 @@ class Windows {
|
|
405
615
|
});
|
406
616
|
}
|
407
617
|
/**
|
408
|
-
*
|
618
|
+
* This endpoint is deprecated. Please use the `pageQuery` endpoint instead.
|
409
619
|
*
|
410
|
-
* @param {string} sessionId -
|
411
|
-
* @param {string} windowId - Airtop window
|
412
|
-
* @param {Airtop.
|
620
|
+
* @param {string} sessionId - The session id for the window.
|
621
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
622
|
+
* @param {Airtop.AsyncPromptContentRequest} request
|
623
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
624
|
+
*
|
625
|
+
* @example
|
626
|
+
* await client.windows.asyncPromptContent("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
627
|
+
* prompt: "What is the main idea of this page?"
|
628
|
+
* })
|
629
|
+
*/
|
630
|
+
asyncPromptContent(sessionId, windowId, request, requestOptions) {
|
631
|
+
return __awaiter(this, void 0, void 0, function* () {
|
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, `v1/async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/prompt-content`),
|
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.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-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.AsyncPromptContentRequest.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 /v1/async/sessions/{sessionId}/windows/{windowId}/prompt-content.");
|
667
|
+
case "unknown":
|
668
|
+
throw new errors.AirtopError({
|
669
|
+
message: _response.error.errorMessage,
|
670
|
+
});
|
671
|
+
}
|
672
|
+
});
|
673
|
+
}
|
674
|
+
/**
|
675
|
+
* Take a screenshot of the current viewport of a browser window asynchronously
|
676
|
+
*
|
677
|
+
* @param {string} sessionId - The session id for the window.
|
678
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
679
|
+
* @param {Airtop.AsyncScreenshotRequest} request
|
680
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
681
|
+
*
|
682
|
+
* @example
|
683
|
+
* await client.windows.asyncScreenshot("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430")
|
684
|
+
*/
|
685
|
+
asyncScreenshot(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, `v1/async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/screenshot`),
|
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.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-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.AsyncScreenshotRequest.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 /v1/async/sessions/{sessionId}/windows/{windowId}/screenshot.");
|
722
|
+
case "unknown":
|
723
|
+
throw new errors.AirtopError({
|
724
|
+
message: _response.error.errorMessage,
|
725
|
+
});
|
726
|
+
}
|
727
|
+
});
|
728
|
+
}
|
729
|
+
/**
|
730
|
+
* This endpoint is deprecated. Please use the `pageQuery` endpoint and ask for a summary in the prompt instead.
|
731
|
+
*
|
732
|
+
* @param {string} sessionId - The session id for the window.
|
733
|
+
* @param {string} windowId - The Airtop window id of the browser window to summarize.
|
734
|
+
* @param {Airtop.AsyncSummarizeContentRequest} request
|
735
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
736
|
+
*
|
737
|
+
* @example
|
738
|
+
* await client.windows.asyncSummarizeContent("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430")
|
739
|
+
*/
|
740
|
+
asyncSummarizeContent(sessionId_1, windowId_1) {
|
741
|
+
return __awaiter(this, arguments, void 0, function* (sessionId, windowId, request = {}, requestOptions) {
|
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, `v1/async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/summarize-content`),
|
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.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-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.AsyncSummarizeContentRequest.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 /v1/async/sessions/{sessionId}/windows/{windowId}/summarize-content.");
|
777
|
+
case "unknown":
|
778
|
+
throw new errors.AirtopError({
|
779
|
+
message: _response.error.errorMessage,
|
780
|
+
});
|
781
|
+
}
|
782
|
+
});
|
783
|
+
}
|
784
|
+
/**
|
785
|
+
* @param {string} sessionId - The session id for the window.
|
786
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
787
|
+
* @param {Airtop.AsyncTypeRequest} request
|
788
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
789
|
+
*
|
790
|
+
* @example
|
791
|
+
* await client.windows.asyncType("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
792
|
+
* text: "Example text"
|
793
|
+
* })
|
794
|
+
*/
|
795
|
+
asyncType(sessionId, windowId, request, requestOptions) {
|
796
|
+
return __awaiter(this, void 0, void 0, function* () {
|
797
|
+
var _a, _b, _c;
|
798
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
799
|
+
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, `v1/async/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/type`),
|
800
|
+
method: "POST",
|
801
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
802
|
+
contentType: "application/json",
|
803
|
+
requestType: "json",
|
804
|
+
body: serializers.AsyncTypeRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
805
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
806
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
807
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
808
|
+
});
|
809
|
+
if (_response.ok) {
|
810
|
+
return serializers.AsyncSessionAiResponseEnvelope.parseOrThrow(_response.body, {
|
811
|
+
unrecognizedObjectKeys: "passthrough",
|
812
|
+
allowUnrecognizedUnionMembers: true,
|
813
|
+
allowUnrecognizedEnumValues: true,
|
814
|
+
skipValidation: true,
|
815
|
+
breadcrumbsPrefix: ["response"],
|
816
|
+
});
|
817
|
+
}
|
818
|
+
if (_response.error.reason === "status-code") {
|
819
|
+
throw new errors.AirtopError({
|
820
|
+
statusCode: _response.error.statusCode,
|
821
|
+
body: _response.error.body,
|
822
|
+
});
|
823
|
+
}
|
824
|
+
switch (_response.error.reason) {
|
825
|
+
case "non-json":
|
826
|
+
throw new errors.AirtopError({
|
827
|
+
statusCode: _response.error.statusCode,
|
828
|
+
body: _response.error.rawBody,
|
829
|
+
});
|
830
|
+
case "timeout":
|
831
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/async/sessions/{sessionId}/windows/{windowId}/type.");
|
832
|
+
case "unknown":
|
833
|
+
throw new errors.AirtopError({
|
834
|
+
message: _response.error.errorMessage,
|
835
|
+
});
|
836
|
+
}
|
837
|
+
});
|
838
|
+
}
|
839
|
+
/**
|
840
|
+
* Creates a new browser window in a session. Optionally, you can specify a url to load on the window upon creation.
|
841
|
+
*
|
842
|
+
* @param {string} sessionId - ID of the session that owns the window.
|
843
|
+
* @param {Airtop.CreateWindowInputV1Body} request
|
844
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
845
|
+
*
|
846
|
+
* @example
|
847
|
+
* await client.windows.create("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b")
|
848
|
+
*/
|
849
|
+
create(sessionId_1) {
|
850
|
+
return __awaiter(this, arguments, void 0, function* (sessionId, request = {}, requestOptions) {
|
851
|
+
var _a, _b, _c;
|
852
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
853
|
+
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows`),
|
854
|
+
method: "POST",
|
855
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
856
|
+
contentType: "application/json",
|
857
|
+
requestType: "json",
|
858
|
+
body: serializers.CreateWindowInputV1Body.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
859
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
860
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
861
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
862
|
+
});
|
863
|
+
if (_response.ok) {
|
864
|
+
return serializers.WindowIdResponse.parseOrThrow(_response.body, {
|
865
|
+
unrecognizedObjectKeys: "passthrough",
|
866
|
+
allowUnrecognizedUnionMembers: true,
|
867
|
+
allowUnrecognizedEnumValues: true,
|
868
|
+
skipValidation: true,
|
869
|
+
breadcrumbsPrefix: ["response"],
|
870
|
+
});
|
871
|
+
}
|
872
|
+
if (_response.error.reason === "status-code") {
|
873
|
+
throw new errors.AirtopError({
|
874
|
+
statusCode: _response.error.statusCode,
|
875
|
+
body: _response.error.body,
|
876
|
+
});
|
877
|
+
}
|
878
|
+
switch (_response.error.reason) {
|
879
|
+
case "non-json":
|
880
|
+
throw new errors.AirtopError({
|
881
|
+
statusCode: _response.error.statusCode,
|
882
|
+
body: _response.error.rawBody,
|
883
|
+
});
|
884
|
+
case "timeout":
|
885
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows.");
|
886
|
+
case "unknown":
|
887
|
+
throw new errors.AirtopError({
|
888
|
+
message: _response.error.errorMessage,
|
889
|
+
});
|
890
|
+
}
|
891
|
+
});
|
892
|
+
}
|
893
|
+
/**
|
894
|
+
* Get information about a browser window in a session, including the live view url.
|
895
|
+
*
|
896
|
+
* @param {string} sessionId - ID of the session that owns the window.
|
897
|
+
* @param {string} windowId - ID of the browser window, which can either be a normal AirTop windowId or a [CDP TargetId](https://chromedevtools.github.io/devtools-protocol/tot/Target/#type-TargetID) from a browser automation library like Puppeteer (typically associated with the page or main frame). Our SDKs will handle retrieving a TargetId for you from various popular browser automation libraries, but we also have details in our guides on how to do it manually.
|
898
|
+
* @param {Airtop.GetWindowInfoRequest} request
|
899
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
900
|
+
*
|
901
|
+
* @example
|
902
|
+
* await client.windows.getWindowInfo("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "7334da2a-91b0-42c5-6156-76a5eba87430", {
|
903
|
+
* screenResolution: "1280x720"
|
904
|
+
* })
|
905
|
+
*/
|
906
|
+
getWindowInfo(sessionId_1, windowId_1) {
|
907
|
+
return __awaiter(this, arguments, void 0, function* (sessionId, windowId, request = {}, requestOptions) {
|
908
|
+
var _a, _b, _c;
|
909
|
+
const { includeNavigationBar, disableResize, screenResolution } = request;
|
910
|
+
const _queryParams = {};
|
911
|
+
if (includeNavigationBar != null) {
|
912
|
+
_queryParams["includeNavigationBar"] = includeNavigationBar.toString();
|
913
|
+
}
|
914
|
+
if (disableResize != null) {
|
915
|
+
_queryParams["disableResize"] = disableResize.toString();
|
916
|
+
}
|
917
|
+
if (screenResolution != null) {
|
918
|
+
_queryParams["screenResolution"] = screenResolution;
|
919
|
+
}
|
920
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
921
|
+
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}`),
|
922
|
+
method: "GET",
|
923
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
924
|
+
contentType: "application/json",
|
925
|
+
queryParameters: _queryParams,
|
926
|
+
requestType: "json",
|
927
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
928
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
929
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
930
|
+
});
|
931
|
+
if (_response.ok) {
|
932
|
+
return serializers.WindowResponse.parseOrThrow(_response.body, {
|
933
|
+
unrecognizedObjectKeys: "passthrough",
|
934
|
+
allowUnrecognizedUnionMembers: true,
|
935
|
+
allowUnrecognizedEnumValues: true,
|
936
|
+
skipValidation: true,
|
937
|
+
breadcrumbsPrefix: ["response"],
|
938
|
+
});
|
939
|
+
}
|
940
|
+
if (_response.error.reason === "status-code") {
|
941
|
+
throw new errors.AirtopError({
|
942
|
+
statusCode: _response.error.statusCode,
|
943
|
+
body: _response.error.body,
|
944
|
+
});
|
945
|
+
}
|
946
|
+
switch (_response.error.reason) {
|
947
|
+
case "non-json":
|
948
|
+
throw new errors.AirtopError({
|
949
|
+
statusCode: _response.error.statusCode,
|
950
|
+
body: _response.error.rawBody,
|
951
|
+
});
|
952
|
+
case "timeout":
|
953
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling GET /v1/sessions/{sessionId}/windows/{windowId}.");
|
954
|
+
case "unknown":
|
955
|
+
throw new errors.AirtopError({
|
956
|
+
message: _response.error.errorMessage,
|
957
|
+
});
|
958
|
+
}
|
959
|
+
});
|
960
|
+
}
|
961
|
+
/**
|
962
|
+
* Loads a specified url on a given window
|
963
|
+
*
|
964
|
+
* @param {string} sessionId - ID of the session that owns the window.
|
965
|
+
* @param {string} windowId - Airtop window ID of the browser window.
|
966
|
+
* @param {Airtop.WindowLoadUrlV1Body} request
|
967
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
968
|
+
*
|
969
|
+
* @example
|
970
|
+
* await client.windows.loadUrl("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "7334da2a-91b0-42c5-6156-76a5eba87430", {
|
971
|
+
* url: "https://www.airtop.ai"
|
972
|
+
* })
|
973
|
+
*/
|
974
|
+
loadUrl(sessionId, windowId, request, requestOptions) {
|
975
|
+
return __awaiter(this, void 0, void 0, function* () {
|
976
|
+
var _a, _b, _c;
|
977
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
978
|
+
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}`),
|
979
|
+
method: "POST",
|
980
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
981
|
+
contentType: "application/json",
|
982
|
+
requestType: "json",
|
983
|
+
body: serializers.WindowLoadUrlV1Body.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
984
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
985
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
986
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
987
|
+
});
|
988
|
+
if (_response.ok) {
|
989
|
+
return serializers.OperationOutcomeResponse.parseOrThrow(_response.body, {
|
990
|
+
unrecognizedObjectKeys: "passthrough",
|
991
|
+
allowUnrecognizedUnionMembers: true,
|
992
|
+
allowUnrecognizedEnumValues: true,
|
993
|
+
skipValidation: true,
|
994
|
+
breadcrumbsPrefix: ["response"],
|
995
|
+
});
|
996
|
+
}
|
997
|
+
if (_response.error.reason === "status-code") {
|
998
|
+
throw new errors.AirtopError({
|
999
|
+
statusCode: _response.error.statusCode,
|
1000
|
+
body: _response.error.body,
|
1001
|
+
});
|
1002
|
+
}
|
1003
|
+
switch (_response.error.reason) {
|
1004
|
+
case "non-json":
|
1005
|
+
throw new errors.AirtopError({
|
1006
|
+
statusCode: _response.error.statusCode,
|
1007
|
+
body: _response.error.rawBody,
|
1008
|
+
});
|
1009
|
+
case "timeout":
|
1010
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}.");
|
1011
|
+
case "unknown":
|
1012
|
+
throw new errors.AirtopError({
|
1013
|
+
message: _response.error.errorMessage,
|
1014
|
+
});
|
1015
|
+
}
|
1016
|
+
});
|
1017
|
+
}
|
1018
|
+
/**
|
1019
|
+
* Closes a browser window in a session
|
1020
|
+
*
|
1021
|
+
* @param {string} sessionId - ID of the session that owns the window.
|
1022
|
+
* @param {string} windowId - Airtop window ID of the browser window.
|
1023
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
1024
|
+
*
|
1025
|
+
* @example
|
1026
|
+
* await client.windows.close("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "7334da2a-91b0-42c5-6156-76a5eba87430")
|
1027
|
+
*/
|
1028
|
+
close(sessionId, windowId, requestOptions) {
|
1029
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1030
|
+
var _a, _b, _c;
|
1031
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
1032
|
+
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}`),
|
1033
|
+
method: "DELETE",
|
1034
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
1035
|
+
contentType: "application/json",
|
1036
|
+
requestType: "json",
|
1037
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
1038
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
1039
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
1040
|
+
});
|
1041
|
+
if (_response.ok) {
|
1042
|
+
return serializers.WindowIdResponse.parseOrThrow(_response.body, {
|
1043
|
+
unrecognizedObjectKeys: "passthrough",
|
1044
|
+
allowUnrecognizedUnionMembers: true,
|
1045
|
+
allowUnrecognizedEnumValues: true,
|
1046
|
+
skipValidation: true,
|
1047
|
+
breadcrumbsPrefix: ["response"],
|
1048
|
+
});
|
1049
|
+
}
|
1050
|
+
if (_response.error.reason === "status-code") {
|
1051
|
+
throw new errors.AirtopError({
|
1052
|
+
statusCode: _response.error.statusCode,
|
1053
|
+
body: _response.error.body,
|
1054
|
+
});
|
1055
|
+
}
|
1056
|
+
switch (_response.error.reason) {
|
1057
|
+
case "non-json":
|
1058
|
+
throw new errors.AirtopError({
|
1059
|
+
statusCode: _response.error.statusCode,
|
1060
|
+
body: _response.error.rawBody,
|
1061
|
+
});
|
1062
|
+
case "timeout":
|
1063
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling DELETE /v1/sessions/{sessionId}/windows/{windowId}.");
|
1064
|
+
case "unknown":
|
1065
|
+
throw new errors.AirtopError({
|
1066
|
+
message: _response.error.errorMessage,
|
1067
|
+
});
|
1068
|
+
}
|
1069
|
+
});
|
1070
|
+
}
|
1071
|
+
/**
|
1072
|
+
* Execute a click interaction in a specific browser window
|
1073
|
+
*
|
1074
|
+
* @param {string} sessionId - The session id for the window.
|
1075
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
1076
|
+
* @param {Airtop.SessionClickHandlerRequestBody} request
|
1077
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
1078
|
+
*
|
1079
|
+
* @example
|
1080
|
+
* await client.windows.click("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
1081
|
+
* elementDescription: "The login button"
|
1082
|
+
* })
|
1083
|
+
*/
|
1084
|
+
click(sessionId, windowId, request, requestOptions) {
|
1085
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1086
|
+
var _a, _b, _c;
|
1087
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/click`),
|
1089
|
+
method: "POST",
|
1090
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
1091
|
+
contentType: "application/json",
|
1092
|
+
requestType: "json",
|
1093
|
+
body: serializers.SessionClickHandlerRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
1094
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
1095
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
1096
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
1097
|
+
});
|
1098
|
+
if (_response.ok) {
|
1099
|
+
return serializers.AiPromptResponse.parseOrThrow(_response.body, {
|
1100
|
+
unrecognizedObjectKeys: "passthrough",
|
1101
|
+
allowUnrecognizedUnionMembers: true,
|
1102
|
+
allowUnrecognizedEnumValues: true,
|
1103
|
+
skipValidation: true,
|
1104
|
+
breadcrumbsPrefix: ["response"],
|
1105
|
+
});
|
1106
|
+
}
|
1107
|
+
if (_response.error.reason === "status-code") {
|
1108
|
+
throw new errors.AirtopError({
|
1109
|
+
statusCode: _response.error.statusCode,
|
1110
|
+
body: _response.error.body,
|
1111
|
+
});
|
1112
|
+
}
|
1113
|
+
switch (_response.error.reason) {
|
1114
|
+
case "non-json":
|
1115
|
+
throw new errors.AirtopError({
|
1116
|
+
statusCode: _response.error.statusCode,
|
1117
|
+
body: _response.error.rawBody,
|
1118
|
+
});
|
1119
|
+
case "timeout":
|
1120
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/click.");
|
1121
|
+
case "unknown":
|
1122
|
+
throw new errors.AirtopError({
|
1123
|
+
message: _response.error.errorMessage,
|
1124
|
+
});
|
1125
|
+
}
|
1126
|
+
});
|
1127
|
+
}
|
1128
|
+
/**
|
1129
|
+
* Create a form-filler automation synchronously for the form loaded in the browser window
|
1130
|
+
*
|
1131
|
+
* @param {string} sessionId - The session id for the window.
|
1132
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
1133
|
+
* @param {Airtop.CreateFormFillerRequest} request
|
1134
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
1135
|
+
*
|
1136
|
+
* @example
|
1137
|
+
* await client.windows.createFormFiller("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430")
|
1138
|
+
*/
|
1139
|
+
createFormFiller(sessionId_1, windowId_1) {
|
1140
|
+
return __awaiter(this, arguments, void 0, function* (sessionId, windowId, request = {}, requestOptions) {
|
1141
|
+
var _a, _b, _c;
|
1142
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
1143
|
+
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/create-form-filler`),
|
1144
|
+
method: "POST",
|
1145
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
1146
|
+
contentType: "application/json",
|
1147
|
+
requestType: "json",
|
1148
|
+
body: serializers.CreateFormFillerRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
1149
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
1150
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
1151
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
1152
|
+
});
|
1153
|
+
if (_response.ok) {
|
1154
|
+
return serializers.AiPromptResponse.parseOrThrow(_response.body, {
|
1155
|
+
unrecognizedObjectKeys: "passthrough",
|
1156
|
+
allowUnrecognizedUnionMembers: true,
|
1157
|
+
allowUnrecognizedEnumValues: true,
|
1158
|
+
skipValidation: true,
|
1159
|
+
breadcrumbsPrefix: ["response"],
|
1160
|
+
});
|
1161
|
+
}
|
1162
|
+
if (_response.error.reason === "status-code") {
|
1163
|
+
throw new errors.AirtopError({
|
1164
|
+
statusCode: _response.error.statusCode,
|
1165
|
+
body: _response.error.body,
|
1166
|
+
});
|
1167
|
+
}
|
1168
|
+
switch (_response.error.reason) {
|
1169
|
+
case "non-json":
|
1170
|
+
throw new errors.AirtopError({
|
1171
|
+
statusCode: _response.error.statusCode,
|
1172
|
+
body: _response.error.rawBody,
|
1173
|
+
});
|
1174
|
+
case "timeout":
|
1175
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/create-form-filler.");
|
1176
|
+
case "unknown":
|
1177
|
+
throw new errors.AirtopError({
|
1178
|
+
message: _response.error.errorMessage,
|
1179
|
+
});
|
1180
|
+
}
|
1181
|
+
});
|
1182
|
+
}
|
1183
|
+
/**
|
1184
|
+
* Execute a file input interaction in a specific browser window.
|
1185
|
+
* includeHiddenElements defaults to true and considers hidden file input elements.
|
1186
|
+
* If there is only one file input element, it will be used directly.
|
1187
|
+
* If there are multiple file input elements, the elementDescription will be used by AI to
|
1188
|
+
* select among them.
|
1189
|
+
* If no file input elements are found by inspecting the page structure, elementDescription
|
1190
|
+
* will be used by AI to try to find a match visually.
|
1191
|
+
*
|
1192
|
+
* @param {string} sessionId - The session id for the window.
|
1193
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
1194
|
+
* @param {Airtop.SessionFileInputHandlerRequestBody} request
|
1195
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
1196
|
+
*
|
1197
|
+
* @example
|
1198
|
+
* await client.windows.fileInput("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430")
|
1199
|
+
*/
|
1200
|
+
fileInput(sessionId_1, windowId_1) {
|
1201
|
+
return __awaiter(this, arguments, void 0, function* (sessionId, windowId, request = {}, requestOptions) {
|
1202
|
+
var _a, _b, _c;
|
1203
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
1204
|
+
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/file-input`),
|
1205
|
+
method: "POST",
|
1206
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
1207
|
+
contentType: "application/json",
|
1208
|
+
requestType: "json",
|
1209
|
+
body: serializers.SessionFileInputHandlerRequestBody.jsonOrThrow(request, {
|
1210
|
+
unrecognizedObjectKeys: "strip",
|
1211
|
+
}),
|
1212
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
1213
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
1214
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
1215
|
+
});
|
1216
|
+
if (_response.ok) {
|
1217
|
+
return serializers.AiPromptResponse.parseOrThrow(_response.body, {
|
1218
|
+
unrecognizedObjectKeys: "passthrough",
|
1219
|
+
allowUnrecognizedUnionMembers: true,
|
1220
|
+
allowUnrecognizedEnumValues: true,
|
1221
|
+
skipValidation: true,
|
1222
|
+
breadcrumbsPrefix: ["response"],
|
1223
|
+
});
|
1224
|
+
}
|
1225
|
+
if (_response.error.reason === "status-code") {
|
1226
|
+
throw new errors.AirtopError({
|
1227
|
+
statusCode: _response.error.statusCode,
|
1228
|
+
body: _response.error.body,
|
1229
|
+
});
|
1230
|
+
}
|
1231
|
+
switch (_response.error.reason) {
|
1232
|
+
case "non-json":
|
1233
|
+
throw new errors.AirtopError({
|
1234
|
+
statusCode: _response.error.statusCode,
|
1235
|
+
body: _response.error.rawBody,
|
1236
|
+
});
|
1237
|
+
case "timeout":
|
1238
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/file-input.");
|
1239
|
+
case "unknown":
|
1240
|
+
throw new errors.AirtopError({
|
1241
|
+
message: _response.error.errorMessage,
|
1242
|
+
});
|
1243
|
+
}
|
1244
|
+
});
|
1245
|
+
}
|
1246
|
+
/**
|
1247
|
+
* Fill a form of a browser window synchronously using a form-filler automation
|
1248
|
+
*
|
1249
|
+
* @param {string} sessionId - The session id for the window.
|
1250
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
1251
|
+
* @param {Airtop.FillFormRequest} request
|
1252
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
1253
|
+
*
|
1254
|
+
* @example
|
1255
|
+
* await client.windows.fillForm("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
1256
|
+
* automationId: "automationId"
|
1257
|
+
* })
|
1258
|
+
*/
|
1259
|
+
fillForm(sessionId, windowId, request, requestOptions) {
|
1260
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1261
|
+
var _a, _b, _c;
|
1262
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
1263
|
+
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/fill-form`),
|
1264
|
+
method: "POST",
|
1265
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
1266
|
+
contentType: "application/json",
|
1267
|
+
requestType: "json",
|
1268
|
+
body: serializers.FillFormRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
1269
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
1270
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
1271
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
1272
|
+
});
|
1273
|
+
if (_response.ok) {
|
1274
|
+
return serializers.AiPromptResponse.parseOrThrow(_response.body, {
|
1275
|
+
unrecognizedObjectKeys: "passthrough",
|
1276
|
+
allowUnrecognizedUnionMembers: true,
|
1277
|
+
allowUnrecognizedEnumValues: true,
|
1278
|
+
skipValidation: true,
|
1279
|
+
breadcrumbsPrefix: ["response"],
|
1280
|
+
});
|
1281
|
+
}
|
1282
|
+
if (_response.error.reason === "status-code") {
|
1283
|
+
throw new errors.AirtopError({
|
1284
|
+
statusCode: _response.error.statusCode,
|
1285
|
+
body: _response.error.body,
|
1286
|
+
});
|
1287
|
+
}
|
1288
|
+
switch (_response.error.reason) {
|
1289
|
+
case "non-json":
|
1290
|
+
throw new errors.AirtopError({
|
1291
|
+
statusCode: _response.error.statusCode,
|
1292
|
+
body: _response.error.rawBody,
|
1293
|
+
});
|
1294
|
+
case "timeout":
|
1295
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/fill-form.");
|
1296
|
+
case "unknown":
|
1297
|
+
throw new errors.AirtopError({
|
1298
|
+
message: _response.error.errorMessage,
|
1299
|
+
});
|
1300
|
+
}
|
1301
|
+
});
|
1302
|
+
}
|
1303
|
+
/**
|
1304
|
+
* Execute a hover interaction in a specific browser window
|
1305
|
+
*
|
1306
|
+
* @param {string} sessionId - The session id for the window.
|
1307
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
1308
|
+
* @param {Airtop.SessionHoverHandlerRequestBody} request
|
1309
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
1310
|
+
*
|
1311
|
+
* @example
|
1312
|
+
* await client.windows.hover("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
1313
|
+
* elementDescription: "The search box input in the top right corner"
|
1314
|
+
* })
|
1315
|
+
*/
|
1316
|
+
hover(sessionId, windowId, request, requestOptions) {
|
1317
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1318
|
+
var _a, _b, _c;
|
1319
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
1320
|
+
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/hover`),
|
1321
|
+
method: "POST",
|
1322
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
1323
|
+
contentType: "application/json",
|
1324
|
+
requestType: "json",
|
1325
|
+
body: serializers.SessionHoverHandlerRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
1326
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
1327
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
1328
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
1329
|
+
});
|
1330
|
+
if (_response.ok) {
|
1331
|
+
return serializers.AiPromptResponse.parseOrThrow(_response.body, {
|
1332
|
+
unrecognizedObjectKeys: "passthrough",
|
1333
|
+
allowUnrecognizedUnionMembers: true,
|
1334
|
+
allowUnrecognizedEnumValues: true,
|
1335
|
+
skipValidation: true,
|
1336
|
+
breadcrumbsPrefix: ["response"],
|
1337
|
+
});
|
1338
|
+
}
|
1339
|
+
if (_response.error.reason === "status-code") {
|
1340
|
+
throw new errors.AirtopError({
|
1341
|
+
statusCode: _response.error.statusCode,
|
1342
|
+
body: _response.error.body,
|
1343
|
+
});
|
1344
|
+
}
|
1345
|
+
switch (_response.error.reason) {
|
1346
|
+
case "non-json":
|
1347
|
+
throw new errors.AirtopError({
|
1348
|
+
statusCode: _response.error.statusCode,
|
1349
|
+
body: _response.error.rawBody,
|
1350
|
+
});
|
1351
|
+
case "timeout":
|
1352
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/hover.");
|
1353
|
+
case "unknown":
|
1354
|
+
throw new errors.AirtopError({
|
1355
|
+
message: _response.error.errorMessage,
|
1356
|
+
});
|
1357
|
+
}
|
1358
|
+
});
|
1359
|
+
}
|
1360
|
+
/**
|
1361
|
+
* @param {string} sessionId - The session id for the window.
|
1362
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
1363
|
+
* @param {Airtop.SessionMonitorHandlerRequestBody} request
|
413
1364
|
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
414
1365
|
*
|
415
1366
|
* @example
|
416
|
-
* await client.windows.
|
417
|
-
*
|
1367
|
+
* await client.windows.monitor("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
1368
|
+
* condition: "Determine if the user appears to be signed in to the website"
|
418
1369
|
* })
|
419
1370
|
*/
|
420
|
-
|
1371
|
+
monitor(sessionId, windowId, request, requestOptions) {
|
421
1372
|
return __awaiter(this, void 0, void 0, function* () {
|
422
1373
|
var _a, _b, _c;
|
423
1374
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
424
|
-
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}`),
|
1375
|
+
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/monitor`),
|
425
1376
|
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.
|
1377
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
427
1378
|
contentType: "application/json",
|
428
1379
|
requestType: "json",
|
429
|
-
body: serializers.
|
1380
|
+
body: serializers.SessionMonitorHandlerRequestBody.jsonOrThrow(request, {
|
1381
|
+
unrecognizedObjectKeys: "strip",
|
1382
|
+
}),
|
430
1383
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
431
1384
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
432
1385
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
433
1386
|
});
|
434
1387
|
if (_response.ok) {
|
435
|
-
return serializers.
|
1388
|
+
return serializers.AiPromptResponse.parseOrThrow(_response.body, {
|
436
1389
|
unrecognizedObjectKeys: "passthrough",
|
437
1390
|
allowUnrecognizedUnionMembers: true,
|
438
1391
|
allowUnrecognizedEnumValues: true,
|
@@ -453,7 +1406,7 @@ class Windows {
|
|
453
1406
|
body: _response.error.rawBody,
|
454
1407
|
});
|
455
1408
|
case "timeout":
|
456
|
-
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}.");
|
1409
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/monitor.");
|
457
1410
|
case "unknown":
|
458
1411
|
throw new errors.AirtopError({
|
459
1412
|
message: _response.error.errorMessage,
|
@@ -462,30 +1415,34 @@ class Windows {
|
|
462
1415
|
});
|
463
1416
|
}
|
464
1417
|
/**
|
465
|
-
*
|
1418
|
+
* Prompt OpenAI Operator
|
466
1419
|
*
|
467
1420
|
* @param {string} sessionId - ID of the session that owns the window.
|
468
1421
|
* @param {string} windowId - Airtop window ID of the browser window.
|
1422
|
+
* @param {Airtop.OperatorPromptV1Body} request
|
469
1423
|
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
470
1424
|
*
|
471
1425
|
* @example
|
472
|
-
* await client.windows.
|
1426
|
+
* await client.windows.operatorPrompt("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "7334da2a-91b0-42c5-6156-76a5eba87430", {
|
1427
|
+
* prompt: "What is the latest news about OpenAI?"
|
1428
|
+
* })
|
473
1429
|
*/
|
474
|
-
|
1430
|
+
operatorPrompt(sessionId, windowId, request, requestOptions) {
|
475
1431
|
return __awaiter(this, void 0, void 0, function* () {
|
476
1432
|
var _a, _b, _c;
|
477
1433
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
478
|
-
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}`),
|
479
|
-
method: "
|
480
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
1434
|
+
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/operator`),
|
1435
|
+
method: "POST",
|
1436
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
481
1437
|
contentType: "application/json",
|
482
1438
|
requestType: "json",
|
1439
|
+
body: serializers.OperatorPromptV1Body.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
483
1440
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
484
1441
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
485
1442
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
486
1443
|
});
|
487
1444
|
if (_response.ok) {
|
488
|
-
return serializers.
|
1445
|
+
return serializers.AsyncOperatorPromptResponseEnvelope.parseOrThrow(_response.body, {
|
489
1446
|
unrecognizedObjectKeys: "passthrough",
|
490
1447
|
allowUnrecognizedUnionMembers: true,
|
491
1448
|
allowUnrecognizedEnumValues: true,
|
@@ -506,7 +1463,7 @@ class Windows {
|
|
506
1463
|
body: _response.error.rawBody,
|
507
1464
|
});
|
508
1465
|
case "timeout":
|
509
|
-
throw new errors.AirtopTimeoutError("Timeout exceeded when calling
|
1466
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/operator.");
|
510
1467
|
case "unknown":
|
511
1468
|
throw new errors.AirtopError({
|
512
1469
|
message: _response.error.errorMessage,
|
@@ -515,28 +1472,30 @@ class Windows {
|
|
515
1472
|
});
|
516
1473
|
}
|
517
1474
|
/**
|
518
|
-
*
|
1475
|
+
* 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?).
|
519
1476
|
*
|
520
1477
|
* @param {string} sessionId - The session id for the window.
|
521
1478
|
* @param {string} windowId - The Airtop window id of the browser window.
|
522
|
-
* @param {Airtop.
|
1479
|
+
* @param {Airtop.SessionPageQueryHandlerRequestBody} request
|
523
1480
|
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
524
1481
|
*
|
525
1482
|
* @example
|
526
|
-
* await client.windows.
|
527
|
-
*
|
1483
|
+
* await client.windows.pageQuery("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
1484
|
+
* prompt: "What is the main idea of this page?"
|
528
1485
|
* })
|
529
1486
|
*/
|
530
|
-
|
1487
|
+
pageQuery(sessionId, windowId, request, requestOptions) {
|
531
1488
|
return __awaiter(this, void 0, void 0, function* () {
|
532
1489
|
var _a, _b, _c;
|
533
1490
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
534
|
-
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/
|
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/page-query`),
|
535
1492
|
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.
|
1493
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
537
1494
|
contentType: "application/json",
|
538
1495
|
requestType: "json",
|
539
|
-
body: serializers.
|
1496
|
+
body: serializers.SessionPageQueryHandlerRequestBody.jsonOrThrow(request, {
|
1497
|
+
unrecognizedObjectKeys: "strip",
|
1498
|
+
}),
|
540
1499
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
541
1500
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
542
1501
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
@@ -563,7 +1522,7 @@ class Windows {
|
|
563
1522
|
body: _response.error.rawBody,
|
564
1523
|
});
|
565
1524
|
case "timeout":
|
566
|
-
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/
|
1525
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/page-query.");
|
567
1526
|
case "unknown":
|
568
1527
|
throw new errors.AirtopError({
|
569
1528
|
message: _response.error.errorMessage,
|
@@ -572,26 +1531,30 @@ class Windows {
|
|
572
1531
|
});
|
573
1532
|
}
|
574
1533
|
/**
|
575
|
-
*
|
1534
|
+
* Submit a prompt that queries the content of a specific browser window and paginates through pages to return a list of results.
|
576
1535
|
*
|
577
1536
|
* @param {string} sessionId - The session id for the window.
|
578
1537
|
* @param {string} windowId - The Airtop window id of the browser window.
|
579
|
-
* @param {Airtop.
|
1538
|
+
* @param {Airtop.SessionPaginatedExtractionHandlerRequestBody} request
|
580
1539
|
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
581
1540
|
*
|
582
1541
|
* @example
|
583
|
-
* await client.windows.
|
1542
|
+
* await client.windows.paginatedExtraction("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
1543
|
+
* 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."
|
1544
|
+
* })
|
584
1545
|
*/
|
585
|
-
|
586
|
-
return __awaiter(this,
|
1546
|
+
paginatedExtraction(sessionId, windowId, request, requestOptions) {
|
1547
|
+
return __awaiter(this, void 0, void 0, function* () {
|
587
1548
|
var _a, _b, _c;
|
588
1549
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
589
|
-
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/
|
1550
|
+
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/paginated-extraction`),
|
590
1551
|
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.
|
1552
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
592
1553
|
contentType: "application/json",
|
593
1554
|
requestType: "json",
|
594
|
-
body: serializers.
|
1555
|
+
body: serializers.SessionPaginatedExtractionHandlerRequestBody.jsonOrThrow(request, {
|
1556
|
+
unrecognizedObjectKeys: "strip",
|
1557
|
+
}),
|
595
1558
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
596
1559
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
597
1560
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
@@ -618,7 +1581,7 @@ class Windows {
|
|
618
1581
|
body: _response.error.rawBody,
|
619
1582
|
});
|
620
1583
|
case "timeout":
|
621
|
-
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/
|
1584
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/paginated-extraction.");
|
622
1585
|
case "unknown":
|
623
1586
|
throw new errors.AirtopError({
|
624
1587
|
message: _response.error.errorMessage,
|
@@ -627,28 +1590,28 @@ class Windows {
|
|
627
1590
|
});
|
628
1591
|
}
|
629
1592
|
/**
|
630
|
-
*
|
1593
|
+
* This endpoint is deprecated. Please use the `pageQuery` endpoint instead.
|
631
1594
|
*
|
632
1595
|
* @param {string} sessionId - The session id for the window.
|
633
1596
|
* @param {string} windowId - The Airtop window id of the browser window.
|
634
|
-
* @param {Airtop.
|
1597
|
+
* @param {Airtop.SessionPageQueryHandlerRequestBody} request
|
635
1598
|
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
636
1599
|
*
|
637
1600
|
* @example
|
638
|
-
* await client.windows.
|
639
|
-
*
|
1601
|
+
* await client.windows.promptContent("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
1602
|
+
* prompt: "What is the main idea of this page?"
|
640
1603
|
* })
|
641
1604
|
*/
|
642
|
-
|
1605
|
+
promptContent(sessionId, windowId, request, requestOptions) {
|
643
1606
|
return __awaiter(this, void 0, void 0, function* () {
|
644
1607
|
var _a, _b, _c;
|
645
1608
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
646
|
-
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/
|
1609
|
+
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/prompt-content`),
|
647
1610
|
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.
|
1611
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
649
1612
|
contentType: "application/json",
|
650
1613
|
requestType: "json",
|
651
|
-
body: serializers.
|
1614
|
+
body: serializers.SessionPageQueryHandlerRequestBody.jsonOrThrow(request, {
|
652
1615
|
unrecognizedObjectKeys: "strip",
|
653
1616
|
}),
|
654
1617
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
@@ -677,7 +1640,7 @@ class Windows {
|
|
677
1640
|
body: _response.error.rawBody,
|
678
1641
|
});
|
679
1642
|
case "timeout":
|
680
|
-
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/
|
1643
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/prompt-content.");
|
681
1644
|
case "unknown":
|
682
1645
|
throw new errors.AirtopError({
|
683
1646
|
message: _response.error.errorMessage,
|
@@ -686,34 +1649,32 @@ class Windows {
|
|
686
1649
|
});
|
687
1650
|
}
|
688
1651
|
/**
|
689
|
-
*
|
1652
|
+
* Scrape a window and return the content as markdown
|
690
1653
|
*
|
691
1654
|
* @param {string} sessionId - The session id for the window.
|
692
|
-
* @param {string} windowId - The Airtop window id of the browser window.
|
693
|
-
* @param {Airtop.
|
1655
|
+
* @param {string} windowId - The Airtop window id of the browser window to scrape.
|
1656
|
+
* @param {Airtop.ScrapeContentRequest} request
|
694
1657
|
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
695
1658
|
*
|
696
1659
|
* @example
|
697
|
-
* await client.windows.
|
698
|
-
* automationId: "automationId"
|
699
|
-
* })
|
1660
|
+
* await client.windows.scrapeContent("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430")
|
700
1661
|
*/
|
701
|
-
|
702
|
-
return __awaiter(this,
|
1662
|
+
scrapeContent(sessionId_1, windowId_1) {
|
1663
|
+
return __awaiter(this, arguments, void 0, function* (sessionId, windowId, request = {}, requestOptions) {
|
703
1664
|
var _a, _b, _c;
|
704
1665
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
705
|
-
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/
|
1666
|
+
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/scrape-content`),
|
706
1667
|
method: "POST",
|
707
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
1668
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
708
1669
|
contentType: "application/json",
|
709
1670
|
requestType: "json",
|
710
|
-
body: serializers.
|
1671
|
+
body: serializers.ScrapeContentRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
711
1672
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
712
1673
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
713
1674
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
714
1675
|
});
|
715
1676
|
if (_response.ok) {
|
716
|
-
return serializers.
|
1677
|
+
return serializers.ScrapeResponse.parseOrThrow(_response.body, {
|
717
1678
|
unrecognizedObjectKeys: "passthrough",
|
718
1679
|
allowUnrecognizedUnionMembers: true,
|
719
1680
|
allowUnrecognizedEnumValues: true,
|
@@ -734,7 +1695,7 @@ class Windows {
|
|
734
1695
|
body: _response.error.rawBody,
|
735
1696
|
});
|
736
1697
|
case "timeout":
|
737
|
-
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/
|
1698
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/scrape-content.");
|
738
1699
|
case "unknown":
|
739
1700
|
throw new errors.AirtopError({
|
740
1701
|
message: _response.error.errorMessage,
|
@@ -743,28 +1704,28 @@ class Windows {
|
|
743
1704
|
});
|
744
1705
|
}
|
745
1706
|
/**
|
746
|
-
*
|
1707
|
+
* Take a screenshot of a browser window
|
747
1708
|
*
|
748
1709
|
* @param {string} sessionId - The session id for the window.
|
749
1710
|
* @param {string} windowId - The Airtop window id of the browser window.
|
750
|
-
* @param {Airtop.
|
1711
|
+
* @param {Airtop.SessionScreenshotHandlerRequestBody} request
|
751
1712
|
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
752
1713
|
*
|
753
1714
|
* @example
|
754
|
-
* await client.windows.
|
755
|
-
* elementDescription: "The search box input in the top right corner"
|
756
|
-
* })
|
1715
|
+
* await client.windows.screenshot("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430")
|
757
1716
|
*/
|
758
|
-
|
759
|
-
return __awaiter(this,
|
1717
|
+
screenshot(sessionId_1, windowId_1) {
|
1718
|
+
return __awaiter(this, arguments, void 0, function* (sessionId, windowId, request = {}, requestOptions) {
|
760
1719
|
var _a, _b, _c;
|
761
1720
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
762
|
-
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/
|
1721
|
+
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/screenshot`),
|
763
1722
|
method: "POST",
|
764
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
1723
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
765
1724
|
contentType: "application/json",
|
766
1725
|
requestType: "json",
|
767
|
-
body: serializers.
|
1726
|
+
body: serializers.SessionScreenshotHandlerRequestBody.jsonOrThrow(request, {
|
1727
|
+
unrecognizedObjectKeys: "strip",
|
1728
|
+
}),
|
768
1729
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
769
1730
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
770
1731
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
@@ -791,7 +1752,7 @@ class Windows {
|
|
791
1752
|
body: _response.error.rawBody,
|
792
1753
|
});
|
793
1754
|
case "timeout":
|
794
|
-
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/
|
1755
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/screenshot.");
|
795
1756
|
case "unknown":
|
796
1757
|
throw new errors.AirtopError({
|
797
1758
|
message: _response.error.errorMessage,
|
@@ -800,28 +1761,26 @@ class Windows {
|
|
800
1761
|
});
|
801
1762
|
}
|
802
1763
|
/**
|
1764
|
+
* Execute a scroll interaction in a specific browser window
|
1765
|
+
*
|
803
1766
|
* @param {string} sessionId - The session id for the window.
|
804
1767
|
* @param {string} windowId - The Airtop window id of the browser window.
|
805
|
-
* @param {Airtop.
|
1768
|
+
* @param {Airtop.SessionScrollHandlerRequestBody} request
|
806
1769
|
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
807
1770
|
*
|
808
1771
|
* @example
|
809
|
-
* await client.windows.
|
810
|
-
* condition: "Determine if the user appears to be signed in to the website"
|
811
|
-
* })
|
1772
|
+
* await client.windows.scroll("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430")
|
812
1773
|
*/
|
813
|
-
|
814
|
-
return __awaiter(this,
|
1774
|
+
scroll(sessionId_1, windowId_1) {
|
1775
|
+
return __awaiter(this, arguments, void 0, function* (sessionId, windowId, request = {}, requestOptions) {
|
815
1776
|
var _a, _b, _c;
|
816
1777
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
817
|
-
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/
|
1778
|
+
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/scroll`),
|
818
1779
|
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.
|
1780
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
820
1781
|
contentType: "application/json",
|
821
1782
|
requestType: "json",
|
822
|
-
body: serializers.
|
823
|
-
unrecognizedObjectKeys: "strip",
|
824
|
-
}),
|
1783
|
+
body: serializers.SessionScrollHandlerRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
825
1784
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
826
1785
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
827
1786
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
@@ -848,7 +1807,7 @@ class Windows {
|
|
848
1807
|
body: _response.error.rawBody,
|
849
1808
|
});
|
850
1809
|
case "timeout":
|
851
|
-
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/
|
1810
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/scroll.");
|
852
1811
|
case "unknown":
|
853
1812
|
throw new errors.AirtopError({
|
854
1813
|
message: _response.error.errorMessage,
|
@@ -857,28 +1816,26 @@ class Windows {
|
|
857
1816
|
});
|
858
1817
|
}
|
859
1818
|
/**
|
860
|
-
*
|
1819
|
+
* This endpoint is deprecated. Please use the `pageQuery` endpoint and ask for a summary in the prompt instead.
|
861
1820
|
*
|
862
1821
|
* @param {string} sessionId - The session id for the window.
|
863
|
-
* @param {string} windowId - The Airtop window id of the browser window.
|
864
|
-
* @param {Airtop.
|
1822
|
+
* @param {string} windowId - The Airtop window id of the browser window to summarize.
|
1823
|
+
* @param {Airtop.SessionSummaryHandlerRequestBody} request
|
865
1824
|
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
866
1825
|
*
|
867
1826
|
* @example
|
868
|
-
* await client.windows.
|
869
|
-
* prompt: "What is the main idea of this page?"
|
870
|
-
* })
|
1827
|
+
* await client.windows.summarizeContent("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430")
|
871
1828
|
*/
|
872
|
-
|
873
|
-
return __awaiter(this,
|
1829
|
+
summarizeContent(sessionId_1, windowId_1) {
|
1830
|
+
return __awaiter(this, arguments, void 0, function* (sessionId, windowId, request = {}, requestOptions) {
|
874
1831
|
var _a, _b, _c;
|
875
1832
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
876
|
-
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/
|
1833
|
+
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/summarize-content`),
|
877
1834
|
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.
|
1835
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
879
1836
|
contentType: "application/json",
|
880
1837
|
requestType: "json",
|
881
|
-
body: serializers.
|
1838
|
+
body: serializers.SessionSummaryHandlerRequestBody.jsonOrThrow(request, {
|
882
1839
|
unrecognizedObjectKeys: "strip",
|
883
1840
|
}),
|
884
1841
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
@@ -907,7 +1864,7 @@ class Windows {
|
|
907
1864
|
body: _response.error.rawBody,
|
908
1865
|
});
|
909
1866
|
case "timeout":
|
910
|
-
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/
|
1867
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/summarize-content.");
|
911
1868
|
case "unknown":
|
912
1869
|
throw new errors.AirtopError({
|
913
1870
|
message: _response.error.errorMessage,
|
@@ -916,30 +1873,28 @@ class Windows {
|
|
916
1873
|
});
|
917
1874
|
}
|
918
1875
|
/**
|
919
|
-
*
|
1876
|
+
* Execute a type interaction in a specific browser window
|
920
1877
|
*
|
921
1878
|
* @param {string} sessionId - The session id for the window.
|
922
1879
|
* @param {string} windowId - The Airtop window id of the browser window.
|
923
|
-
* @param {Airtop.
|
1880
|
+
* @param {Airtop.SessionTypeHandlerRequestBody} request
|
924
1881
|
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
925
1882
|
*
|
926
1883
|
* @example
|
927
|
-
* await client.windows.
|
928
|
-
*
|
1884
|
+
* await client.windows.type("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
1885
|
+
* text: "Example text"
|
929
1886
|
* })
|
930
1887
|
*/
|
931
|
-
|
1888
|
+
type(sessionId, windowId, request, requestOptions) {
|
932
1889
|
return __awaiter(this, void 0, void 0, function* () {
|
933
1890
|
var _a, _b, _c;
|
934
1891
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
935
|
-
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/
|
1892
|
+
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, `v1/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/type`),
|
936
1893
|
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.
|
1894
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
938
1895
|
contentType: "application/json",
|
939
1896
|
requestType: "json",
|
940
|
-
body: serializers.
|
941
|
-
unrecognizedObjectKeys: "strip",
|
942
|
-
}),
|
1897
|
+
body: serializers.SessionTypeHandlerRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
943
1898
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
944
1899
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
945
1900
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
@@ -966,7 +1921,7 @@ class Windows {
|
|
966
1921
|
body: _response.error.rawBody,
|
967
1922
|
});
|
968
1923
|
case "timeout":
|
969
|
-
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/
|
1924
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v1/sessions/{sessionId}/windows/{windowId}/type.");
|
970
1925
|
case "unknown":
|
971
1926
|
throw new errors.AirtopError({
|
972
1927
|
message: _response.error.errorMessage,
|
@@ -975,36 +1930,35 @@ class Windows {
|
|
975
1930
|
});
|
976
1931
|
}
|
977
1932
|
/**
|
978
|
-
*
|
1933
|
+
* Perform actions in a specific browser window based on a prompt
|
979
1934
|
*
|
980
1935
|
* @param {string} sessionId - The session id for the window.
|
981
1936
|
* @param {string} windowId - The Airtop window id of the browser window.
|
982
|
-
* @param {Airtop.
|
1937
|
+
* @param {Airtop.ActRequest} request
|
983
1938
|
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
984
1939
|
*
|
985
1940
|
* @example
|
986
|
-
* await client.windows.
|
987
|
-
*
|
1941
|
+
* await client.windows.act("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
1942
|
+
* jobId: "123",
|
1943
|
+
* prompt: "Click the login button"
|
988
1944
|
* })
|
989
1945
|
*/
|
990
|
-
|
1946
|
+
act(sessionId, windowId, request, requestOptions) {
|
991
1947
|
return __awaiter(this, void 0, void 0, function* () {
|
992
1948
|
var _a, _b, _c;
|
993
1949
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
994
|
-
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, `
|
1950
|
+
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, `v2/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/act`),
|
995
1951
|
method: "POST",
|
996
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
1952
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
997
1953
|
contentType: "application/json",
|
998
1954
|
requestType: "json",
|
999
|
-
body: serializers.
|
1000
|
-
unrecognizedObjectKeys: "strip",
|
1001
|
-
}),
|
1955
|
+
body: serializers.ActRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
1002
1956
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
1003
1957
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
1004
1958
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
1005
1959
|
});
|
1006
1960
|
if (_response.ok) {
|
1007
|
-
return serializers.
|
1961
|
+
return serializers.AsyncSessionAiResponseEnvelope.parseOrThrow(_response.body, {
|
1008
1962
|
unrecognizedObjectKeys: "passthrough",
|
1009
1963
|
allowUnrecognizedUnionMembers: true,
|
1010
1964
|
allowUnrecognizedEnumValues: true,
|
@@ -1025,7 +1979,7 @@ class Windows {
|
|
1025
1979
|
body: _response.error.rawBody,
|
1026
1980
|
});
|
1027
1981
|
case "timeout":
|
1028
|
-
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /
|
1982
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v2/sessions/{sessionId}/windows/{windowId}/act.");
|
1029
1983
|
case "unknown":
|
1030
1984
|
throw new errors.AirtopError({
|
1031
1985
|
message: _response.error.errorMessage,
|
@@ -1034,32 +1988,35 @@ class Windows {
|
|
1034
1988
|
});
|
1035
1989
|
}
|
1036
1990
|
/**
|
1037
|
-
*
|
1991
|
+
* Extract data from a specific browser window based on a prompt
|
1038
1992
|
*
|
1039
1993
|
* @param {string} sessionId - The session id for the window.
|
1040
|
-
* @param {string} windowId - The Airtop window id of the browser window
|
1041
|
-
* @param {Airtop.
|
1994
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
1995
|
+
* @param {Airtop.ExtractRequest} request
|
1042
1996
|
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
1043
1997
|
*
|
1044
1998
|
* @example
|
1045
|
-
* await client.windows.
|
1999
|
+
* await client.windows.extract("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
2000
|
+
* jobId: "123",
|
2001
|
+
* prompt: "Extract all product prices from this page"
|
2002
|
+
* })
|
1046
2003
|
*/
|
1047
|
-
|
1048
|
-
return __awaiter(this,
|
2004
|
+
extract(sessionId, windowId, request, requestOptions) {
|
2005
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1049
2006
|
var _a, _b, _c;
|
1050
2007
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
1051
|
-
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, `
|
2008
|
+
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, `v2/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/extract`),
|
1052
2009
|
method: "POST",
|
1053
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
2010
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
1054
2011
|
contentType: "application/json",
|
1055
2012
|
requestType: "json",
|
1056
|
-
body: serializers.
|
2013
|
+
body: serializers.ExtractRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
1057
2014
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
1058
2015
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
1059
2016
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
1060
2017
|
});
|
1061
2018
|
if (_response.ok) {
|
1062
|
-
return serializers.
|
2019
|
+
return serializers.AsyncSessionAiResponseEnvelope.parseOrThrow(_response.body, {
|
1063
2020
|
unrecognizedObjectKeys: "passthrough",
|
1064
2021
|
allowUnrecognizedUnionMembers: true,
|
1065
2022
|
allowUnrecognizedEnumValues: true,
|
@@ -1080,7 +2037,7 @@ class Windows {
|
|
1080
2037
|
body: _response.error.rawBody,
|
1081
2038
|
});
|
1082
2039
|
case "timeout":
|
1083
|
-
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /
|
2040
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v2/sessions/{sessionId}/windows/{windowId}/extract.");
|
1084
2041
|
case "unknown":
|
1085
2042
|
throw new errors.AirtopError({
|
1086
2043
|
message: _response.error.errorMessage,
|
@@ -1089,34 +2046,35 @@ class Windows {
|
|
1089
2046
|
});
|
1090
2047
|
}
|
1091
2048
|
/**
|
1092
|
-
*
|
2049
|
+
* Find multiple elements in a browser window based on a prompt
|
1093
2050
|
*
|
1094
2051
|
* @param {string} sessionId - The session id for the window.
|
1095
2052
|
* @param {string} windowId - The Airtop window id of the browser window.
|
1096
|
-
* @param {Airtop.
|
2053
|
+
* @param {Airtop.FindManyRequest} request
|
1097
2054
|
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
1098
2055
|
*
|
1099
2056
|
* @example
|
1100
|
-
* await client.windows.
|
2057
|
+
* await client.windows.findMany("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
2058
|
+
* jobId: "123",
|
2059
|
+
* prompt: "Find all the news articles"
|
2060
|
+
* })
|
1101
2061
|
*/
|
1102
|
-
|
1103
|
-
return __awaiter(this,
|
2062
|
+
findMany(sessionId, windowId, request, requestOptions) {
|
2063
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1104
2064
|
var _a, _b, _c;
|
1105
2065
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
1106
|
-
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, `
|
2066
|
+
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, `v2/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/find-many`),
|
1107
2067
|
method: "POST",
|
1108
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
2068
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
1109
2069
|
contentType: "application/json",
|
1110
2070
|
requestType: "json",
|
1111
|
-
body: serializers.
|
1112
|
-
unrecognizedObjectKeys: "strip",
|
1113
|
-
}),
|
2071
|
+
body: serializers.FindManyRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
1114
2072
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
1115
2073
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
1116
2074
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
1117
2075
|
});
|
1118
2076
|
if (_response.ok) {
|
1119
|
-
return serializers.
|
2077
|
+
return serializers.AsyncSessionAiResponseEnvelope.parseOrThrow(_response.body, {
|
1120
2078
|
unrecognizedObjectKeys: "passthrough",
|
1121
2079
|
allowUnrecognizedUnionMembers: true,
|
1122
2080
|
allowUnrecognizedEnumValues: true,
|
@@ -1137,7 +2095,7 @@ class Windows {
|
|
1137
2095
|
body: _response.error.rawBody,
|
1138
2096
|
});
|
1139
2097
|
case "timeout":
|
1140
|
-
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /
|
2098
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v2/sessions/{sessionId}/windows/{windowId}/find-many.");
|
1141
2099
|
case "unknown":
|
1142
2100
|
throw new errors.AirtopError({
|
1143
2101
|
message: _response.error.errorMessage,
|
@@ -1146,32 +2104,35 @@ class Windows {
|
|
1146
2104
|
});
|
1147
2105
|
}
|
1148
2106
|
/**
|
1149
|
-
*
|
2107
|
+
* Find a specific element in a browser window based on a prompt
|
1150
2108
|
*
|
1151
2109
|
* @param {string} sessionId - The session id for the window.
|
1152
2110
|
* @param {string} windowId - The Airtop window id of the browser window.
|
1153
|
-
* @param {Airtop.
|
2111
|
+
* @param {Airtop.FindOneRequest} request
|
1154
2112
|
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
1155
2113
|
*
|
1156
2114
|
* @example
|
1157
|
-
* await client.windows.
|
2115
|
+
* await client.windows.findOne("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
2116
|
+
* jobId: "123",
|
2117
|
+
* prompt: "Find the login button"
|
2118
|
+
* })
|
1158
2119
|
*/
|
1159
|
-
|
1160
|
-
return __awaiter(this,
|
2120
|
+
findOne(sessionId, windowId, request, requestOptions) {
|
2121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1161
2122
|
var _a, _b, _c;
|
1162
2123
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
1163
|
-
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, `
|
2124
|
+
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, `v2/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/find-one`),
|
1164
2125
|
method: "POST",
|
1165
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
2126
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
1166
2127
|
contentType: "application/json",
|
1167
2128
|
requestType: "json",
|
1168
|
-
body: serializers.
|
2129
|
+
body: serializers.FindOneRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
1169
2130
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
1170
2131
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
1171
2132
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
1172
2133
|
});
|
1173
2134
|
if (_response.ok) {
|
1174
|
-
return serializers.
|
2135
|
+
return serializers.AsyncSessionAiResponseEnvelope.parseOrThrow(_response.body, {
|
1175
2136
|
unrecognizedObjectKeys: "passthrough",
|
1176
2137
|
allowUnrecognizedUnionMembers: true,
|
1177
2138
|
allowUnrecognizedEnumValues: true,
|
@@ -1192,7 +2153,7 @@ class Windows {
|
|
1192
2153
|
body: _response.error.rawBody,
|
1193
2154
|
});
|
1194
2155
|
case "timeout":
|
1195
|
-
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /
|
2156
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v2/sessions/{sessionId}/windows/{windowId}/find-one.");
|
1196
2157
|
case "unknown":
|
1197
2158
|
throw new errors.AirtopError({
|
1198
2159
|
message: _response.error.errorMessage,
|
@@ -1201,34 +2162,34 @@ class Windows {
|
|
1201
2162
|
});
|
1202
2163
|
}
|
1203
2164
|
/**
|
1204
|
-
*
|
2165
|
+
* Send a prompt to an LLM with context from the browser window
|
1205
2166
|
*
|
1206
2167
|
* @param {string} sessionId - The session id for the window.
|
1207
|
-
* @param {string} windowId - The Airtop window id of the browser window
|
1208
|
-
* @param {Airtop.
|
2168
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
2169
|
+
* @param {Airtop.LlmRequest} request
|
1209
2170
|
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
1210
2171
|
*
|
1211
2172
|
* @example
|
1212
|
-
* await client.windows.
|
2173
|
+
* await client.windows.llm("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
|
2174
|
+
* prompt: "Tell me about this webpage"
|
2175
|
+
* })
|
1213
2176
|
*/
|
1214
|
-
|
1215
|
-
return __awaiter(this,
|
2177
|
+
llm(sessionId, windowId, request, requestOptions) {
|
2178
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1216
2179
|
var _a, _b, _c;
|
1217
2180
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
1218
|
-
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, `
|
2181
|
+
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, `v2/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/llm`),
|
1219
2182
|
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.
|
2183
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
1221
2184
|
contentType: "application/json",
|
1222
2185
|
requestType: "json",
|
1223
|
-
body: serializers.
|
1224
|
-
unrecognizedObjectKeys: "strip",
|
1225
|
-
}),
|
2186
|
+
body: serializers.LlmRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
1226
2187
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
1227
2188
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
1228
2189
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
1229
2190
|
});
|
1230
2191
|
if (_response.ok) {
|
1231
|
-
return serializers.
|
2192
|
+
return serializers.AsyncSessionAiResponseEnvelope.parseOrThrow(_response.body, {
|
1232
2193
|
unrecognizedObjectKeys: "passthrough",
|
1233
2194
|
allowUnrecognizedUnionMembers: true,
|
1234
2195
|
allowUnrecognizedEnumValues: true,
|
@@ -1249,7 +2210,7 @@ class Windows {
|
|
1249
2210
|
body: _response.error.rawBody,
|
1250
2211
|
});
|
1251
2212
|
case "timeout":
|
1252
|
-
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /
|
2213
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v2/sessions/{sessionId}/windows/{windowId}/llm.");
|
1253
2214
|
case "unknown":
|
1254
2215
|
throw new errors.AirtopError({
|
1255
2216
|
message: _response.error.errorMessage,
|
@@ -1258,34 +2219,32 @@ class Windows {
|
|
1258
2219
|
});
|
1259
2220
|
}
|
1260
2221
|
/**
|
1261
|
-
*
|
2222
|
+
* Wait for a page to load
|
1262
2223
|
*
|
1263
2224
|
* @param {string} sessionId - The session id for the window.
|
1264
2225
|
* @param {string} windowId - The Airtop window id of the browser window.
|
1265
|
-
* @param {Airtop.
|
2226
|
+
* @param {Airtop.WaitForPageRequest} request
|
1266
2227
|
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
1267
2228
|
*
|
1268
2229
|
* @example
|
1269
|
-
* await client.windows.
|
1270
|
-
* text: "Example text"
|
1271
|
-
* })
|
2230
|
+
* await client.windows.waitForPage("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430")
|
1272
2231
|
*/
|
1273
|
-
|
1274
|
-
return __awaiter(this,
|
2232
|
+
waitForPage(sessionId_1, windowId_1) {
|
2233
|
+
return __awaiter(this, arguments, void 0, function* (sessionId, windowId, request = {}, requestOptions) {
|
1275
2234
|
var _a, _b, _c;
|
1276
2235
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
1277
|
-
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, `
|
2236
|
+
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, `v2/sessions/${encodeURIComponent(sessionId)}/windows/${encodeURIComponent(windowId)}/wait-for-page`),
|
1278
2237
|
method: "POST",
|
1279
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.
|
2238
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@airtop/sdk", "X-Fern-SDK-Version": "0.1.42-beta0", "User-Agent": "@airtop/sdk/0.1.42-beta0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
1280
2239
|
contentType: "application/json",
|
1281
2240
|
requestType: "json",
|
1282
|
-
body: serializers.
|
2241
|
+
body: serializers.WaitForPageRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
1283
2242
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
1284
2243
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
1285
2244
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
1286
2245
|
});
|
1287
2246
|
if (_response.ok) {
|
1288
|
-
return serializers.
|
2247
|
+
return serializers.AsyncSessionAiResponseEnvelope.parseOrThrow(_response.body, {
|
1289
2248
|
unrecognizedObjectKeys: "passthrough",
|
1290
2249
|
allowUnrecognizedUnionMembers: true,
|
1291
2250
|
allowUnrecognizedEnumValues: true,
|
@@ -1306,7 +2265,7 @@ class Windows {
|
|
1306
2265
|
body: _response.error.rawBody,
|
1307
2266
|
});
|
1308
2267
|
case "timeout":
|
1309
|
-
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /
|
2268
|
+
throw new errors.AirtopTimeoutError("Timeout exceeded when calling POST /v2/sessions/{sessionId}/windows/{windowId}/wait-for-page.");
|
1310
2269
|
case "unknown":
|
1311
2270
|
throw new errors.AirtopError({
|
1312
2271
|
message: _response.error.errorMessage,
|