Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow null on bucket constraints #160

Merged
merged 2 commits into from
Apr 12, 2023
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
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