@supabase/storage-js 2.81.2-canary.3 → 2.82.0

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.
Files changed (86) hide show
  1. package/README.md +10 -0
  2. package/dist/main/StorageClient.d.ts +15 -1
  3. package/dist/main/StorageClient.d.ts.map +1 -1
  4. package/dist/main/StorageClient.js +15 -1
  5. package/dist/main/StorageClient.js.map +1 -1
  6. package/dist/main/lib/vectors/StorageVectorsClient.d.ts +99 -18
  7. package/dist/main/lib/vectors/StorageVectorsClient.d.ts.map +1 -1
  8. package/dist/main/lib/vectors/StorageVectorsClient.js +95 -17
  9. package/dist/main/lib/vectors/StorageVectorsClient.js.map +1 -1
  10. package/dist/main/lib/vectors/VectorBucketApi.d.ts +35 -7
  11. package/dist/main/lib/vectors/VectorBucketApi.d.ts.map +1 -1
  12. package/dist/main/lib/vectors/VectorBucketApi.js +35 -7
  13. package/dist/main/lib/vectors/VectorBucketApi.js.map +1 -1
  14. package/dist/main/lib/vectors/VectorDataApi.d.ts +44 -8
  15. package/dist/main/lib/vectors/VectorDataApi.d.ts.map +1 -1
  16. package/dist/main/lib/vectors/VectorDataApi.js +44 -8
  17. package/dist/main/lib/vectors/VectorDataApi.js.map +1 -1
  18. package/dist/main/lib/vectors/VectorIndexApi.d.ts +43 -8
  19. package/dist/main/lib/vectors/VectorIndexApi.d.ts.map +1 -1
  20. package/dist/main/lib/vectors/VectorIndexApi.js +39 -7
  21. package/dist/main/lib/vectors/VectorIndexApi.js.map +1 -1
  22. package/dist/main/lib/version.d.ts +1 -1
  23. package/dist/main/lib/version.d.ts.map +1 -1
  24. package/dist/main/lib/version.js +1 -1
  25. package/dist/main/lib/version.js.map +1 -1
  26. package/dist/main/packages/StorageAnalyticsApi.d.ts +77 -26
  27. package/dist/main/packages/StorageAnalyticsApi.d.ts.map +1 -1
  28. package/dist/main/packages/StorageAnalyticsApi.js +77 -26
  29. package/dist/main/packages/StorageAnalyticsApi.js.map +1 -1
  30. package/dist/main/packages/StorageBucketApi.d.ts +143 -1
  31. package/dist/main/packages/StorageBucketApi.d.ts.map +1 -1
  32. package/dist/main/packages/StorageBucketApi.js +143 -1
  33. package/dist/main/packages/StorageBucketApi.js.map +1 -1
  34. package/dist/main/packages/StorageFileApi.d.ts +410 -2
  35. package/dist/main/packages/StorageFileApi.d.ts.map +1 -1
  36. package/dist/main/packages/StorageFileApi.js +410 -2
  37. package/dist/main/packages/StorageFileApi.js.map +1 -1
  38. package/dist/module/StorageClient.d.ts +15 -1
  39. package/dist/module/StorageClient.d.ts.map +1 -1
  40. package/dist/module/StorageClient.js +15 -1
  41. package/dist/module/StorageClient.js.map +1 -1
  42. package/dist/module/lib/vectors/StorageVectorsClient.d.ts +99 -18
  43. package/dist/module/lib/vectors/StorageVectorsClient.d.ts.map +1 -1
  44. package/dist/module/lib/vectors/StorageVectorsClient.js +95 -17
  45. package/dist/module/lib/vectors/StorageVectorsClient.js.map +1 -1
  46. package/dist/module/lib/vectors/VectorBucketApi.d.ts +35 -7
  47. package/dist/module/lib/vectors/VectorBucketApi.d.ts.map +1 -1
  48. package/dist/module/lib/vectors/VectorBucketApi.js +35 -7
  49. package/dist/module/lib/vectors/VectorBucketApi.js.map +1 -1
  50. package/dist/module/lib/vectors/VectorDataApi.d.ts +44 -8
  51. package/dist/module/lib/vectors/VectorDataApi.d.ts.map +1 -1
  52. package/dist/module/lib/vectors/VectorDataApi.js +44 -8
  53. package/dist/module/lib/vectors/VectorDataApi.js.map +1 -1
  54. package/dist/module/lib/vectors/VectorIndexApi.d.ts +43 -8
  55. package/dist/module/lib/vectors/VectorIndexApi.d.ts.map +1 -1
  56. package/dist/module/lib/vectors/VectorIndexApi.js +39 -7
  57. package/dist/module/lib/vectors/VectorIndexApi.js.map +1 -1
  58. package/dist/module/lib/version.d.ts +1 -1
  59. package/dist/module/lib/version.d.ts.map +1 -1
  60. package/dist/module/lib/version.js +1 -1
  61. package/dist/module/lib/version.js.map +1 -1
  62. package/dist/module/packages/StorageAnalyticsApi.d.ts +77 -26
  63. package/dist/module/packages/StorageAnalyticsApi.d.ts.map +1 -1
  64. package/dist/module/packages/StorageAnalyticsApi.js +77 -26
  65. package/dist/module/packages/StorageAnalyticsApi.js.map +1 -1
  66. package/dist/module/packages/StorageBucketApi.d.ts +143 -1
  67. package/dist/module/packages/StorageBucketApi.d.ts.map +1 -1
  68. package/dist/module/packages/StorageBucketApi.js +143 -1
  69. package/dist/module/packages/StorageBucketApi.js.map +1 -1
  70. package/dist/module/packages/StorageFileApi.d.ts +410 -2
  71. package/dist/module/packages/StorageFileApi.d.ts.map +1 -1
  72. package/dist/module/packages/StorageFileApi.js +410 -2
  73. package/dist/module/packages/StorageFileApi.js.map +1 -1
  74. package/dist/tsconfig.module.tsbuildinfo +1 -1
  75. package/dist/tsconfig.tsbuildinfo +1 -1
  76. package/dist/umd/supabase.js +1 -1
  77. package/package.json +1 -1
  78. package/src/StorageClient.ts +15 -1
  79. package/src/lib/vectors/StorageVectorsClient.ts +99 -18
  80. package/src/lib/vectors/VectorBucketApi.ts +35 -7
  81. package/src/lib/vectors/VectorDataApi.ts +44 -8
  82. package/src/lib/vectors/VectorIndexApi.ts +43 -8
  83. package/src/lib/version.ts +1 -1
  84. package/src/packages/StorageAnalyticsApi.ts +77 -26
  85. package/src/packages/StorageBucketApi.ts +143 -1
  86. package/src/packages/StorageFileApi.ts +410 -2
