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