Esempio n. 1
0
        /// <summary>
        /// Update an existing bucket. bucketId is only optional if you are persisting a bucket for this client.
        /// </summary>
        /// <param name="bucketType"></param>
        /// <param name="bucketId"></param>
        /// <param name="cancelToken"></param>
        /// <returns></returns>
        public async Task <B2Bucket> Update(BucketTypes bucketType, string bucketId = "", CancellationToken cancelToken = default(CancellationToken))
        {
            var operationalBucketId = Utilities.DetermineBucketId(_options, bucketId);
            var requestMessage      = BucketRequestGenerators.UpdateBucket(_options, operationalBucketId, bucketType.ToString());
            var response            = await _client.SendAsync(requestMessage, cancelToken);

            return(await ResponseParser.ParseResponse <B2Bucket>(response));
        }
Esempio n. 2
0
        /// <summary>
        /// Update an existing bucket. bucketId is only optional if you are persisting a bucket for this client.
        /// Use this method to set Cache-Control, Lifecycle Rules, or CORS rules.
        /// </summary>
        /// <param name="bucketType"></param>
        /// <param name="bucketId"></param>
        /// <param name="cancelToken"></param>
        /// <returns></returns>
        public async Task <B2Bucket> Update(B2BucketOptions options, int revisionNumber, string bucketId = "", CancellationToken cancelToken = default(CancellationToken))
        {
            var operationalBucketId = Utilities.DetermineBucketId(_options, bucketId);

            var requestMessage = BucketRequestGenerators.UpdateBucket(_options, operationalBucketId, options, revisionNumber);
            var response       = await _client.SendAsync(requestMessage, cancelToken);

            return(await ResponseParser.ParseResponse <B2Bucket>(response, _api));
        }
Esempio n. 3
0
        /// <summary>
        /// Update an existing bucket. bucketId is only optional if you are persisting a bucket for this client.
        /// Use this method to set Cache-Control.
        /// </summary>
        /// <param name="bucketType"></param>
        /// <param name="bucketId"></param>
        /// <param name="cancelToken"></param>
        /// <returns></returns>
        public async Task <B2Bucket> Update(B2BucketOptions options, string bucketId = "", CancellationToken cancelToken = default(CancellationToken))
        {
            var operationalBucketId = Utilities.DetermineBucketId(_options, bucketId);

            var client = HttpClientFactory.CreateHttpClient();

            var requestMessage = BucketRequestGenerators.UpdateBucket(_options, operationalBucketId, options);
            var response       = await client.SendAsync(requestMessage, cancelToken);

            return(await ResponseParser.ParseResponse <B2Bucket>(response));
        }