public function b2CreateBucket($URL, $token, $name, $public = false, $lifecycleRules = null)
    {
        if (count_chars($name) < 5 && count_chars($name) > 50) {
            throw new B2Exception('Invalid bucket name');
        }
        $curl = $this->prepareCurl();
        $browser = new Browser($curl);
        $payload = array(
            'accountId' => $this->accountId,
            'bucketName' => $name,
            'bucketType' => $public ? 'allPublic' : 'allPrivate',
        );
        if($lifecycleRules != null){
            $payload['lifecycleRules'] = $lifecycleRules;
        }
        $response = $browser->post($URL.'/b2api/v1/b2_create_bucket', $this->getHeaders($token), json_encode($payload));

        return new B2Response($response);
    }