Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions src/reference/sdks/frontend/files.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,93 @@ Gets all hosted files.

The files.

##### onDeletedHostedFile()

> **onDeletedHostedFile**: (`callback`: (`fileId`: `string`) => `void`) => `ListenerHandle`

Listen for deleted hosted files.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `callback` | (`fileId`: `string`) => `void` | The callback function that receives the file ID. |

###### Returns

`ListenerHandle`

A handle object with a `stop` method to stop listening.

###### Example

```ts
const handle = sdk.files.onDeletedHostedFile((fileId) => {
console.log(`Hosted file deleted:`, fileId);
});

// Later, stop listening
handle.stop();
```

##### onUpdatedHostedFile()

> **onUpdatedHostedFile**: (`callback`: (`event`: [`HostedFile`](#hostedfile)) => `void`) => `ListenerHandle`

Listen for updated hosted files.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `callback` | (`event`: [`HostedFile`](#hostedfile)) => `void` | The callback function that receives the hosted file. |

###### Returns

`ListenerHandle`

A handle object with a `stop` method to stop listening.

###### Example

```ts
const handle = sdk.files.onUpdatedHostedFile((hostedFile) => {
console.log(`Hosted file updated:`, hostedFile);
});

// Later, stop listening
handle.stop();
```

##### onUploadedHostedFile()

> **onUploadedHostedFile**: (`callback`: (`event`: [`HostedFile`](#hostedfile)) => `void`) => `ListenerHandle`

Listen for uploaded hosted files.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `callback` | (`event`: [`HostedFile`](#hostedfile)) => `void` | The callback function that receives the hosted file. |

###### Returns

`ListenerHandle`

A handle object with a `stop` method to stop listening.

###### Example

```ts
const handle = sdk.files.onUploadedHostedFile((hostedFile) => {
console.log(`Hosted file uploaded:`, hostedFile);
});

// Later, stop listening
handle.stop();
```

##### rename()

> **rename**: (`id`: `string`, `name`: `string`) => `Promise`\<[`HostedFile`](#hostedfile)\>
Expand Down