|
|
|
@ -18,6 +18,10 @@ public class ImageManipulationController : BaseController<ImageManipulationContr |
|
|
|
|
/// ---------- /// |
|
|
|
|
[HttpGet("magik")] |
|
|
|
|
[EndpointMetrics("image.manipulation.magik")] |
|
|
|
|
[ProducesResponseType(typeof(Stream), StatusCodes.Status200OK, "image/png")] |
|
|
|
|
[ProducesResponseType(typeof(Stream), StatusCodes.Status200OK, "image/gif")] |
|
|
|
|
[ProducesResponseType(typeof(EventResult), StatusCodes.Status400BadRequest)] |
|
|
|
|
[ProducesResponseType(typeof(EventResult), StatusCodes.Status500InternalServerError)] |
|
|
|
|
public async Task<object> MagikImage([FromQuery] string image) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
@ -29,7 +33,7 @@ public class ImageManipulationController : BaseController<ImageManipulationContr |
|
|
|
|
return HttpContext.SendStream(data, contentType); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return HttpContext.Send(EventResult.FromFailure("No image has been provided"), System.Net.HttpStatusCode.InternalServerError); |
|
|
|
|
return HttpContext.Send(EventResult.FromFailure("No image has been provided"), System.Net.HttpStatusCode.BadRequest); |
|
|
|
|
} |
|
|
|
|
catch (ArgumentException ex) |
|
|
|
|
{ |
|
|
|
@ -46,6 +50,10 @@ public class ImageManipulationController : BaseController<ImageManipulationContr |
|
|
|
|
/// ------------- /// |
|
|
|
|
[HttpGet("{template}")] |
|
|
|
|
[EndpointMetrics("image.manipulation.generate")] |
|
|
|
|
[ProducesResponseType(typeof(Stream), StatusCodes.Status200OK, "image/png")] |
|
|
|
|
[ProducesResponseType(typeof(EventResult), StatusCodes.Status400BadRequest)] |
|
|
|
|
[ProducesResponseType(typeof(EventResult), StatusCodes.Status404NotFound)] |
|
|
|
|
[ProducesResponseType(typeof(EventResult), StatusCodes.Status500InternalServerError)] |
|
|
|
|
public async Task<object> GenerateMemeAsync(string template, [FromQuery] string[] text) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
@ -64,7 +72,7 @@ public class ImageManipulationController : BaseController<ImageManipulationContr |
|
|
|
|
return result as IResult; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return HttpContext.Send(EventResult.FromFailure("No template has been provided"), System.Net.HttpStatusCode.InternalServerError); |
|
|
|
|
return HttpContext.Send(EventResult.FromFailure("No template has been provided"), System.Net.HttpStatusCode.BadRequest); |
|
|
|
|
} |
|
|
|
|
catch (ArgumentException ex) |
|
|
|
|
{ |
|
|
|
|