Skip to content
Open
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
13 changes: 7 additions & 6 deletions b2.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func (c *Client) doRequest(endpoint string, params map[string]interface{}) (*htt
return nil, err
}
// Reduce debug log noise
delete(params, "accountID")
// delete(params, "accountID")
delete(params, "bucketID")

apiURL := c.loginInfo.Load().(*LoginInfo).ApiURL
Expand Down Expand Up @@ -298,7 +298,7 @@ func (c *Client) BucketByID(id string) *Bucket {
// found and createIfNotExists is true, CreateBucket is called with allPublic set
// to false. Otherwise, an error is returned.
func (c *Client) BucketByName(name string, createIfNotExists bool) (*BucketInfo, error) {
bs, err := c.Buckets()
bs, err := c.Buckets(name)
if err != nil {
return nil, err
}
Expand All @@ -314,9 +314,10 @@ func (c *Client) BucketByName(name string, createIfNotExists bool) (*BucketInfo,
}

// Buckets returns a list of buckets sorted by name.
func (c *Client) Buckets() ([]*BucketInfo, error) {
func (c *Client) Buckets(name string) ([]*BucketInfo, error) {
res, err := c.doRequest("b2_list_buckets", map[string]interface{}{
"accountId": c.accountID,
"accountId": c.loginInfo.Load().(*LoginInfo).AccountID,
"bucketName": name,
})
if err != nil {
return nil, err
Expand Down Expand Up @@ -352,7 +353,7 @@ func (c *Client) CreateBucket(name string, allPublic bool) (*BucketInfo, error)
bucketType = "allPublic"
}
res, err := c.doRequest("b2_create_bucket", map[string]interface{}{
"accountId": c.accountID,
"accountId": c.loginInfo.Load().(*LoginInfo).AccountID,
"bucketName": name,
"bucketType": bucketType,
})
Expand All @@ -379,7 +380,7 @@ func (c *Client) CreateBucket(name string, allPublic bool) (*BucketInfo, error)
// becomes invalid and any other calls will fail.
func (b *Bucket) Delete() error {
res, err := b.c.doRequest("b2_delete_bucket", map[string]interface{}{
"accountId": b.c.accountID,
"accountId": b.c.loginInfo.Load().(*LoginInfo).AccountID,
"bucketId": b.ID,
})
if err != nil {
Expand Down