@@ -468,3 +468,86 @@ if (currentPage.data) {
468468
469469console .log (allFiles );
470470```
471+
472+ ## Listing buckets
473+
474+ ` listBuckets ` function can be used to list all buckets in the account.
475+
476+ ### ` listBuckets `
477+
478+ ``` ts
479+ listBuckets (): Promise < TigrisStorageResponse < ListBucketsResponse , Error >> ;
480+ ```
481+
482+ ` listBuckets ` accepts the following parameters
483+
484+ - ` options ` : (Optional) A JSON object with the following optional parameters:
485+
486+ #### ` options `
487+
488+ | ** Parameter** | ** Required** | ** Values** |
489+ | ----------------------------------------- | ------------ | --------------------------------------------------------------------------- |
490+ | limit | No | The maximum number of buckets to return. |
491+ | paginationToken | No | The pagination token to continue listing buckets from the previous request. |
492+ | config | No | A configuration object to override the |
493+ | [ default configuration] ( #authentication ) . |
494+
495+ In case of successful ` list ` , the ` data ` property will be set to the list of
496+ buckets and contains the following properties:
497+
498+ - ` buckets ` : The list of buckets
499+ - ` owner ` : The owner of the buckets
500+ - ` paginationToken ` : The pagination token to continue listing objects for next
501+ page.
502+
503+ ### Examples
504+
505+ #### List buckets
506+
507+ ``` ts
508+ const result = await listBuckets ();
509+
510+ if (result .error ) {
511+ console .error (" Error listing buckets:" , result .error );
512+ } else {
513+ console .log (" Buckets:" , result .data );
514+ }
515+ ```
516+
517+ ## Deleting a bucket
518+
519+ ` removeBucket ` function can be used to delete a bucket.
520+
521+ ### ` removeBucket `
522+
523+ ``` ts
524+ removeBucket (bucketName : string , options ?: RemoveBucketOptions ): Promise < TigrisStorageResponse < void , Error >> ;
525+ ```
526+
527+ ` removeBucket ` accepts the following parameters:
528+
529+ - ` bucketName ` : (Required) A string specifying the name of the bucket
530+ - ` options ` : (Optional) A JSON object with the following optional parameters:
531+
532+ #### ` options `
533+
534+ | ** Parameter** | ** Required** | ** Values** |
535+ | ------------- | ------------ | -------------------------------------------------------------------------------- |
536+ | config | No | A configuration object to override the [ default configuration] ( #authentication ) . |
537+
538+ In case of successful ` removeBucket ` , the ` data ` property will be set to
539+ ` undefined ` and the bucket will be deleted.
540+
541+ ### Examples
542+
543+ #### Delete a bucket
544+
545+ ``` ts
546+ const result = await removeBucket (" my-bucket" );
547+
548+ if (result .error ) {
549+ console .error (" Error deleting bucket:" , result .error );
550+ } else {
551+ console .log (" Bucket deleted successfully" );
552+ }
553+ ```
0 commit comments