ImgurNet.ApiEndpoints.ImageEndpoint.UploadImageFromUrlAsync C# (CSharp) Method

UploadImageFromUrlAsync() public method

public UploadImageFromUrlAsync ( Uri uri, string albumId = null, string name = null, string title = null, string description = null ) : Task>
uri System.Uri
albumId string
name string
title string
description string
return Task>
		public async Task<ImgurResponse<Image>> UploadImageFromUrlAsync(Uri uri,
			string albumId = null, string name = null, string title = null, string description = null)
		{
			return await UploadImageFromUrlAsync(uri.ToString(), albumId, name, title, description);
		}

Same methods

ImageEndpoint::UploadImageFromUrlAsync ( string url, string albumId = null, string name = null, string title = null, string description = null ) : Task>

Usage Example

		public async Task TestUploadImageFromUrl()
		{
			var imgurClient = AuthenticationHelpers.CreateClientAuthenticatedImgurClient();
			const string imageUrl = "http://www.ella-lapetiteanglaise.com/wp-content/uploads/2013/11/keep-calm-because-yolo-24.png";
			var imageEndpoint = new ImageEndpoint(imgurClient);

			try
			{
				var response = await imageEndpoint.UploadImageFromUrlAsync(imageUrl, title: "yolo", description: "Keep Calm, because yolo #420");

				// Assert the Reponse
				Assert.IsNotNull(response.Data);
				Assert.AreEqual(response.Success, true);
				Assert.AreEqual(response.Status, HttpStatusCode.OK);
			}
			catch (ImgurResponseFailedException exception)
			{
				Assert.Fail(exception.ImgurResponse.Data.ErrorDescription);
			}
		}