@@ -13,9 +13,12 @@ import {
13
13
  } from './types'
14
14
 
15
15
  /**
16
+ *
17
+ * @alpha
18
+ *
16
19
  * Options for creating a vector index
17
20
  *
18
- * **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
21
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
19
22
  */
20
23
  export interface CreateIndexOptions {
21
24
  vectorBucketName: string
@@ -27,10 +30,13 @@ export interface CreateIndexOptions {
27
30
  }
28
31
 
29
32
  /**
33
+ *
34
+ * @alpha
35
+ *
30
36
  * API class for managing Vector Indexes within Vector Buckets
31
37
  * Provides methods for creating, reading, listing, and deleting vector indexes
32
38
  *
33
- * **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
39
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
34
40
  */
35
41
  export default class VectorIndexApi {
36
42
  protected url: string
@@ -39,13 +45,22 @@ export default class VectorIndexApi {
39
45
  protected shouldThrowOnError = false
40
46
 
41
47
  /**
48
+ *
49
+ * @alpha
50
+ *
42
51
  * Creates an API client for managing vector indexes.
43
52
  *
44
- * **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
53
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
45
54
  *
55
+ * @category Vector Buckets
46
56
  * @param url - Base URL for the Storage Vectors API.
47
57
  * @param headers - Default headers sent with each request.
48
58
  * @param fetch - Optional custom `fetch` implementation for non-browser runtimes.
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * const client = new VectorIndexApi(url, headers)
63
+ * ```
49
64
  */
50
65
  constructor(url: string, headers: { [key: string]: string } = {}, fetch?: Fetch) {
51
66
  this.url = url.replace(/\/$/, '')
@@ -54,11 +69,15 @@ export default class VectorIndexApi {
54
69
  }
55
70
 
56
71
  /**
72
+ *
73
+ * @alpha
74
+ *
57
75
  * Enable throwing errors instead of returning them in the response
58
76
  * When enabled, failed operations will throw instead of returning { data: null, error }
59
77
  *
60
- * **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
78
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
61
79
  *
80
+ * @category Vector Buckets
62
81
  * @returns This instance for method chaining
63
82
  * @example
64
83
  * ```typescript
@@ -73,11 +92,15 @@ export default class VectorIndexApi {
73
92
  }
74
93
 
75
94
  /**
95
+ *
96
+ * @alpha
97
+ *
76
98
  * Creates a new vector index within a bucket
77
99
  * Defines the schema for vectors including dimensionality, distance metric, and metadata config
78
100
  *
79
- * **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
101
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
80
102
  *
103
+ * @category Vector Buckets
81
104
  * @param options - Index configuration
82
105
  * @param options.vectorBucketName - Name of the parent vector bucket
83
106
  * @param options.indexName - Unique name for the index within the bucket
@@ -125,11 +148,15 @@ export default class VectorIndexApi {
125
148
  }
126
149
 
127
150
  /**
151
+ *
152
+ * @alpha
153
+ *
128
154
  * Retrieves metadata for a specific vector index
129
155
  * Returns index configuration including dimension, distance metric, and metadata settings
130
156
  *
131
- * **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
157
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
132
158
  *
159
+ * @category Vector Buckets
133
160
  * @param vectorBucketName - Name of the parent vector bucket
134
161
  * @param indexName - Name of the index to retrieve
135
162
  * @returns Promise with index metadata or error
@@ -171,11 +198,15 @@ export default class VectorIndexApi {
171
198
  }
172
199
 
173
200
  /**
201
+ *
202
+ * @alpha
203
+ *
174
204
  * Lists vector indexes within a bucket with optional filtering and pagination
175
205
  * Supports prefix-based filtering and paginated results
176
206
  *
177
- * **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
207
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
178
208
  *
209
+ * @category Vector Buckets
179
210
  * @param options - Listing options
180
211
  * @param options.vectorBucketName - Name of the parent vector bucket
181
212
  * @param options.prefix - Filter indexes by name prefix
@@ -224,11 +255,15 @@ export default class VectorIndexApi {
224
255
  }
225
256
 
226
257
  /**
258
+ *
259
+ * @alpha
260
+ *
227
261
  * Deletes a vector index and all its data
228
262
  * This operation removes the index schema and all vectors stored in the index
229
263
  *
230
- * **Private alpha:** Vector storage APIs are currently in private alpha and may not be accessible.
264
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
231
265
  *
266
+ * @category Vector Buckets
232
267
  * @param vectorBucketName - Name of the parent vector bucket
233
268
  * @param indexName - Name of the index to delete
234
269
  * @returns Promise with empty response on success or error
@@ -4,4 +4,4 @@
4
4
  // - Debugging and support (identifying which version is running)
5
5
  // - Telemetry and logging (version reporting in errors/analytics)
6
6
  // - Ensuring build artifacts match the published package version
7
- export const version = '2.81.2-canary.3'
7
+ export const version = '2.82.0'
@@ -16,9 +16,18 @@ export default class StorageAnalyticsApi {
16
16
 
17
17
  /**
18
18
  * Creates a new StorageAnalyticsApi instance
19
+ *
20
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
21
+ *
22
+ * @category Analytics Buckets
19
23
  * @param url - The base URL for the storage API
20
24
  * @param headers - HTTP headers to include in requests
21
25
  * @param fetch - Optional custom fetch implementation
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * const client = new StorageAnalyticsApi(url, headers)
30
+ * ```
22
31
  */
23
32
  constructor(url: string, headers: { [key: string]: string } = {}, fetch?: Fetch) {
24
33
  this.url = url.replace(/\/$/, '')
@@ -30,6 +39,9 @@ export default class StorageAnalyticsApi {
30
39
  * Enable throwing errors instead of returning them in the response
31
40
  * When enabled, failed operations will throw instead of returning { data: null, error }
32
41
  *
42
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
43
+ *
44
+ * @category Analytics Buckets
33
45
  * @returns This instance for method chaining
34
46
  */
35
47
  public throwOnError(): this {
@@ -41,16 +53,27 @@ export default class StorageAnalyticsApi {
41
53
  * Creates a new analytics bucket using Iceberg tables
42
54
  * Analytics buckets are optimized for analytical queries and data processing
43
55
  *
56
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
57
+ *
58
+ * @category Analytics Buckets
44
59
  * @param name A unique name for the bucket you are creating
45
60
  * @returns Promise with newly created bucket name or error
46
61
  *
47
- * @example
48
- * ```typescript
49
- * const { data, error } = await storage.analytics.createBucket('analytics-data')
50
- * if (error) {
51
- * console.error('Failed to create analytics bucket:', error.message)
52
- * } else {
53
- * console.log('Created bucket:', data.name)
62
+ * @example Create analytics bucket
63
+ * ```js
64
+ * const { data, error } = await supabase
65
+ * .storage
66
+ * .analytics
67
+ * .createBucket('analytics-data')
68
+ * ```
69
+ *
70
+ * Response:
71
+ * ```json
72
+ * {
73
+ * "data": {
74
+ * "name": "analytics-data"
75
+ * },
76
+ * "error": null
54
77
  * }
55
78
  * ```
56
79
  */
@@ -83,6 +106,9 @@ export default class StorageAnalyticsApi {
83
106
  * Retrieves the details of all Analytics Storage buckets within an existing project
84
107
  * Only returns buckets of type 'ANALYTICS'
85
108
  *
109
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
110
+ *
111
+ * @category Analytics Buckets
86
112
  * @param options Query parameters for listing buckets
87
113
  * @param options.limit Maximum number of buckets to return
88
114
  * @param options.offset Number of buckets to skip
@@ -91,18 +117,32 @@ export default class StorageAnalyticsApi {
91
117
  * @param options.search Search term to filter bucket names
92
118
  * @returns Promise with list of analytics buckets or error
93
119
  *
94
- * @example
95
- * ```typescript
96
- * const { data, error } = await storage.analytics.listBuckets({
97
- * limit: 10,
98
- * offset: 0,
99
- * sortColumn: 'created_at',
100
- * sortOrder: 'desc',
101
- * search: 'analytics'
102
- * })
103
- * if (data) {
104
- * console.log('Found analytics buckets:', data.length)
105
- * data.forEach(bucket => console.log(`- ${bucket.name}`))
120
+ * @example List analytics buckets
121
+ * ```js
122
+ * const { data, error } = await supabase
123
+ * .storage
124
+ * .analytics
125
+ * .listBuckets({
126
+ * limit: 10,
127
+ * offset: 0,
128
+ * sortColumn: 'created_at',
129
+ * sortOrder: 'desc'
130
+ * })
131
+ * ```
132
+ *
133
+ * Response:
134
+ * ```json
135
+ * {
136
+ * "data": [
137
+ * {
138
+ * "id": "analytics-data",
139
+ * "name": "analytics-data",
140
+ * "type": "ANALYTICS",
141
+ * "created_at": "2024-05-22T22:26:05.100Z",
142
+ * "updated_at": "2024-05-22T22:26:05.100Z"
143
+ * }
144
+ * ],
145
+ * "error": null
106
146
  * }
107
147
  * ```
108
148
  */
@@ -154,16 +194,27 @@ export default class StorageAnalyticsApi {
154
194
  * A bucket can't be deleted with existing objects inside it
155
195
  * You must first empty the bucket before deletion
156
196
  *
197
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
198
+ *
199
+ * @category Analytics Buckets
157
200
  * @param bucketName The unique identifier of the bucket you would like to delete
158
201
  * @returns Promise with success message or error
159
202
  *
160
- * @example
161
- * ```typescript
162
- * const { data, error } = await analyticsApi.deleteBucket('old-analytics-bucket')
163
- * if (error) {
164
- * console.error('Failed to delete bucket:', error.message)
165
- * } else {
166
- * console.log('Bucket deleted successfully:', data.message)
203
+ * @example Delete analytics bucket
204
+ * ```js
205
+ * const { data, error } = await supabase
206
+ * .storage
207
+ * .analytics
208
+ * .deleteBucket('analytics-data')
209
+ * ```
210
+ *
211
+ * Response:
212
+ * ```json
213
+ * {
214
+ * "data": {
215
+ * "message": "Successfully deleted"
216
+ * },
217
+ * "error": null
167
218
  * }
168
219
  * ```
169
220
  */
@@ -35,6 +35,8 @@ export default class StorageBucketApi {
35
35
 
36
36
  /**
37
37
  * Enable throwing errors instead of returning them.
38
+ *
39
+ * @category File Buckets
38
40
  */
39
41
  public throwOnError(): this {
40
42
  this.shouldThrowOnError = true
@@ -43,6 +45,35 @@ export default class StorageBucketApi {
43
45
 
44
46
  /**
45
47
  * Retrieves the details of all Storage buckets within an existing project.
48
+ *
49
+ * @category File Buckets
50
+ * @param options Query parameters for listing buckets
51
+ * @param options.limit Maximum number of buckets to return
52
+ * @param options.offset Number of buckets to skip
53
+ * @param options.sortColumn Column to sort by ('id', 'name', 'created_at', 'updated_at')
54
+ * @param options.sortOrder Sort order ('asc' or 'desc')
55
+ * @param options.search Search term to filter bucket names
56
+ * @returns Promise with list of buckets or error
57
+ *
58
+ * @example List buckets
59
+ * ```js
60
+ * const { data, error } = await supabase
61
+ * .storage
62
+ * .listBuckets()
63
+ * ```
64
+ *
65
+ * @example List buckets with options
66
+ * ```js
67
+ * const { data, error } = await supabase
68
+ * .storage
69
+ * .listBuckets({
70
+ * limit: 10,
71
+ * offset: 0,
72
+ * sortColumn: 'created_at',
73
+ * sortOrder: 'desc',
74
+ * search: 'prod'
75
+ * })
76
+ * ```
46
77
  */
47
78
  async listBuckets(options?: ListBucketOptions): Promise<
48
79
  | {
@@ -75,7 +106,35 @@ export default class StorageBucketApi {
75
106
  /**
76
107
  * Retrieves the details of an existing Storage bucket.
77
108
  *
109
+ * @category File Buckets
78
110
  * @param id The unique identifier of the bucket you would like to retrieve.
111
+ * @returns Promise with bucket details or error
112
+ *
113
+ * @example Get bucket
114
+ * ```js
115
+ * const { data, error } = await supabase
116
+ * .storage
117
+ * .getBucket('avatars')
118
+ * ```
119
+ *
120
+ * Response:
121
+ * ```json
122
+ * {
123
+ * "data": {
124
+ * "id": "avatars",
125
+ * "name": "avatars",
126
+ * "owner": "",
127
+ * "public": false,
128
+ * "file_size_limit": 1024,
129
+ * "allowed_mime_types": [
130
+ * "image/png"
131
+ * ],
132
+ * "created_at": "2024-05-22T22:26:05.100Z",
133
+ * "updated_at": "2024-05-22T22:26:05.100Z"
134
+ * },
135
+ * "error": null
136
+ * }
137
+ * ```
79
138
  */
80
139
  async getBucket(id: string): Promise<
81
140
  | {
@@ -105,6 +164,7 @@ export default class StorageBucketApi {
105
164
  /**
106
165
  * Creates a new Storage bucket
107
166
  *
167
+ * @category File Buckets
108
168
  * @param id A unique identifier for the bucket you are creating.
109
169
  * @param options.public The visibility of the bucket. Public buckets don't require an authorization token to download objects, but still require a valid token for all other operations. By default, buckets are private.
110
170
  * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.
@@ -113,9 +173,30 @@ export default class StorageBucketApi {
113
173
  * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.
114
174
  * The default value is null, which allows files with all mime types to be uploaded.
115
175
  * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
116
- * @returns newly created bucket id
117
176
  * @param options.type (private-beta) specifies the bucket type. see `BucketType` for more details.
118
177
  * - default bucket type is `STANDARD`
178
+ * @returns Promise with newly created bucket id or error
179
+ *
180
+ * @example Create bucket
181
+ * ```js
182
+ * const { data, error } = await supabase
183
+ * .storage
184
+ * .createBucket('avatars', {
185
+ * public: false,
186
+ * allowedMimeTypes: ['image/png'],
187
+ * fileSizeLimit: 1024
188
+ * })
189
+ * ```
190
+ *
191
+ * Response:
192
+ * ```json
193
+ * {
194
+ * "data": {
195
+ * "name": "avatars"
196
+ * },
197
+ * "error": null
198
+ * }
199
+ * ```
119
200
  */
120
201
  async createBucket(
121
202
  id: string,
@@ -167,6 +248,7 @@ export default class StorageBucketApi {
167
248
  /**
168
249
  * Updates a Storage bucket
169
250
  *
251
+ * @category File Buckets
170
252
  * @param id A unique identifier for the bucket you are updating.
171
253
  * @param options.public The visibility of the bucket. Public buckets don't require an authorization token to download objects, but still require a valid token for all other operations.
172
254
  * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.
@@ -175,6 +257,28 @@ export default class StorageBucketApi {
175
257
  * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.
176
258
  * The default value is null, which allows files with all mime types to be uploaded.
177
259
  * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
260
+ * @returns Promise with success message or error
261
+ *
262
+ * @example Update bucket
263
+ * ```js
264
+ * const { data, error } = await supabase
265
+ * .storage
266
+ * .updateBucket('avatars', {
267
+ * public: false,
268
+ * allowedMimeTypes: ['image/png'],
269
+ * fileSizeLimit: 1024
270
+ * })
271
+ * ```
272
+ *
273
+ * Response:
274
+ * ```json
275
+ * {
276
+ * "data": {
277
+ * "message": "Successfully updated"
278
+ * },
279
+ * "error": null
280
+ * }
281
+ * ```
178
282
  */
179
283
  async updateBucket(
180
284
  id: string,
@@ -222,7 +326,26 @@ export default class StorageBucketApi {
222
326
  /**
223
327
  * Removes all objects inside a single bucket.
224
328
  *
329
+ * @category File Buckets
225
330
  * @param id The unique identifier of the bucket you would like to empty.
331
+ * @returns Promise with success message or error
332
+ *
333
+ * @example Empty bucket
334
+ * ```js
335
+ * const { data, error } = await supabase
336
+ * .storage
337
+ * .emptyBucket('avatars')
338
+ * ```
339
+ *
340
+ * Response:
341
+ * ```json
342
+ * {
343
+ * "data": {
344
+ * "message": "Successfully emptied"
345
+ * },
346
+ * "error": null
347
+ * }
348
+ * ```
226
349
  */
227
350
  async emptyBucket(id: string): Promise<
228
351
  | {
@@ -258,7 +381,26 @@ export default class StorageBucketApi {
258
381
  * Deletes an existing bucket. A bucket can't be deleted with existing objects inside it.
259
382
  * You must first `empty()` the bucket.
260
383
  *
384
+ * @category File Buckets
261
385
  * @param id The unique identifier of the bucket you would like to delete.
386
+ * @returns Promise with success message or error
387
+ *
388
+ * @example Delete bucket
389
+ * ```js
390
+ * const { data, error } = await supabase
391
+ * .storage
392
+ * .deleteBucket('avatars')
393
+ * ```
394
+ *
395
+ * Response:
396
+ * ```json
397
+ * {
398
+ * "data": {
399
+ * "message": "Successfully deleted"
400
+ * },
401
+ * "error": null
402
+ * }
403
+ * ```
262
404
  */
263
405
  async deleteBucket(id: string): Promise<
264
406
  | {