Imgur.API.Endpoints.Impl.ImageEndpoint.DeleteImageAsync C# (CSharp) Метод

DeleteImageAsync() публичный Метод

Deletes an image. For an anonymous image, {id} must be the image's deletehash. If the image belongs to your account then passing the ID of the image is sufficient.
/// 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 DeleteImageAsync ( string imageId ) : Task
imageId string The image id.
Результат Task
        public async Task<bool> DeleteImageAsync(string imageId)
        {
            if (string.IsNullOrWhiteSpace(imageId))
                throw new ArgumentNullException(nameof(imageId));

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

            using (var request = RequestBuilder.CreateRequest(HttpMethod.Delete, url))
            {
                var deleted = await SendRequestAsync<bool>(request).ConfigureAwait(false);
                return deleted;
            }
        }

Usage Example

Пример #1
0
        public async Task DeleteImageAsync_WithImage_IsTrue(IImage actualImage)
        {
            var client = new ImgurClient(ClientId, ClientSecret);
            var endpoint = new ImageEndpoint(client);

            var expected = await endpoint.DeleteImageAsync(actualImage.DeleteHash);

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