Imgur.API.Endpoints.Impl.ImageEndpoint.UpdateImageAsync C# (CSharp) Method

UpdateImageAsync() public method

Updates the title or description of an image. You can only update an image you own and is associated with your account. For an anonymous image, {id} must be the image's deletehash.
/// Thrown when a null reference is passed to a method that does not accept it as a /// valid argument. /// Thrown when an error is found in a response from an Imgur endpoint. Thrown when an error is found in a response from a Mashape endpoint.
public UpdateImageAsync ( string imageId, string title = null, string description = null ) : Task
imageId string The image id.
title string The title of the image.
description string The description of the image.
return Task
        public async Task<bool> UpdateImageAsync(string imageId, string title = null, string description = null)
        {
            if (string.IsNullOrWhiteSpace(imageId))
                throw new ArgumentNullException(nameof(imageId));

            var url = $"image/{imageId}";

            using (var request = RequestBuilder.UpdateImageRequest(url, title, description))
            {
                var updated = await SendRequestAsync<bool>(request).ConfigureAwait(false);
                return updated;
            }
        }

Usage Example

コード例 #1
0
        public async Task UpdateImageAsync_WithImage_AreEqual(IImage actualImage)
        {
            var client = new ImgurClient(ClientId, ClientSecret);
            var endpoint = new ImageEndpoint(client);

            var expected = await endpoint.UpdateImageAsync(actualImage.DeleteHash, "Ti", "De");

            Assert.IsTrue(expected);
        }
All Usage Examples Of Imgur.API.Endpoints.Impl.ImageEndpoint::UpdateImageAsync