Skip to content

Commit edf3499

Browse files
authored
Update SDK Documentation (#95)
1 parent 15326ea commit edf3499

1 file changed

Lines changed: 87 additions & 0 deletions

File tree

src/reference/sdks/frontend/files.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,93 @@ Gets all hosted files.
146146

147147
The files.
148148

149+
##### onDeletedHostedFile()
150+
151+
> **onDeletedHostedFile**: (`callback`: (`fileId`: `string`) => `void`) => `ListenerHandle`
152+
153+
Listen for deleted hosted files.
154+
155+
###### Parameters
156+
157+
| Parameter | Type | Description |
158+
| ------ | ------ | ------ |
159+
| `callback` | (`fileId`: `string`) => `void` | The callback function that receives the file ID. |
160+
161+
###### Returns
162+
163+
`ListenerHandle`
164+
165+
A handle object with a `stop` method to stop listening.
166+
167+
###### Example
168+
169+
```ts
170+
const handle = sdk.files.onDeletedHostedFile((fileId) => {
171+
console.log(`Hosted file deleted:`, fileId);
172+
});
173+
174+
// Later, stop listening
175+
handle.stop();
176+
```
177+
178+
##### onUpdatedHostedFile()
179+
180+
> **onUpdatedHostedFile**: (`callback`: (`event`: [`HostedFile`](#hostedfile)) => `void`) => `ListenerHandle`
181+
182+
Listen for updated hosted files.
183+
184+
###### Parameters
185+
186+
| Parameter | Type | Description |
187+
| ------ | ------ | ------ |
188+
| `callback` | (`event`: [`HostedFile`](#hostedfile)) => `void` | The callback function that receives the hosted file. |
189+
190+
###### Returns
191+
192+
`ListenerHandle`
193+
194+
A handle object with a `stop` method to stop listening.
195+
196+
###### Example
197+
198+
```ts
199+
const handle = sdk.files.onUpdatedHostedFile((hostedFile) => {
200+
console.log(`Hosted file updated:`, hostedFile);
201+
});
202+
203+
// Later, stop listening
204+
handle.stop();
205+
```
206+
207+
##### onUploadedHostedFile()
208+
209+
> **onUploadedHostedFile**: (`callback`: (`event`: [`HostedFile`](#hostedfile)) => `void`) => `ListenerHandle`
210+
211+
Listen for uploaded hosted files.
212+
213+
###### Parameters
214+
215+
| Parameter | Type | Description |
216+
| ------ | ------ | ------ |
217+
| `callback` | (`event`: [`HostedFile`](#hostedfile)) => `void` | The callback function that receives the hosted file. |
218+
219+
###### Returns
220+
221+
`ListenerHandle`
222+
223+
A handle object with a `stop` method to stop listening.
224+
225+
###### Example
226+
227+
```ts
228+
const handle = sdk.files.onUploadedHostedFile((hostedFile) => {
229+
console.log(`Hosted file uploaded:`, hostedFile);
230+
});
231+
232+
// Later, stop listening
233+
handle.stop();
234+
```
235+
149236
##### rename()
150237

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

0 commit comments

Comments
 (0)