Skip to content

Commit

Permalink
fix: allow null on bucket constraints (#160)
Browse files Browse the repository at this point in the history
Co-authored-by: Inian <inian1234@gmail.com>
  • Loading branch information
fenos and inian authored Apr 12, 2023
1 parent 88928fd commit 3cf50f2
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/packages/StorageBucketApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,21 @@ export default class StorageBucketApi {
*
* @param id A unique identifier for the bucket you are creating.
* @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.
* @param options.fileSizeLimit specifies the file size limit that this bucket can accept during upload
* @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload
* @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.
* The global file size limit takes precedence over this value.
* The default value is null, which doesn't set a per bucket file size limit.
* @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.
* The default value is null, which allows files with all mime types to be uploaded.
* Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
* @returns newly created bucket id
*/
async createBucket(
id: string,
options: { public: boolean; fileSizeLimit?: number | string; allowedMimeTypes?: string[] } = {
options: {
public: boolean
fileSizeLimit?: number | string | null
allowedMimeTypes?: string[] | null
} = {
public: false,
}
): Promise<
Expand Down Expand Up @@ -121,12 +129,20 @@ export default class StorageBucketApi {
*
* @param id A unique identifier for the bucket you are updating.
* @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.
* @param options.fileSizeLimit specifies the file size limit that this bucket can accept during upload
* @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload
* @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.
* The global file size limit takes precedence over this value.
* The default value is null, which doesn't set a per bucket file size limit.
* @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.
* The default value is null, which allows files with all mime types to be uploaded.
* Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
*/
async updateBucket(
id: string,
options: { public: boolean; fileSizeLimit?: number | string; allowedMimeTypes?: string[] }
options: {
public: boolean
fileSizeLimit?: number | string | null
allowedMimeTypes?: string[] | null
}
): Promise<
| {
data: { message: string }
Expand Down

0 comments on commit 3cf50f2

Please sign in to comment.