mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2026-07-09 16:09:13 +00:00
Bump version to 1.0.31 (#5494)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
cb6d5e85cf
commit
c577af9f6e
45 changed files with 4066 additions and 111 deletions
|
|
@ -11,7 +11,6 @@ The Skyvern TypeScript library provides convenient access to the Skyvern APIs fr
|
|||
- [Usage](#usage)
|
||||
- [Request and Response Types](#request-and-response-types)
|
||||
- [Exception Handling](#exception-handling)
|
||||
- [File Uploads](#file-uploads)
|
||||
- [Advanced](#advanced)
|
||||
- [Additional Headers](#additional-headers)
|
||||
- [Additional Query String Parameters](#additional-query-string-parameters)
|
||||
|
|
@ -56,7 +55,7 @@ following namespace:
|
|||
```typescript
|
||||
import { Skyvern } from "@skyvern/client";
|
||||
|
||||
const request: Skyvern.RunTaskRequest = {
|
||||
const request: Skyvern.SchedulesListAllRequest = {
|
||||
...
|
||||
};
|
||||
```
|
||||
|
|
@ -81,50 +80,6 @@ try {
|
|||
}
|
||||
```
|
||||
|
||||
## File Uploads
|
||||
|
||||
You can upload files using the client:
|
||||
|
||||
```typescript
|
||||
import { createReadStream } from "fs";
|
||||
import { SkyvernClient } from "@skyvern/client";
|
||||
import * as fs from "fs";
|
||||
|
||||
const client = new SkyvernClient({ apiKey: "YOUR_API_KEY" });
|
||||
await client.uploadFile({
|
||||
file: fs.createReadStream("/path/to/your/file")
|
||||
});
|
||||
```
|
||||
The client accepts a variety of types for file upload parameters:
|
||||
* Stream types: `fs.ReadStream`, `stream.Readable`, and `ReadableStream`
|
||||
* Buffered types: `Buffer`, `Blob`, `File`, `ArrayBuffer`, `ArrayBufferView`, and `Uint8Array`
|
||||
|
||||
### Metadata
|
||||
|
||||
You can configure metadata when uploading a file:
|
||||
```typescript
|
||||
const file: Uploadable.WithMetadata = {
|
||||
data: createReadStream("path/to/file"),
|
||||
filename: "my-file", // optional
|
||||
contentType: "audio/mpeg", // optional
|
||||
contentLength: 1949, // optional
|
||||
};
|
||||
```
|
||||
|
||||
Alternatively, you can upload a file directly from a file path:
|
||||
```typescript
|
||||
const file : Uploadable.FromPath = {
|
||||
path: "path/to/file",
|
||||
filename: "my-file", // optional
|
||||
contentType: "audio/mpeg", // optional
|
||||
contentLength: 1949, // optional
|
||||
};
|
||||
```
|
||||
|
||||
The metadata is used to set the `Content-Length`, `Content-Type`, and `Content-Disposition` headers. If not provided, the client will attempt to determine them automatically.
|
||||
For example, `fs.ReadStream` has a `path` property which the SDK uses to retrieve the file size from the filesystem without loading it into memory.
|
||||
|
||||
|
||||
## Advanced
|
||||
|
||||
### Additional Headers
|
||||
|
|
|
|||
42
skyvern-ts/client/package-lock.json
generated
42
skyvern-ts/client/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@skyvern/client",
|
||||
"version": "1.0.30",
|
||||
"version": "1.0.31",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@skyvern/client",
|
||||
"version": "1.0.30",
|
||||
"version": "1.0.31",
|
||||
"dependencies": {
|
||||
"playwright": "^1.48.0"
|
||||
},
|
||||
|
|
@ -1631,9 +1631,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/baseline-browser-mapping": {
|
||||
"version": "2.10.16",
|
||||
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.16.tgz",
|
||||
"integrity": "sha512-Lyf3aK28zpsD1yQMiiHD4RvVb6UdMoo8xzG2XzFIfR9luPzOpcBlAsT/qfB1XWS1bxWT+UtE4WmQgsp297FYOA==",
|
||||
"version": "2.10.19",
|
||||
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.19.tgz",
|
||||
"integrity": "sha512-qCkNLi2sfBOn8XhZQ0FXsT1Ki/Yo5P90hrkRamVFRS7/KV9hpfA4HkoWNU152+8w0zPjnxo5psx5NL3PSGgv5g==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
|
|
@ -1708,9 +1708,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/caniuse-lite": {
|
||||
"version": "1.0.30001787",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001787.tgz",
|
||||
"integrity": "sha512-mNcrMN9KeI68u7muanUpEejSLghOKlVhRqS/Za2IeyGllJ9I9otGpR9g3nsw7n4W378TE/LyIteA0+/FOZm4Kg==",
|
||||
"version": "1.0.30001788",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001788.tgz",
|
||||
"integrity": "sha512-6q8HFp+lOQtcf7wBK+uEenxymVWkGKkjFpCvw5W25cmMwEDU45p1xQFBQv8JDlMMry7eNxyBaR+qxgmTUZkIRQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -1891,9 +1891,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/electron-to-chromium": {
|
||||
"version": "1.5.333",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.333.tgz",
|
||||
"integrity": "sha512-skNh4FsE+IpCJV7xAQGbQ4eyOGvcEctVBAk7a5KPzxC3alES9rLrT+2IsPRPgeQr8LVxdJr8BHQ9481+TOr0xg==",
|
||||
"version": "1.5.336",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.336.tgz",
|
||||
"integrity": "sha512-AbH9q9J455r/nLmdNZes0G0ZKcRX73FicwowalLs6ijwOmCJSRRrLX63lcAlzy9ux3dWK1w1+1nsBJEWN11hcQ==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
|
|
@ -3082,15 +3082,15 @@
|
|||
}
|
||||
},
|
||||
"node_modules/vite-node/node_modules/@types/node": {
|
||||
"version": "25.5.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.5.2.tgz",
|
||||
"integrity": "sha512-tO4ZIRKNC+MDWV4qKVZe3Ql/woTnmHDr5JD8UI5hn2pwBrHEwOEMZK7WlNb5RKB6EoJ02gwmQS9OrjuFnZYdpg==",
|
||||
"version": "25.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.6.0.tgz",
|
||||
"integrity": "sha512-+qIYRKdNYJwY3vRCZMdJbPLJAtGjQBudzZzdzwQYkEPQd+PJGixUL5QfvCLDaULoLv+RhT3LDkwEfKaAkgSmNQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~7.18.0"
|
||||
"undici-types": "~7.19.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vite-node/node_modules/fdir": {
|
||||
|
|
@ -3140,9 +3140,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/vite-node/node_modules/undici-types": {
|
||||
"version": "7.18.2",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz",
|
||||
"integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==",
|
||||
"version": "7.19.2",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.19.2.tgz",
|
||||
"integrity": "sha512-qYVnV5OEm2AW8cJMCpdV20CDyaN3g0AjDlOGf1OW4iaDEx8MwdtChUp4zu4H0VP3nDRF/8RKWH+IPp9uW0YGZg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
|
|
@ -3459,9 +3459,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/webpack": {
|
||||
"version": "5.105.4",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.105.4.tgz",
|
||||
"integrity": "sha512-jTywjboN9aHxFlToqb0K0Zs9SbBoW4zRUlGzI2tYNxVYcEi/IPpn+Xi4ye5jTLvX2YeLuic/IvxNot+Q1jMoOw==",
|
||||
"version": "5.106.1",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.106.1.tgz",
|
||||
"integrity": "sha512-EW8af29ak8Oaf4T8k8YsajjrDBDYgnKZ5er6ljWFJsXABfTNowQfvHLftwcepVgdz+IoLSdEAbBiM9DFXoll9w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@skyvern/client",
|
||||
"version": "1.0.30",
|
||||
"version": "1.0.31",
|
||||
"private": false,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
|||
|
|
@ -192,6 +192,466 @@ await client.scripts.runScript("s_abc123");
|
|||
</dl>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</details>
|
||||
|
||||
## Schedules
|
||||
<details><summary><code>client.schedules.<a href="/src/api/resources/schedules/client/Client.ts">listAll</a>({ ...params }) -> Skyvern.OrganizationScheduleListResponse</code></summary>
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
#### 🔌 Usage
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
```typescript
|
||||
await client.schedules.listAll({
|
||||
page: 1,
|
||||
page_size: 1,
|
||||
status: "active",
|
||||
search: "search"
|
||||
});
|
||||
|
||||
```
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
#### ⚙️ Parameters
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**request:** `Skyvern.SchedulesListAllRequest`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**requestOptions:** `Schedules.RequestOptions`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</details>
|
||||
|
||||
<details><summary><code>client.schedules.<a href="/src/api/resources/schedules/client/Client.ts">list</a>(workflowPermanentId) -> Skyvern.WorkflowScheduleListResponse</code></summary>
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
#### 🔌 Usage
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
```typescript
|
||||
await client.schedules.list("workflow_permanent_id");
|
||||
|
||||
```
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
#### ⚙️ Parameters
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**workflowPermanentId:** `string`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**requestOptions:** `Schedules.RequestOptions`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</details>
|
||||
|
||||
<details><summary><code>client.schedules.<a href="/src/api/resources/schedules/client/Client.ts">create</a>(workflowPermanentId, { ...params }) -> Skyvern.WorkflowScheduleResponse</code></summary>
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
#### 🔌 Usage
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
```typescript
|
||||
await client.schedules.create("workflow_permanent_id", {
|
||||
cron_expression: "cron_expression",
|
||||
timezone: "timezone"
|
||||
});
|
||||
|
||||
```
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
#### ⚙️ Parameters
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**workflowPermanentId:** `string`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**request:** `Skyvern.WorkflowScheduleUpsertRequest`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**requestOptions:** `Schedules.RequestOptions`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</details>
|
||||
|
||||
<details><summary><code>client.schedules.<a href="/src/api/resources/schedules/client/Client.ts">get</a>(workflowPermanentId, workflowScheduleId) -> Skyvern.WorkflowScheduleResponse</code></summary>
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
#### 🔌 Usage
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
```typescript
|
||||
await client.schedules.get("workflow_permanent_id", "workflow_schedule_id");
|
||||
|
||||
```
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
#### ⚙️ Parameters
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**workflowPermanentId:** `string`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**workflowScheduleId:** `string`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**requestOptions:** `Schedules.RequestOptions`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</details>
|
||||
|
||||
<details><summary><code>client.schedules.<a href="/src/api/resources/schedules/client/Client.ts">update</a>(workflowPermanentId, workflowScheduleId, { ...params }) -> Skyvern.WorkflowScheduleResponse</code></summary>
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
#### 🔌 Usage
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
```typescript
|
||||
await client.schedules.update("workflow_permanent_id", "workflow_schedule_id", {
|
||||
cron_expression: "cron_expression",
|
||||
timezone: "timezone"
|
||||
});
|
||||
|
||||
```
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
#### ⚙️ Parameters
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**workflowPermanentId:** `string`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**workflowScheduleId:** `string`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**request:** `Skyvern.WorkflowScheduleUpsertRequest`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**requestOptions:** `Schedules.RequestOptions`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</details>
|
||||
|
||||
<details><summary><code>client.schedules.<a href="/src/api/resources/schedules/client/Client.ts">delete</a>(workflowPermanentId, workflowScheduleId) -> Skyvern.DeleteScheduleResponse</code></summary>
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
#### 🔌 Usage
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
```typescript
|
||||
await client.schedules.delete("workflow_permanent_id", "workflow_schedule_id");
|
||||
|
||||
```
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
#### ⚙️ Parameters
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**workflowPermanentId:** `string`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**workflowScheduleId:** `string`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**requestOptions:** `Schedules.RequestOptions`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</details>
|
||||
|
||||
<details><summary><code>client.schedules.<a href="/src/api/resources/schedules/client/Client.ts">enable</a>(workflowPermanentId, workflowScheduleId) -> Skyvern.WorkflowScheduleResponse</code></summary>
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
#### 🔌 Usage
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
```typescript
|
||||
await client.schedules.enable("workflow_permanent_id", "workflow_schedule_id");
|
||||
|
||||
```
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
#### ⚙️ Parameters
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**workflowPermanentId:** `string`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**workflowScheduleId:** `string`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**requestOptions:** `Schedules.RequestOptions`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</details>
|
||||
|
||||
<details><summary><code>client.schedules.<a href="/src/api/resources/schedules/client/Client.ts">disable</a>(workflowPermanentId, workflowScheduleId) -> Skyvern.WorkflowScheduleResponse</code></summary>
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
#### 🔌 Usage
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
```typescript
|
||||
await client.schedules.disable("workflow_permanent_id", "workflow_schedule_id");
|
||||
|
||||
```
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
#### ⚙️ Parameters
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**workflowPermanentId:** `string`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**workflowScheduleId:** `string`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl>
|
||||
<dd>
|
||||
|
||||
**requestOptions:** `Schedules.RequestOptions`
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</details>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import * as Skyvern from "./api/index.js";
|
||||
import { Artifacts } from "./api/resources/artifacts/client/Client.js";
|
||||
import { Schedules } from "./api/resources/schedules/client/Client.js";
|
||||
import { Scripts } from "./api/resources/scripts/client/Client.js";
|
||||
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
|
||||
import { mergeHeaders, mergeOnlyDefinedHeaders } from "./core/headers.js";
|
||||
|
|
@ -19,6 +20,7 @@ export class SkyvernClient {
|
|||
protected readonly _options: SkyvernClient.Options;
|
||||
protected _artifacts: Artifacts | undefined;
|
||||
protected _scripts: Scripts | undefined;
|
||||
protected _schedules: Schedules | undefined;
|
||||
|
||||
constructor(_options: SkyvernClient.Options = {}) {
|
||||
this._options = {
|
||||
|
|
@ -28,8 +30,8 @@ export class SkyvernClient {
|
|||
"x-api-key": _options?.apiKey,
|
||||
"X-Fern-Language": "JavaScript",
|
||||
"X-Fern-SDK-Name": "@skyvern/client",
|
||||
"X-Fern-SDK-Version": "1.0.30",
|
||||
"User-Agent": "@skyvern/client/1.0.30",
|
||||
"X-Fern-SDK-Version": "1.0.31",
|
||||
"User-Agent": "@skyvern/client/1.0.31",
|
||||
"X-Fern-Runtime": core.RUNTIME.type,
|
||||
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
||||
},
|
||||
|
|
@ -46,6 +48,10 @@ export class SkyvernClient {
|
|||
return (this._scripts ??= new Scripts(this._options));
|
||||
}
|
||||
|
||||
public get schedules(): Schedules {
|
||||
return (this._schedules ??= new Schedules(this._options));
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a task
|
||||
*
|
||||
|
|
@ -1970,7 +1976,7 @@ export class SkyvernClient {
|
|||
* @example
|
||||
* import { createReadStream } from "fs";
|
||||
* await client.uploadFile({
|
||||
* file: fs.createReadStream("/path/to/your/file")
|
||||
* file: "file"
|
||||
* })
|
||||
*/
|
||||
public uploadFile(
|
||||
|
|
@ -1985,7 +1991,7 @@ export class SkyvernClient {
|
|||
requestOptions?: SkyvernClient.RequestOptions,
|
||||
): Promise<core.WithRawResponse<Skyvern.UploadFileResponse>> {
|
||||
const _request = await core.newFormData();
|
||||
await _request.appendFile("file", request.file);
|
||||
_request.append("file", request.file);
|
||||
const _maybeEncodedRequest = await _request.getRequest();
|
||||
const _headers: core.Fetcher.Args["headers"] = mergeHeaders(
|
||||
this._options?.headers,
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
// This file was auto-generated by Fern from our API Definition.
|
||||
|
||||
import type * as core from "../../../core/index.js";
|
||||
|
||||
/**
|
||||
* @example
|
||||
* {
|
||||
* file: fs.createReadStream("/path/to/your/file")
|
||||
* file: "file"
|
||||
* }
|
||||
*/
|
||||
export interface BodyUploadFileV1UploadFilePost {
|
||||
file: core.file.Uploadable;
|
||||
file: string;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,5 @@
|
|||
export * as artifacts from "./artifacts/index.js";
|
||||
export * from "./schedules/client/requests/index.js";
|
||||
export * as schedules from "./schedules/index.js";
|
||||
export * from "./schedules/types/index.js";
|
||||
export * as scripts from "./scripts/index.js";
|
||||
|
|
|
|||
689
skyvern-ts/client/src/api/resources/schedules/client/Client.ts
Normal file
689
skyvern-ts/client/src/api/resources/schedules/client/Client.ts
Normal file
|
|
@ -0,0 +1,689 @@
|
|||
// This file was auto-generated by Fern from our API Definition.
|
||||
|
||||
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
||||
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js";
|
||||
import * as core from "../../../../core/index.js";
|
||||
import * as environments from "../../../../environments.js";
|
||||
import * as errors from "../../../../errors/index.js";
|
||||
import * as Skyvern from "../../../index.js";
|
||||
|
||||
export declare namespace Schedules {
|
||||
export interface Options extends BaseClientOptions {}
|
||||
|
||||
export interface RequestOptions extends BaseRequestOptions {}
|
||||
}
|
||||
|
||||
export class Schedules {
|
||||
protected readonly _options: Schedules.Options;
|
||||
|
||||
constructor(_options: Schedules.Options = {}) {
|
||||
this._options = _options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Skyvern.SchedulesListAllRequest} request
|
||||
* @param {Schedules.RequestOptions} requestOptions - Request-specific configuration.
|
||||
*
|
||||
* @throws {@link Skyvern.UnprocessableEntityError}
|
||||
*
|
||||
* @example
|
||||
* await client.schedules.listAll({
|
||||
* page: 1,
|
||||
* page_size: 1,
|
||||
* status: "active",
|
||||
* search: "search"
|
||||
* })
|
||||
*/
|
||||
public listAll(
|
||||
request: Skyvern.SchedulesListAllRequest = {},
|
||||
requestOptions?: Schedules.RequestOptions,
|
||||
): core.HttpResponsePromise<Skyvern.OrganizationScheduleListResponse> {
|
||||
return core.HttpResponsePromise.fromPromise(this.__listAll(request, requestOptions));
|
||||
}
|
||||
|
||||
private async __listAll(
|
||||
request: Skyvern.SchedulesListAllRequest = {},
|
||||
requestOptions?: Schedules.RequestOptions,
|
||||
): Promise<core.WithRawResponse<Skyvern.OrganizationScheduleListResponse>> {
|
||||
const { page, page_size: pageSize, status, search } = request;
|
||||
const _queryParams: Record<string, string | string[] | object | object[] | null> = {};
|
||||
if (page != null) {
|
||||
_queryParams.page = page.toString();
|
||||
}
|
||||
|
||||
if (pageSize != null) {
|
||||
_queryParams.page_size = pageSize.toString();
|
||||
}
|
||||
|
||||
if (status != null) {
|
||||
_queryParams.status = status;
|
||||
}
|
||||
|
||||
if (search != null) {
|
||||
_queryParams.search = search;
|
||||
}
|
||||
|
||||
const _headers: core.Fetcher.Args["headers"] = mergeHeaders(
|
||||
this._options?.headers,
|
||||
mergeOnlyDefinedHeaders({ "x-api-key": requestOptions?.apiKey ?? this._options?.apiKey }),
|
||||
requestOptions?.headers,
|
||||
);
|
||||
const _response = await core.fetcher({
|
||||
url: core.url.join(
|
||||
(await core.Supplier.get(this._options.baseUrl)) ??
|
||||
(await core.Supplier.get(this._options.environment)) ??
|
||||
environments.SkyvernEnvironment.Cloud,
|
||||
"v1/schedules",
|
||||
),
|
||||
method: "GET",
|
||||
headers: _headers,
|
||||
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
|
||||
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
||||
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
||||
abortSignal: requestOptions?.abortSignal,
|
||||
});
|
||||
if (_response.ok) {
|
||||
return {
|
||||
data: _response.body as Skyvern.OrganizationScheduleListResponse,
|
||||
rawResponse: _response.rawResponse,
|
||||
};
|
||||
}
|
||||
|
||||
if (_response.error.reason === "status-code") {
|
||||
switch (_response.error.statusCode) {
|
||||
case 422:
|
||||
throw new Skyvern.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse);
|
||||
default:
|
||||
throw new errors.SkyvernError({
|
||||
statusCode: _response.error.statusCode,
|
||||
body: _response.error.body,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
switch (_response.error.reason) {
|
||||
case "non-json":
|
||||
throw new errors.SkyvernError({
|
||||
statusCode: _response.error.statusCode,
|
||||
body: _response.error.rawBody,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
case "timeout":
|
||||
throw new errors.SkyvernTimeoutError("Timeout exceeded when calling GET /v1/schedules.");
|
||||
case "unknown":
|
||||
throw new errors.SkyvernError({
|
||||
message: _response.error.errorMessage,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} workflowPermanentId
|
||||
* @param {Schedules.RequestOptions} requestOptions - Request-specific configuration.
|
||||
*
|
||||
* @throws {@link Skyvern.UnprocessableEntityError}
|
||||
*
|
||||
* @example
|
||||
* await client.schedules.list("workflow_permanent_id")
|
||||
*/
|
||||
public list(
|
||||
workflowPermanentId: string,
|
||||
requestOptions?: Schedules.RequestOptions,
|
||||
): core.HttpResponsePromise<Skyvern.WorkflowScheduleListResponse> {
|
||||
return core.HttpResponsePromise.fromPromise(this.__list(workflowPermanentId, requestOptions));
|
||||
}
|
||||
|
||||
private async __list(
|
||||
workflowPermanentId: string,
|
||||
requestOptions?: Schedules.RequestOptions,
|
||||
): Promise<core.WithRawResponse<Skyvern.WorkflowScheduleListResponse>> {
|
||||
const _headers: core.Fetcher.Args["headers"] = mergeHeaders(
|
||||
this._options?.headers,
|
||||
mergeOnlyDefinedHeaders({ "x-api-key": requestOptions?.apiKey ?? this._options?.apiKey }),
|
||||
requestOptions?.headers,
|
||||
);
|
||||
const _response = await core.fetcher({
|
||||
url: core.url.join(
|
||||
(await core.Supplier.get(this._options.baseUrl)) ??
|
||||
(await core.Supplier.get(this._options.environment)) ??
|
||||
environments.SkyvernEnvironment.Cloud,
|
||||
`v1/workflows/${core.url.encodePathParam(workflowPermanentId)}/schedules`,
|
||||
),
|
||||
method: "GET",
|
||||
headers: _headers,
|
||||
queryParameters: requestOptions?.queryParams,
|
||||
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
||||
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
||||
abortSignal: requestOptions?.abortSignal,
|
||||
});
|
||||
if (_response.ok) {
|
||||
return { data: _response.body as Skyvern.WorkflowScheduleListResponse, rawResponse: _response.rawResponse };
|
||||
}
|
||||
|
||||
if (_response.error.reason === "status-code") {
|
||||
switch (_response.error.statusCode) {
|
||||
case 422:
|
||||
throw new Skyvern.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse);
|
||||
default:
|
||||
throw new errors.SkyvernError({
|
||||
statusCode: _response.error.statusCode,
|
||||
body: _response.error.body,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
switch (_response.error.reason) {
|
||||
case "non-json":
|
||||
throw new errors.SkyvernError({
|
||||
statusCode: _response.error.statusCode,
|
||||
body: _response.error.rawBody,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
case "timeout":
|
||||
throw new errors.SkyvernTimeoutError(
|
||||
"Timeout exceeded when calling GET /v1/workflows/{workflow_permanent_id}/schedules.",
|
||||
);
|
||||
case "unknown":
|
||||
throw new errors.SkyvernError({
|
||||
message: _response.error.errorMessage,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} workflowPermanentId
|
||||
* @param {Skyvern.WorkflowScheduleUpsertRequest} request
|
||||
* @param {Schedules.RequestOptions} requestOptions - Request-specific configuration.
|
||||
*
|
||||
* @throws {@link Skyvern.UnprocessableEntityError}
|
||||
*
|
||||
* @example
|
||||
* await client.schedules.create("workflow_permanent_id", {
|
||||
* cron_expression: "cron_expression",
|
||||
* timezone: "timezone"
|
||||
* })
|
||||
*/
|
||||
public create(
|
||||
workflowPermanentId: string,
|
||||
request: Skyvern.WorkflowScheduleUpsertRequest,
|
||||
requestOptions?: Schedules.RequestOptions,
|
||||
): core.HttpResponsePromise<Skyvern.WorkflowScheduleResponse> {
|
||||
return core.HttpResponsePromise.fromPromise(this.__create(workflowPermanentId, request, requestOptions));
|
||||
}
|
||||
|
||||
private async __create(
|
||||
workflowPermanentId: string,
|
||||
request: Skyvern.WorkflowScheduleUpsertRequest,
|
||||
requestOptions?: Schedules.RequestOptions,
|
||||
): Promise<core.WithRawResponse<Skyvern.WorkflowScheduleResponse>> {
|
||||
const _headers: core.Fetcher.Args["headers"] = mergeHeaders(
|
||||
this._options?.headers,
|
||||
mergeOnlyDefinedHeaders({ "x-api-key": requestOptions?.apiKey ?? this._options?.apiKey }),
|
||||
requestOptions?.headers,
|
||||
);
|
||||
const _response = await core.fetcher({
|
||||
url: core.url.join(
|
||||
(await core.Supplier.get(this._options.baseUrl)) ??
|
||||
(await core.Supplier.get(this._options.environment)) ??
|
||||
environments.SkyvernEnvironment.Cloud,
|
||||
`v1/workflows/${core.url.encodePathParam(workflowPermanentId)}/schedules`,
|
||||
),
|
||||
method: "POST",
|
||||
headers: _headers,
|
||||
contentType: "application/json",
|
||||
queryParameters: requestOptions?.queryParams,
|
||||
requestType: "json",
|
||||
body: request,
|
||||
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
||||
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
||||
abortSignal: requestOptions?.abortSignal,
|
||||
});
|
||||
if (_response.ok) {
|
||||
return { data: _response.body as Skyvern.WorkflowScheduleResponse, rawResponse: _response.rawResponse };
|
||||
}
|
||||
|
||||
if (_response.error.reason === "status-code") {
|
||||
switch (_response.error.statusCode) {
|
||||
case 422:
|
||||
throw new Skyvern.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse);
|
||||
default:
|
||||
throw new errors.SkyvernError({
|
||||
statusCode: _response.error.statusCode,
|
||||
body: _response.error.body,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
switch (_response.error.reason) {
|
||||
case "non-json":
|
||||
throw new errors.SkyvernError({
|
||||
statusCode: _response.error.statusCode,
|
||||
body: _response.error.rawBody,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
case "timeout":
|
||||
throw new errors.SkyvernTimeoutError(
|
||||
"Timeout exceeded when calling POST /v1/workflows/{workflow_permanent_id}/schedules.",
|
||||
);
|
||||
case "unknown":
|
||||
throw new errors.SkyvernError({
|
||||
message: _response.error.errorMessage,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} workflowPermanentId
|
||||
* @param {string} workflowScheduleId
|
||||
* @param {Schedules.RequestOptions} requestOptions - Request-specific configuration.
|
||||
*
|
||||
* @throws {@link Skyvern.UnprocessableEntityError}
|
||||
*
|
||||
* @example
|
||||
* await client.schedules.get("workflow_permanent_id", "workflow_schedule_id")
|
||||
*/
|
||||
public get(
|
||||
workflowPermanentId: string,
|
||||
workflowScheduleId: string,
|
||||
requestOptions?: Schedules.RequestOptions,
|
||||
): core.HttpResponsePromise<Skyvern.WorkflowScheduleResponse> {
|
||||
return core.HttpResponsePromise.fromPromise(
|
||||
this.__get(workflowPermanentId, workflowScheduleId, requestOptions),
|
||||
);
|
||||
}
|
||||
|
||||
private async __get(
|
||||
workflowPermanentId: string,
|
||||
workflowScheduleId: string,
|
||||
requestOptions?: Schedules.RequestOptions,
|
||||
): Promise<core.WithRawResponse<Skyvern.WorkflowScheduleResponse>> {
|
||||
const _headers: core.Fetcher.Args["headers"] = mergeHeaders(
|
||||
this._options?.headers,
|
||||
mergeOnlyDefinedHeaders({ "x-api-key": requestOptions?.apiKey ?? this._options?.apiKey }),
|
||||
requestOptions?.headers,
|
||||
);
|
||||
const _response = await core.fetcher({
|
||||
url: core.url.join(
|
||||
(await core.Supplier.get(this._options.baseUrl)) ??
|
||||
(await core.Supplier.get(this._options.environment)) ??
|
||||
environments.SkyvernEnvironment.Cloud,
|
||||
`v1/workflows/${core.url.encodePathParam(workflowPermanentId)}/schedules/${core.url.encodePathParam(workflowScheduleId)}`,
|
||||
),
|
||||
method: "GET",
|
||||
headers: _headers,
|
||||
queryParameters: requestOptions?.queryParams,
|
||||
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
||||
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
||||
abortSignal: requestOptions?.abortSignal,
|
||||
});
|
||||
if (_response.ok) {
|
||||
return { data: _response.body as Skyvern.WorkflowScheduleResponse, rawResponse: _response.rawResponse };
|
||||
}
|
||||
|
||||
if (_response.error.reason === "status-code") {
|
||||
switch (_response.error.statusCode) {
|
||||
case 422:
|
||||
throw new Skyvern.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse);
|
||||
default:
|
||||
throw new errors.SkyvernError({
|
||||
statusCode: _response.error.statusCode,
|
||||
body: _response.error.body,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
switch (_response.error.reason) {
|
||||
case "non-json":
|
||||
throw new errors.SkyvernError({
|
||||
statusCode: _response.error.statusCode,
|
||||
body: _response.error.rawBody,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
case "timeout":
|
||||
throw new errors.SkyvernTimeoutError(
|
||||
"Timeout exceeded when calling GET /v1/workflows/{workflow_permanent_id}/schedules/{workflow_schedule_id}.",
|
||||
);
|
||||
case "unknown":
|
||||
throw new errors.SkyvernError({
|
||||
message: _response.error.errorMessage,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} workflowPermanentId
|
||||
* @param {string} workflowScheduleId
|
||||
* @param {Skyvern.WorkflowScheduleUpsertRequest} request
|
||||
* @param {Schedules.RequestOptions} requestOptions - Request-specific configuration.
|
||||
*
|
||||
* @throws {@link Skyvern.UnprocessableEntityError}
|
||||
*
|
||||
* @example
|
||||
* await client.schedules.update("workflow_permanent_id", "workflow_schedule_id", {
|
||||
* cron_expression: "cron_expression",
|
||||
* timezone: "timezone"
|
||||
* })
|
||||
*/
|
||||
public update(
|
||||
workflowPermanentId: string,
|
||||
workflowScheduleId: string,
|
||||
request: Skyvern.WorkflowScheduleUpsertRequest,
|
||||
requestOptions?: Schedules.RequestOptions,
|
||||
): core.HttpResponsePromise<Skyvern.WorkflowScheduleResponse> {
|
||||
return core.HttpResponsePromise.fromPromise(
|
||||
this.__update(workflowPermanentId, workflowScheduleId, request, requestOptions),
|
||||
);
|
||||
}
|
||||
|
||||
private async __update(
|
||||
workflowPermanentId: string,
|
||||
workflowScheduleId: string,
|
||||
request: Skyvern.WorkflowScheduleUpsertRequest,
|
||||
requestOptions?: Schedules.RequestOptions,
|
||||
): Promise<core.WithRawResponse<Skyvern.WorkflowScheduleResponse>> {
|
||||
const _headers: core.Fetcher.Args["headers"] = mergeHeaders(
|
||||
this._options?.headers,
|
||||
mergeOnlyDefinedHeaders({ "x-api-key": requestOptions?.apiKey ?? this._options?.apiKey }),
|
||||
requestOptions?.headers,
|
||||
);
|
||||
const _response = await core.fetcher({
|
||||
url: core.url.join(
|
||||
(await core.Supplier.get(this._options.baseUrl)) ??
|
||||
(await core.Supplier.get(this._options.environment)) ??
|
||||
environments.SkyvernEnvironment.Cloud,
|
||||
`v1/workflows/${core.url.encodePathParam(workflowPermanentId)}/schedules/${core.url.encodePathParam(workflowScheduleId)}`,
|
||||
),
|
||||
method: "PUT",
|
||||
headers: _headers,
|
||||
contentType: "application/json",
|
||||
queryParameters: requestOptions?.queryParams,
|
||||
requestType: "json",
|
||||
body: request,
|
||||
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
||||
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
||||
abortSignal: requestOptions?.abortSignal,
|
||||
});
|
||||
if (_response.ok) {
|
||||
return { data: _response.body as Skyvern.WorkflowScheduleResponse, rawResponse: _response.rawResponse };
|
||||
}
|
||||
|
||||
if (_response.error.reason === "status-code") {
|
||||
switch (_response.error.statusCode) {
|
||||
case 422:
|
||||
throw new Skyvern.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse);
|
||||
default:
|
||||
throw new errors.SkyvernError({
|
||||
statusCode: _response.error.statusCode,
|
||||
body: _response.error.body,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
switch (_response.error.reason) {
|
||||
case "non-json":
|
||||
throw new errors.SkyvernError({
|
||||
statusCode: _response.error.statusCode,
|
||||
body: _response.error.rawBody,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
case "timeout":
|
||||
throw new errors.SkyvernTimeoutError(
|
||||
"Timeout exceeded when calling PUT /v1/workflows/{workflow_permanent_id}/schedules/{workflow_schedule_id}.",
|
||||
);
|
||||
case "unknown":
|
||||
throw new errors.SkyvernError({
|
||||
message: _response.error.errorMessage,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} workflowPermanentId
|
||||
* @param {string} workflowScheduleId
|
||||
* @param {Schedules.RequestOptions} requestOptions - Request-specific configuration.
|
||||
*
|
||||
* @throws {@link Skyvern.UnprocessableEntityError}
|
||||
*
|
||||
* @example
|
||||
* await client.schedules.delete("workflow_permanent_id", "workflow_schedule_id")
|
||||
*/
|
||||
public delete(
|
||||
workflowPermanentId: string,
|
||||
workflowScheduleId: string,
|
||||
requestOptions?: Schedules.RequestOptions,
|
||||
): core.HttpResponsePromise<Skyvern.DeleteScheduleResponse> {
|
||||
return core.HttpResponsePromise.fromPromise(
|
||||
this.__delete(workflowPermanentId, workflowScheduleId, requestOptions),
|
||||
);
|
||||
}
|
||||
|
||||
private async __delete(
|
||||
workflowPermanentId: string,
|
||||
workflowScheduleId: string,
|
||||
requestOptions?: Schedules.RequestOptions,
|
||||
): Promise<core.WithRawResponse<Skyvern.DeleteScheduleResponse>> {
|
||||
const _headers: core.Fetcher.Args["headers"] = mergeHeaders(
|
||||
this._options?.headers,
|
||||
mergeOnlyDefinedHeaders({ "x-api-key": requestOptions?.apiKey ?? this._options?.apiKey }),
|
||||
requestOptions?.headers,
|
||||
);
|
||||
const _response = await core.fetcher({
|
||||
url: core.url.join(
|
||||
(await core.Supplier.get(this._options.baseUrl)) ??
|
||||
(await core.Supplier.get(this._options.environment)) ??
|
||||
environments.SkyvernEnvironment.Cloud,
|
||||
`v1/workflows/${core.url.encodePathParam(workflowPermanentId)}/schedules/${core.url.encodePathParam(workflowScheduleId)}`,
|
||||
),
|
||||
method: "DELETE",
|
||||
headers: _headers,
|
||||
queryParameters: requestOptions?.queryParams,
|
||||
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
||||
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
||||
abortSignal: requestOptions?.abortSignal,
|
||||
});
|
||||
if (_response.ok) {
|
||||
return { data: _response.body as Skyvern.DeleteScheduleResponse, rawResponse: _response.rawResponse };
|
||||
}
|
||||
|
||||
if (_response.error.reason === "status-code") {
|
||||
switch (_response.error.statusCode) {
|
||||
case 422:
|
||||
throw new Skyvern.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse);
|
||||
default:
|
||||
throw new errors.SkyvernError({
|
||||
statusCode: _response.error.statusCode,
|
||||
body: _response.error.body,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
switch (_response.error.reason) {
|
||||
case "non-json":
|
||||
throw new errors.SkyvernError({
|
||||
statusCode: _response.error.statusCode,
|
||||
body: _response.error.rawBody,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
case "timeout":
|
||||
throw new errors.SkyvernTimeoutError(
|
||||
"Timeout exceeded when calling DELETE /v1/workflows/{workflow_permanent_id}/schedules/{workflow_schedule_id}.",
|
||||
);
|
||||
case "unknown":
|
||||
throw new errors.SkyvernError({
|
||||
message: _response.error.errorMessage,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} workflowPermanentId
|
||||
* @param {string} workflowScheduleId
|
||||
* @param {Schedules.RequestOptions} requestOptions - Request-specific configuration.
|
||||
*
|
||||
* @throws {@link Skyvern.UnprocessableEntityError}
|
||||
*
|
||||
* @example
|
||||
* await client.schedules.enable("workflow_permanent_id", "workflow_schedule_id")
|
||||
*/
|
||||
public enable(
|
||||
workflowPermanentId: string,
|
||||
workflowScheduleId: string,
|
||||
requestOptions?: Schedules.RequestOptions,
|
||||
): core.HttpResponsePromise<Skyvern.WorkflowScheduleResponse> {
|
||||
return core.HttpResponsePromise.fromPromise(
|
||||
this.__enable(workflowPermanentId, workflowScheduleId, requestOptions),
|
||||
);
|
||||
}
|
||||
|
||||
private async __enable(
|
||||
workflowPermanentId: string,
|
||||
workflowScheduleId: string,
|
||||
requestOptions?: Schedules.RequestOptions,
|
||||
): Promise<core.WithRawResponse<Skyvern.WorkflowScheduleResponse>> {
|
||||
const _headers: core.Fetcher.Args["headers"] = mergeHeaders(
|
||||
this._options?.headers,
|
||||
mergeOnlyDefinedHeaders({ "x-api-key": requestOptions?.apiKey ?? this._options?.apiKey }),
|
||||
requestOptions?.headers,
|
||||
);
|
||||
const _response = await core.fetcher({
|
||||
url: core.url.join(
|
||||
(await core.Supplier.get(this._options.baseUrl)) ??
|
||||
(await core.Supplier.get(this._options.environment)) ??
|
||||
environments.SkyvernEnvironment.Cloud,
|
||||
`v1/workflows/${core.url.encodePathParam(workflowPermanentId)}/schedules/${core.url.encodePathParam(workflowScheduleId)}/enable`,
|
||||
),
|
||||
method: "POST",
|
||||
headers: _headers,
|
||||
queryParameters: requestOptions?.queryParams,
|
||||
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
||||
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
||||
abortSignal: requestOptions?.abortSignal,
|
||||
});
|
||||
if (_response.ok) {
|
||||
return { data: _response.body as Skyvern.WorkflowScheduleResponse, rawResponse: _response.rawResponse };
|
||||
}
|
||||
|
||||
if (_response.error.reason === "status-code") {
|
||||
switch (_response.error.statusCode) {
|
||||
case 422:
|
||||
throw new Skyvern.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse);
|
||||
default:
|
||||
throw new errors.SkyvernError({
|
||||
statusCode: _response.error.statusCode,
|
||||
body: _response.error.body,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
switch (_response.error.reason) {
|
||||
case "non-json":
|
||||
throw new errors.SkyvernError({
|
||||
statusCode: _response.error.statusCode,
|
||||
body: _response.error.rawBody,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
case "timeout":
|
||||
throw new errors.SkyvernTimeoutError(
|
||||
"Timeout exceeded when calling POST /v1/workflows/{workflow_permanent_id}/schedules/{workflow_schedule_id}/enable.",
|
||||
);
|
||||
case "unknown":
|
||||
throw new errors.SkyvernError({
|
||||
message: _response.error.errorMessage,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} workflowPermanentId
|
||||
* @param {string} workflowScheduleId
|
||||
* @param {Schedules.RequestOptions} requestOptions - Request-specific configuration.
|
||||
*
|
||||
* @throws {@link Skyvern.UnprocessableEntityError}
|
||||
*
|
||||
* @example
|
||||
* await client.schedules.disable("workflow_permanent_id", "workflow_schedule_id")
|
||||
*/
|
||||
public disable(
|
||||
workflowPermanentId: string,
|
||||
workflowScheduleId: string,
|
||||
requestOptions?: Schedules.RequestOptions,
|
||||
): core.HttpResponsePromise<Skyvern.WorkflowScheduleResponse> {
|
||||
return core.HttpResponsePromise.fromPromise(
|
||||
this.__disable(workflowPermanentId, workflowScheduleId, requestOptions),
|
||||
);
|
||||
}
|
||||
|
||||
private async __disable(
|
||||
workflowPermanentId: string,
|
||||
workflowScheduleId: string,
|
||||
requestOptions?: Schedules.RequestOptions,
|
||||
): Promise<core.WithRawResponse<Skyvern.WorkflowScheduleResponse>> {
|
||||
const _headers: core.Fetcher.Args["headers"] = mergeHeaders(
|
||||
this._options?.headers,
|
||||
mergeOnlyDefinedHeaders({ "x-api-key": requestOptions?.apiKey ?? this._options?.apiKey }),
|
||||
requestOptions?.headers,
|
||||
);
|
||||
const _response = await core.fetcher({
|
||||
url: core.url.join(
|
||||
(await core.Supplier.get(this._options.baseUrl)) ??
|
||||
(await core.Supplier.get(this._options.environment)) ??
|
||||
environments.SkyvernEnvironment.Cloud,
|
||||
`v1/workflows/${core.url.encodePathParam(workflowPermanentId)}/schedules/${core.url.encodePathParam(workflowScheduleId)}/disable`,
|
||||
),
|
||||
method: "POST",
|
||||
headers: _headers,
|
||||
queryParameters: requestOptions?.queryParams,
|
||||
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
||||
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
||||
abortSignal: requestOptions?.abortSignal,
|
||||
});
|
||||
if (_response.ok) {
|
||||
return { data: _response.body as Skyvern.WorkflowScheduleResponse, rawResponse: _response.rawResponse };
|
||||
}
|
||||
|
||||
if (_response.error.reason === "status-code") {
|
||||
switch (_response.error.statusCode) {
|
||||
case 422:
|
||||
throw new Skyvern.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse);
|
||||
default:
|
||||
throw new errors.SkyvernError({
|
||||
statusCode: _response.error.statusCode,
|
||||
body: _response.error.body,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
switch (_response.error.reason) {
|
||||
case "non-json":
|
||||
throw new errors.SkyvernError({
|
||||
statusCode: _response.error.statusCode,
|
||||
body: _response.error.rawBody,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
case "timeout":
|
||||
throw new errors.SkyvernTimeoutError(
|
||||
"Timeout exceeded when calling POST /v1/workflows/{workflow_permanent_id}/schedules/{workflow_schedule_id}/disable.",
|
||||
);
|
||||
case "unknown":
|
||||
throw new errors.SkyvernError({
|
||||
message: _response.error.errorMessage,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
export * from "./requests/index.js";
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
// This file was auto-generated by Fern from our API Definition.
|
||||
|
||||
import type * as Skyvern from "../../../../index.js";
|
||||
|
||||
/**
|
||||
* @example
|
||||
* {
|
||||
* page: 1,
|
||||
* page_size: 1,
|
||||
* status: "active",
|
||||
* search: "search"
|
||||
* }
|
||||
*/
|
||||
export interface SchedulesListAllRequest {
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
/** Filter by status: 'active' or 'paused' */
|
||||
status?: Skyvern.SchedulesListAllRequestStatus;
|
||||
/** Search by workflow title or schedule name */
|
||||
search?: string;
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
export type { SchedulesListAllRequest } from "./SchedulesListAllRequest.js";
|
||||
2
skyvern-ts/client/src/api/resources/schedules/index.ts
Normal file
2
skyvern-ts/client/src/api/resources/schedules/index.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export * from "./client/index.js";
|
||||
export * from "./types/index.js";
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// This file was auto-generated by Fern from our API Definition.
|
||||
|
||||
export const SchedulesListAllRequestStatus = {
|
||||
Active: "active",
|
||||
Paused: "paused",
|
||||
} as const;
|
||||
export type SchedulesListAllRequestStatus =
|
||||
(typeof SchedulesListAllRequestStatus)[keyof typeof SchedulesListAllRequestStatus];
|
||||
|
|
@ -0,0 +1 @@
|
|||
export * from "./SchedulesListAllRequestStatus.js";
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// This file was auto-generated by Fern from our API Definition.
|
||||
|
||||
export interface DeleteScheduleResponse {
|
||||
ok: boolean;
|
||||
}
|
||||
25
skyvern-ts/client/src/api/types/OrganizationScheduleItem.ts
Normal file
25
skyvern-ts/client/src/api/types/OrganizationScheduleItem.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// This file was auto-generated by Fern from our API Definition.
|
||||
|
||||
/**
|
||||
* Compact schedule projection for the org-wide list endpoint.
|
||||
*
|
||||
* Intentionally omits `backend_schedule_id` — the list view is for browsing
|
||||
* schedules in the dashboard, not for managing the underlying execution-backend
|
||||
* binding. Callers that need the backend id should fetch the individual
|
||||
* schedule via the per-workflow get endpoint.
|
||||
*/
|
||||
export interface OrganizationScheduleItem {
|
||||
workflow_schedule_id: string;
|
||||
organization_id: string;
|
||||
workflow_permanent_id: string;
|
||||
workflow_title: string;
|
||||
cron_expression: string;
|
||||
timezone: string;
|
||||
enabled: boolean;
|
||||
parameters?: Record<string, unknown>;
|
||||
name?: string;
|
||||
description?: string;
|
||||
next_run?: string;
|
||||
created_at: string;
|
||||
modified_at: string;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
// This file was auto-generated by Fern from our API Definition.
|
||||
|
||||
import type * as Skyvern from "../index.js";
|
||||
|
||||
export interface OrganizationScheduleListResponse {
|
||||
schedules: Skyvern.OrganizationScheduleItem[];
|
||||
total_count: number;
|
||||
page: number;
|
||||
page_size: number;
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ export interface TaskRunRequest {
|
|||
*/
|
||||
url?: string;
|
||||
/**
|
||||
* The engine that powers the agent task. The default value is `skyvern-2.0`, the latest Skyvern agent that performs pretty well with complex and multi-step tasks. `skyvern-1.0` is good for simple tasks like filling a form, or searching for information on Google. The `openai-cua` engine uses OpenAI's CUA model. The `anthropic-cua` uses Anthropic's Claude Sonnet 3.7 model with the computer use tool.
|
||||
* The engine that powers the agent task. The default value is `skyvern-1.0`, which is good for simple tasks like filling a form, or searching for information on Google. `skyvern-2.0` is the latest Skyvern agent that performs well with complex and multi-step tasks. The `openai-cua` engine uses OpenAI's CUA model. The `anthropic-cua` uses Anthropic's Claude Sonnet 3.7 model with the computer use tool.
|
||||
*/
|
||||
engine?: Skyvern.RunEngine;
|
||||
/** The title for the task */
|
||||
|
|
|
|||
17
skyvern-ts/client/src/api/types/WorkflowSchedule.ts
Normal file
17
skyvern-ts/client/src/api/types/WorkflowSchedule.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// This file was auto-generated by Fern from our API Definition.
|
||||
|
||||
export interface WorkflowSchedule {
|
||||
workflow_schedule_id: string;
|
||||
organization_id: string;
|
||||
workflow_permanent_id: string;
|
||||
cron_expression: string;
|
||||
timezone: string;
|
||||
enabled: boolean;
|
||||
parameters?: Record<string, unknown>;
|
||||
temporal_schedule_id?: string;
|
||||
name?: string;
|
||||
description?: string;
|
||||
created_at: string;
|
||||
modified_at: string;
|
||||
deleted_at?: string;
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
// This file was auto-generated by Fern from our API Definition.
|
||||
|
||||
import type * as Skyvern from "../index.js";
|
||||
|
||||
export interface WorkflowScheduleListResponse {
|
||||
schedules: Skyvern.WorkflowSchedule[];
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// This file was auto-generated by Fern from our API Definition.
|
||||
|
||||
import type * as Skyvern from "../index.js";
|
||||
|
||||
export interface WorkflowScheduleResponse {
|
||||
schedule: Skyvern.WorkflowSchedule;
|
||||
next_runs?: string[];
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
// This file was auto-generated by Fern from our API Definition.
|
||||
|
||||
export interface WorkflowScheduleUpsertRequest {
|
||||
cron_expression: string;
|
||||
timezone: string;
|
||||
enabled?: boolean;
|
||||
parameters?: Record<string, unknown>;
|
||||
name?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
|
@ -43,6 +43,7 @@ export * from "./CredentialResponse.js";
|
|||
export * from "./CredentialTypeOutput.js";
|
||||
export * from "./CredentialVaultType.js";
|
||||
export * from "./CreditCardCredentialResponse.js";
|
||||
export * from "./DeleteScheduleResponse.js";
|
||||
export * from "./DownloadToS3Block.js";
|
||||
export * from "./DownloadToS3BlockYaml.js";
|
||||
export * from "./Extensions.js";
|
||||
|
|
@ -91,6 +92,8 @@ export * from "./NonEmptyCreditCardCredential.js";
|
|||
export * from "./NonEmptyPasswordCredential.js";
|
||||
export * from "./OnePasswordCredentialParameter.js";
|
||||
export * from "./OnePasswordCredentialParameterYaml.js";
|
||||
export * from "./OrganizationScheduleItem.js";
|
||||
export * from "./OrganizationScheduleListResponse.js";
|
||||
export * from "./OtpType.js";
|
||||
export * from "./OutputParameter.js";
|
||||
export * from "./OutputParameterYaml.js";
|
||||
|
|
@ -173,6 +176,10 @@ export * from "./WorkflowRunStatus.js";
|
|||
export * from "./WorkflowRunTimeline.js";
|
||||
export * from "./WorkflowRunTimelineType.js";
|
||||
export * from "./WorkflowRunTriggerType.js";
|
||||
export * from "./WorkflowSchedule.js";
|
||||
export * from "./WorkflowScheduleListResponse.js";
|
||||
export * from "./WorkflowScheduleResponse.js";
|
||||
export * from "./WorkflowScheduleUpsertRequest.js";
|
||||
export * from "./WorkflowStatus.js";
|
||||
export * from "./WorkflowTriggerBlock.js";
|
||||
export * from "./WorkflowTriggerBlockParametersItem.js";
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
export const SDK_VERSION = "1.0.30";
|
||||
export const SDK_VERSION = "1.0.31";
|
||||
|
|
|
|||
560
skyvern-ts/client/tests/wire/schedules.test.ts
Normal file
560
skyvern-ts/client/tests/wire/schedules.test.ts
Normal file
|
|
@ -0,0 +1,560 @@
|
|||
// This file was auto-generated by Fern from our API Definition.
|
||||
|
||||
import * as Skyvern from "../../src/api/index";
|
||||
import { SkyvernClient } from "../../src/Client";
|
||||
import { mockServerPool } from "../mock-server/MockServerPool";
|
||||
|
||||
describe("Schedules", () => {
|
||||
test("listAll (1)", async () => {
|
||||
const server = mockServerPool.createServer();
|
||||
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
|
||||
|
||||
const rawResponseBody = {
|
||||
schedules: [
|
||||
{
|
||||
workflow_schedule_id: "workflow_schedule_id",
|
||||
organization_id: "organization_id",
|
||||
workflow_permanent_id: "workflow_permanent_id",
|
||||
workflow_title: "workflow_title",
|
||||
cron_expression: "cron_expression",
|
||||
timezone: "timezone",
|
||||
enabled: true,
|
||||
parameters: { key: "value" },
|
||||
name: "name",
|
||||
description: "description",
|
||||
next_run: "2024-01-15T09:30:00Z",
|
||||
created_at: "2024-01-15T09:30:00Z",
|
||||
modified_at: "2024-01-15T09:30:00Z",
|
||||
},
|
||||
],
|
||||
total_count: 1,
|
||||
page: 1,
|
||||
page_size: 1,
|
||||
};
|
||||
server.mockEndpoint().get("/v1/schedules").respondWith().statusCode(200).jsonBody(rawResponseBody).build();
|
||||
|
||||
const response = await client.schedules.listAll({
|
||||
page: 1,
|
||||
page_size: 1,
|
||||
status: "active",
|
||||
search: "search",
|
||||
});
|
||||
expect(response).toEqual({
|
||||
schedules: [
|
||||
{
|
||||
workflow_schedule_id: "workflow_schedule_id",
|
||||
organization_id: "organization_id",
|
||||
workflow_permanent_id: "workflow_permanent_id",
|
||||
workflow_title: "workflow_title",
|
||||
cron_expression: "cron_expression",
|
||||
timezone: "timezone",
|
||||
enabled: true,
|
||||
parameters: {
|
||||
key: "value",
|
||||
},
|
||||
name: "name",
|
||||
description: "description",
|
||||
next_run: "2024-01-15T09:30:00Z",
|
||||
created_at: "2024-01-15T09:30:00Z",
|
||||
modified_at: "2024-01-15T09:30:00Z",
|
||||
},
|
||||
],
|
||||
total_count: 1,
|
||||
page: 1,
|
||||
page_size: 1,
|
||||
});
|
||||
});
|
||||
|
||||
test("listAll (2)", async () => {
|
||||
const server = mockServerPool.createServer();
|
||||
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
|
||||
|
||||
const rawResponseBody = { key: "value" };
|
||||
server.mockEndpoint().get("/v1/schedules").respondWith().statusCode(422).jsonBody(rawResponseBody).build();
|
||||
|
||||
await expect(async () => {
|
||||
return await client.schedules.listAll();
|
||||
}).rejects.toThrow(Skyvern.UnprocessableEntityError);
|
||||
});
|
||||
|
||||
test("list (1)", async () => {
|
||||
const server = mockServerPool.createServer();
|
||||
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
|
||||
|
||||
const rawResponseBody = {
|
||||
schedules: [
|
||||
{
|
||||
workflow_schedule_id: "workflow_schedule_id",
|
||||
organization_id: "organization_id",
|
||||
workflow_permanent_id: "workflow_permanent_id",
|
||||
cron_expression: "cron_expression",
|
||||
timezone: "timezone",
|
||||
enabled: true,
|
||||
parameters: { key: "value" },
|
||||
temporal_schedule_id: "temporal_schedule_id",
|
||||
name: "name",
|
||||
description: "description",
|
||||
created_at: "2024-01-15T09:30:00Z",
|
||||
modified_at: "2024-01-15T09:30:00Z",
|
||||
deleted_at: "2024-01-15T09:30:00Z",
|
||||
},
|
||||
],
|
||||
};
|
||||
server
|
||||
.mockEndpoint()
|
||||
.get("/v1/workflows/workflow_permanent_id/schedules")
|
||||
.respondWith()
|
||||
.statusCode(200)
|
||||
.jsonBody(rawResponseBody)
|
||||
.build();
|
||||
|
||||
const response = await client.schedules.list("workflow_permanent_id");
|
||||
expect(response).toEqual({
|
||||
schedules: [
|
||||
{
|
||||
workflow_schedule_id: "workflow_schedule_id",
|
||||
organization_id: "organization_id",
|
||||
workflow_permanent_id: "workflow_permanent_id",
|
||||
cron_expression: "cron_expression",
|
||||
timezone: "timezone",
|
||||
enabled: true,
|
||||
parameters: {
|
||||
key: "value",
|
||||
},
|
||||
temporal_schedule_id: "temporal_schedule_id",
|
||||
name: "name",
|
||||
description: "description",
|
||||
created_at: "2024-01-15T09:30:00Z",
|
||||
modified_at: "2024-01-15T09:30:00Z",
|
||||
deleted_at: "2024-01-15T09:30:00Z",
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
test("list (2)", async () => {
|
||||
const server = mockServerPool.createServer();
|
||||
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
|
||||
|
||||
const rawResponseBody = { key: "value" };
|
||||
server
|
||||
.mockEndpoint()
|
||||
.get("/v1/workflows/workflow_permanent_id/schedules")
|
||||
.respondWith()
|
||||
.statusCode(422)
|
||||
.jsonBody(rawResponseBody)
|
||||
.build();
|
||||
|
||||
await expect(async () => {
|
||||
return await client.schedules.list("workflow_permanent_id");
|
||||
}).rejects.toThrow(Skyvern.UnprocessableEntityError);
|
||||
});
|
||||
|
||||
test("create (1)", async () => {
|
||||
const server = mockServerPool.createServer();
|
||||
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
|
||||
const rawRequestBody = { cron_expression: "cron_expression", timezone: "timezone" };
|
||||
const rawResponseBody = {
|
||||
schedule: {
|
||||
workflow_schedule_id: "workflow_schedule_id",
|
||||
organization_id: "organization_id",
|
||||
workflow_permanent_id: "workflow_permanent_id",
|
||||
cron_expression: "cron_expression",
|
||||
timezone: "timezone",
|
||||
enabled: true,
|
||||
parameters: { key: "value" },
|
||||
temporal_schedule_id: "temporal_schedule_id",
|
||||
name: "name",
|
||||
description: "description",
|
||||
created_at: "2024-01-15T09:30:00Z",
|
||||
modified_at: "2024-01-15T09:30:00Z",
|
||||
deleted_at: "2024-01-15T09:30:00Z",
|
||||
},
|
||||
next_runs: ["2024-01-15T09:30:00Z"],
|
||||
};
|
||||
server
|
||||
.mockEndpoint()
|
||||
.post("/v1/workflows/workflow_permanent_id/schedules")
|
||||
.jsonBody(rawRequestBody)
|
||||
.respondWith()
|
||||
.statusCode(200)
|
||||
.jsonBody(rawResponseBody)
|
||||
.build();
|
||||
|
||||
const response = await client.schedules.create("workflow_permanent_id", {
|
||||
cron_expression: "cron_expression",
|
||||
timezone: "timezone",
|
||||
});
|
||||
expect(response).toEqual({
|
||||
schedule: {
|
||||
workflow_schedule_id: "workflow_schedule_id",
|
||||
organization_id: "organization_id",
|
||||
workflow_permanent_id: "workflow_permanent_id",
|
||||
cron_expression: "cron_expression",
|
||||
timezone: "timezone",
|
||||
enabled: true,
|
||||
parameters: {
|
||||
key: "value",
|
||||
},
|
||||
temporal_schedule_id: "temporal_schedule_id",
|
||||
name: "name",
|
||||
description: "description",
|
||||
created_at: "2024-01-15T09:30:00Z",
|
||||
modified_at: "2024-01-15T09:30:00Z",
|
||||
deleted_at: "2024-01-15T09:30:00Z",
|
||||
},
|
||||
next_runs: ["2024-01-15T09:30:00Z"],
|
||||
});
|
||||
});
|
||||
|
||||
test("create (2)", async () => {
|
||||
const server = mockServerPool.createServer();
|
||||
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
|
||||
const rawRequestBody = { cron_expression: "cron_expression", timezone: "timezone" };
|
||||
const rawResponseBody = { key: "value" };
|
||||
server
|
||||
.mockEndpoint()
|
||||
.post("/v1/workflows/workflow_permanent_id/schedules")
|
||||
.jsonBody(rawRequestBody)
|
||||
.respondWith()
|
||||
.statusCode(422)
|
||||
.jsonBody(rawResponseBody)
|
||||
.build();
|
||||
|
||||
await expect(async () => {
|
||||
return await client.schedules.create("workflow_permanent_id", {
|
||||
cron_expression: "cron_expression",
|
||||
timezone: "timezone",
|
||||
});
|
||||
}).rejects.toThrow(Skyvern.UnprocessableEntityError);
|
||||
});
|
||||
|
||||
test("get (1)", async () => {
|
||||
const server = mockServerPool.createServer();
|
||||
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
|
||||
|
||||
const rawResponseBody = {
|
||||
schedule: {
|
||||
workflow_schedule_id: "workflow_schedule_id",
|
||||
organization_id: "organization_id",
|
||||
workflow_permanent_id: "workflow_permanent_id",
|
||||
cron_expression: "cron_expression",
|
||||
timezone: "timezone",
|
||||
enabled: true,
|
||||
parameters: { key: "value" },
|
||||
temporal_schedule_id: "temporal_schedule_id",
|
||||
name: "name",
|
||||
description: "description",
|
||||
created_at: "2024-01-15T09:30:00Z",
|
||||
modified_at: "2024-01-15T09:30:00Z",
|
||||
deleted_at: "2024-01-15T09:30:00Z",
|
||||
},
|
||||
next_runs: ["2024-01-15T09:30:00Z"],
|
||||
};
|
||||
server
|
||||
.mockEndpoint()
|
||||
.get("/v1/workflows/workflow_permanent_id/schedules/workflow_schedule_id")
|
||||
.respondWith()
|
||||
.statusCode(200)
|
||||
.jsonBody(rawResponseBody)
|
||||
.build();
|
||||
|
||||
const response = await client.schedules.get("workflow_permanent_id", "workflow_schedule_id");
|
||||
expect(response).toEqual({
|
||||
schedule: {
|
||||
workflow_schedule_id: "workflow_schedule_id",
|
||||
organization_id: "organization_id",
|
||||
workflow_permanent_id: "workflow_permanent_id",
|
||||
cron_expression: "cron_expression",
|
||||
timezone: "timezone",
|
||||
enabled: true,
|
||||
parameters: {
|
||||
key: "value",
|
||||
},
|
||||
temporal_schedule_id: "temporal_schedule_id",
|
||||
name: "name",
|
||||
description: "description",
|
||||
created_at: "2024-01-15T09:30:00Z",
|
||||
modified_at: "2024-01-15T09:30:00Z",
|
||||
deleted_at: "2024-01-15T09:30:00Z",
|
||||
},
|
||||
next_runs: ["2024-01-15T09:30:00Z"],
|
||||
});
|
||||
});
|
||||
|
||||
test("get (2)", async () => {
|
||||
const server = mockServerPool.createServer();
|
||||
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
|
||||
|
||||
const rawResponseBody = { key: "value" };
|
||||
server
|
||||
.mockEndpoint()
|
||||
.get("/v1/workflows/workflow_permanent_id/schedules/workflow_schedule_id")
|
||||
.respondWith()
|
||||
.statusCode(422)
|
||||
.jsonBody(rawResponseBody)
|
||||
.build();
|
||||
|
||||
await expect(async () => {
|
||||
return await client.schedules.get("workflow_permanent_id", "workflow_schedule_id");
|
||||
}).rejects.toThrow(Skyvern.UnprocessableEntityError);
|
||||
});
|
||||
|
||||
test("update (1)", async () => {
|
||||
const server = mockServerPool.createServer();
|
||||
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
|
||||
const rawRequestBody = { cron_expression: "cron_expression", timezone: "timezone" };
|
||||
const rawResponseBody = {
|
||||
schedule: {
|
||||
workflow_schedule_id: "workflow_schedule_id",
|
||||
organization_id: "organization_id",
|
||||
workflow_permanent_id: "workflow_permanent_id",
|
||||
cron_expression: "cron_expression",
|
||||
timezone: "timezone",
|
||||
enabled: true,
|
||||
parameters: { key: "value" },
|
||||
temporal_schedule_id: "temporal_schedule_id",
|
||||
name: "name",
|
||||
description: "description",
|
||||
created_at: "2024-01-15T09:30:00Z",
|
||||
modified_at: "2024-01-15T09:30:00Z",
|
||||
deleted_at: "2024-01-15T09:30:00Z",
|
||||
},
|
||||
next_runs: ["2024-01-15T09:30:00Z"],
|
||||
};
|
||||
server
|
||||
.mockEndpoint()
|
||||
.put("/v1/workflows/workflow_permanent_id/schedules/workflow_schedule_id")
|
||||
.jsonBody(rawRequestBody)
|
||||
.respondWith()
|
||||
.statusCode(200)
|
||||
.jsonBody(rawResponseBody)
|
||||
.build();
|
||||
|
||||
const response = await client.schedules.update("workflow_permanent_id", "workflow_schedule_id", {
|
||||
cron_expression: "cron_expression",
|
||||
timezone: "timezone",
|
||||
});
|
||||
expect(response).toEqual({
|
||||
schedule: {
|
||||
workflow_schedule_id: "workflow_schedule_id",
|
||||
organization_id: "organization_id",
|
||||
workflow_permanent_id: "workflow_permanent_id",
|
||||
cron_expression: "cron_expression",
|
||||
timezone: "timezone",
|
||||
enabled: true,
|
||||
parameters: {
|
||||
key: "value",
|
||||
},
|
||||
temporal_schedule_id: "temporal_schedule_id",
|
||||
name: "name",
|
||||
description: "description",
|
||||
created_at: "2024-01-15T09:30:00Z",
|
||||
modified_at: "2024-01-15T09:30:00Z",
|
||||
deleted_at: "2024-01-15T09:30:00Z",
|
||||
},
|
||||
next_runs: ["2024-01-15T09:30:00Z"],
|
||||
});
|
||||
});
|
||||
|
||||
test("update (2)", async () => {
|
||||
const server = mockServerPool.createServer();
|
||||
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
|
||||
const rawRequestBody = { cron_expression: "cron_expression", timezone: "timezone" };
|
||||
const rawResponseBody = { key: "value" };
|
||||
server
|
||||
.mockEndpoint()
|
||||
.put("/v1/workflows/workflow_permanent_id/schedules/workflow_schedule_id")
|
||||
.jsonBody(rawRequestBody)
|
||||
.respondWith()
|
||||
.statusCode(422)
|
||||
.jsonBody(rawResponseBody)
|
||||
.build();
|
||||
|
||||
await expect(async () => {
|
||||
return await client.schedules.update("workflow_permanent_id", "workflow_schedule_id", {
|
||||
cron_expression: "cron_expression",
|
||||
timezone: "timezone",
|
||||
});
|
||||
}).rejects.toThrow(Skyvern.UnprocessableEntityError);
|
||||
});
|
||||
|
||||
test("delete (1)", async () => {
|
||||
const server = mockServerPool.createServer();
|
||||
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
|
||||
|
||||
const rawResponseBody = { ok: true };
|
||||
server
|
||||
.mockEndpoint()
|
||||
.delete("/v1/workflows/workflow_permanent_id/schedules/workflow_schedule_id")
|
||||
.respondWith()
|
||||
.statusCode(200)
|
||||
.jsonBody(rawResponseBody)
|
||||
.build();
|
||||
|
||||
const response = await client.schedules.delete("workflow_permanent_id", "workflow_schedule_id");
|
||||
expect(response).toEqual({
|
||||
ok: true,
|
||||
});
|
||||
});
|
||||
|
||||
test("delete (2)", async () => {
|
||||
const server = mockServerPool.createServer();
|
||||
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
|
||||
|
||||
const rawResponseBody = { key: "value" };
|
||||
server
|
||||
.mockEndpoint()
|
||||
.delete("/v1/workflows/workflow_permanent_id/schedules/workflow_schedule_id")
|
||||
.respondWith()
|
||||
.statusCode(422)
|
||||
.jsonBody(rawResponseBody)
|
||||
.build();
|
||||
|
||||
await expect(async () => {
|
||||
return await client.schedules.delete("workflow_permanent_id", "workflow_schedule_id");
|
||||
}).rejects.toThrow(Skyvern.UnprocessableEntityError);
|
||||
});
|
||||
|
||||
test("enable (1)", async () => {
|
||||
const server = mockServerPool.createServer();
|
||||
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
|
||||
|
||||
const rawResponseBody = {
|
||||
schedule: {
|
||||
workflow_schedule_id: "workflow_schedule_id",
|
||||
organization_id: "organization_id",
|
||||
workflow_permanent_id: "workflow_permanent_id",
|
||||
cron_expression: "cron_expression",
|
||||
timezone: "timezone",
|
||||
enabled: true,
|
||||
parameters: { key: "value" },
|
||||
temporal_schedule_id: "temporal_schedule_id",
|
||||
name: "name",
|
||||
description: "description",
|
||||
created_at: "2024-01-15T09:30:00Z",
|
||||
modified_at: "2024-01-15T09:30:00Z",
|
||||
deleted_at: "2024-01-15T09:30:00Z",
|
||||
},
|
||||
next_runs: ["2024-01-15T09:30:00Z"],
|
||||
};
|
||||
server
|
||||
.mockEndpoint()
|
||||
.post("/v1/workflows/workflow_permanent_id/schedules/workflow_schedule_id/enable")
|
||||
.respondWith()
|
||||
.statusCode(200)
|
||||
.jsonBody(rawResponseBody)
|
||||
.build();
|
||||
|
||||
const response = await client.schedules.enable("workflow_permanent_id", "workflow_schedule_id");
|
||||
expect(response).toEqual({
|
||||
schedule: {
|
||||
workflow_schedule_id: "workflow_schedule_id",
|
||||
organization_id: "organization_id",
|
||||
workflow_permanent_id: "workflow_permanent_id",
|
||||
cron_expression: "cron_expression",
|
||||
timezone: "timezone",
|
||||
enabled: true,
|
||||
parameters: {
|
||||
key: "value",
|
||||
},
|
||||
temporal_schedule_id: "temporal_schedule_id",
|
||||
name: "name",
|
||||
description: "description",
|
||||
created_at: "2024-01-15T09:30:00Z",
|
||||
modified_at: "2024-01-15T09:30:00Z",
|
||||
deleted_at: "2024-01-15T09:30:00Z",
|
||||
},
|
||||
next_runs: ["2024-01-15T09:30:00Z"],
|
||||
});
|
||||
});
|
||||
|
||||
test("enable (2)", async () => {
|
||||
const server = mockServerPool.createServer();
|
||||
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
|
||||
|
||||
const rawResponseBody = { key: "value" };
|
||||
server
|
||||
.mockEndpoint()
|
||||
.post("/v1/workflows/workflow_permanent_id/schedules/workflow_schedule_id/enable")
|
||||
.respondWith()
|
||||
.statusCode(422)
|
||||
.jsonBody(rawResponseBody)
|
||||
.build();
|
||||
|
||||
await expect(async () => {
|
||||
return await client.schedules.enable("workflow_permanent_id", "workflow_schedule_id");
|
||||
}).rejects.toThrow(Skyvern.UnprocessableEntityError);
|
||||
});
|
||||
|
||||
test("disable (1)", async () => {
|
||||
const server = mockServerPool.createServer();
|
||||
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
|
||||
|
||||
const rawResponseBody = {
|
||||
schedule: {
|
||||
workflow_schedule_id: "workflow_schedule_id",
|
||||
organization_id: "organization_id",
|
||||
workflow_permanent_id: "workflow_permanent_id",
|
||||
cron_expression: "cron_expression",
|
||||
timezone: "timezone",
|
||||
enabled: true,
|
||||
parameters: { key: "value" },
|
||||
temporal_schedule_id: "temporal_schedule_id",
|
||||
name: "name",
|
||||
description: "description",
|
||||
created_at: "2024-01-15T09:30:00Z",
|
||||
modified_at: "2024-01-15T09:30:00Z",
|
||||
deleted_at: "2024-01-15T09:30:00Z",
|
||||
},
|
||||
next_runs: ["2024-01-15T09:30:00Z"],
|
||||
};
|
||||
server
|
||||
.mockEndpoint()
|
||||
.post("/v1/workflows/workflow_permanent_id/schedules/workflow_schedule_id/disable")
|
||||
.respondWith()
|
||||
.statusCode(200)
|
||||
.jsonBody(rawResponseBody)
|
||||
.build();
|
||||
|
||||
const response = await client.schedules.disable("workflow_permanent_id", "workflow_schedule_id");
|
||||
expect(response).toEqual({
|
||||
schedule: {
|
||||
workflow_schedule_id: "workflow_schedule_id",
|
||||
organization_id: "organization_id",
|
||||
workflow_permanent_id: "workflow_permanent_id",
|
||||
cron_expression: "cron_expression",
|
||||
timezone: "timezone",
|
||||
enabled: true,
|
||||
parameters: {
|
||||
key: "value",
|
||||
},
|
||||
temporal_schedule_id: "temporal_schedule_id",
|
||||
name: "name",
|
||||
description: "description",
|
||||
created_at: "2024-01-15T09:30:00Z",
|
||||
modified_at: "2024-01-15T09:30:00Z",
|
||||
deleted_at: "2024-01-15T09:30:00Z",
|
||||
},
|
||||
next_runs: ["2024-01-15T09:30:00Z"],
|
||||
});
|
||||
});
|
||||
|
||||
test("disable (2)", async () => {
|
||||
const server = mockServerPool.createServer();
|
||||
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
|
||||
|
||||
const rawResponseBody = { key: "value" };
|
||||
server
|
||||
.mockEndpoint()
|
||||
.post("/v1/workflows/workflow_permanent_id/schedules/workflow_schedule_id/disable")
|
||||
.respondWith()
|
||||
.statusCode(422)
|
||||
.jsonBody(rawResponseBody)
|
||||
.build();
|
||||
|
||||
await expect(async () => {
|
||||
return await client.schedules.disable("workflow_permanent_id", "workflow_schedule_id");
|
||||
}).rejects.toThrow(Skyvern.UnprocessableEntityError);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue