Skip to content

Commit f7b40b3

Browse files
authored
feat: bucket type (#233)
1 parent ff813b3 commit f7b40b3

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/lib/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
export type BucketType = 'STANDARD' | 'ICEBERG'
2+
13
export interface Bucket {
24
id: string
5+
type?: BucketType
36
name: string
47
owner: string
58
file_size_limit?: number
69
allowed_mime_types?: string[]
7-
iceberg_catalog?: boolean
810
created_at: string
911
updated_at: string
1012
public: boolean

src/packages/StorageBucketApi.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { DEFAULT_HEADERS } from '../lib/constants'
22
import { isStorageError, StorageError } from '../lib/errors'
33
import { Fetch, get, post, put, remove } from '../lib/fetch'
44
import { resolveFetch } from '../lib/helpers'
5-
import { Bucket } from '../lib/types'
5+
import { Bucket, BucketType } from '../lib/types'
66

77
export default class StorageBucketApi {
88
protected url: string
@@ -96,15 +96,16 @@ export default class StorageBucketApi {
9696
* The default value is null, which allows files with all mime types to be uploaded.
9797
* Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
9898
* @returns newly created bucket id
99-
* @param options.icebergCatalog (private-beta) specifies whether this bucket can be used as an Iceberg data lake.
99+
* @param options.type (private-beta) specifies the bucket type. see `BucketType` for more details.
100+
* - default bucket type is `STANDARD`
100101
*/
101102
async createBucket(
102103
id: string,
103104
options: {
104105
public: boolean
105106
fileSizeLimit?: number | string | null
106107
allowedMimeTypes?: string[] | null
107-
icebergCatalog?: boolean | null
108+
type?: BucketType
108109
} = {
109110
public: false,
110111
}
@@ -125,10 +126,10 @@ export default class StorageBucketApi {
125126
{
126127
id,
127128
name: id,
129+
type: options.type,
128130
public: options.public,
129131
file_size_limit: options.fileSizeLimit,
130132
allowed_mime_types: options.allowedMimeTypes,
131-
iceberg_catalog: options.icebergCatalog,
132133
},
133134
{ headers: this.headers }
134135
)
@@ -153,15 +154,13 @@ export default class StorageBucketApi {
153154
* @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.
154155
* The default value is null, which allows files with all mime types to be uploaded.
155156
* Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
156-
* @param options.icebergCatalog (private-beta) specifies whether this bucket can be used as an Iceberg data lake.
157157
*/
158158
async updateBucket(
159159
id: string,
160160
options: {
161161
public: boolean
162162
fileSizeLimit?: number | string | null
163163
allowedMimeTypes?: string[] | null
164-
icebergCatalog?: boolean | null
165164
}
166165
): Promise<
167166
| {
@@ -183,7 +182,6 @@ export default class StorageBucketApi {
183182
public: options.public,
184183
file_size_limit: options.fileSizeLimit,
185184
allowed_mime_types: options.allowedMimeTypes,
186-
iceberg_catalog: options.icebergCatalog,
187185
},
188186
{ headers: this.headers }
189187
)

0 commit comments

Comments
 (0)