public UploadImageBinaryAsync ( byte image, string albumId = null, string title = null, string description = null ) : Task |
||
image | byte | A binary file. |
albumId | string | /// The id of the album you want to add the image to. For anonymous albums, {albumId} should be the /// deletehash that is returned at creation. /// |
title | string | The title of the image. |
description | string | The description of the image. |
Результат | Task |
public async Task<IImage> UploadImageBinaryAsync(byte[] image, string albumId = null, string title = null,
string description = null)
{
if (image == null)
throw new ArgumentNullException(nameof(image));
var url = "image";
using (var request = RequestBuilder.UploadImageBinaryRequest(url, image, albumId, title, description))
{
var returnImage = await SendRequestAsync<Image>(request).ConfigureAwait(false);
return returnImage;
}
}
public async Task UploadImageBinaryAsync_WithImage_AreEqual() { var client = new ImgurClient(ClientId, ClientSecret); var endpoint = new ImageEndpoint(client); var file = File.ReadAllBytes("banana.gif"); var image = await endpoint.UploadImageBinaryAsync(file, null, "binary test title!", "binary test desc!"); Assert.IsFalse(string.IsNullOrEmpty(image.Id)); Assert.AreEqual("binary test title!", image.Title); Assert.AreEqual("binary test desc!", image.Description); await GetImageAsync_WithImage_AreEqual(image); await UpdateImageAsync_WithImage_AreEqual(image); await DeleteImageAsync_WithImage_IsTrue(image); }