Rebuild fern client sdk to 1.06 (#4331)
This commit is contained in:
@@ -12,6 +12,7 @@ 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 +57,7 @@ following namespace:
|
||||
```typescript
|
||||
import { Skyvern } from "@skyvern/client";
|
||||
|
||||
const request: Skyvern.SetWorkflowTemplateStatusV1WorkflowsWorkflowPermanentIdTemplatePutRequest = {
|
||||
const request: Skyvern.RunTaskRequest = {
|
||||
...
|
||||
};
|
||||
```
|
||||
@@ -81,6 +82,50 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user