Skip to content

Commit

Permalink
Merge pull request #2 from clgillis/b2listpatch
Browse files Browse the repository at this point in the history
B2listpatch
  • Loading branch information
clgillis authored Sep 13, 2018
2 parents 2ee0ce2 + 2056054 commit 1ae8d9b
Showing 1 changed file with 7 additions and 6 deletions.
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.LoginInfo.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.LoginInfo.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.LoginInfo.AccountID,
"accountId": b.c.loginInfo.Load().(*LoginInfo).AccountID,
"bucketId": b.ID,
})
if err != nil {
Expand Down

0 comments on commit 1ae8d9b

Please sign in to comment.