|
|
@ -18,6 +18,10 @@ public class ImageManipulationController : BaseController<ImageManipulationContr |
|
|
|
/// ---------- /// |
|
|
|
/// ---------- /// |
|
|
|
[HttpGet("magik")] |
|
|
|
[HttpGet("magik")] |
|
|
|
[EndpointMetrics("image.manipulation.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) |
|
|
|
public async Task<object> MagikImage([FromQuery] string image) |
|
|
|
{ |
|
|
|
{ |
|
|
|
try |
|
|
|
try |
|
|
@ -29,7 +33,7 @@ public class ImageManipulationController : BaseController<ImageManipulationContr |
|
|
|
return HttpContext.SendStream(data, contentType); |
|
|
|
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) |
|
|
|
catch (ArgumentException ex) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -46,6 +50,10 @@ public class ImageManipulationController : BaseController<ImageManipulationContr |
|
|
|
/// ------------- /// |
|
|
|
/// ------------- /// |
|
|
|
[HttpGet("{template}")] |
|
|
|
[HttpGet("{template}")] |
|
|
|
[EndpointMetrics("image.manipulation.generate")] |
|
|
|
[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) |
|
|
|
public async Task<object> GenerateMemeAsync(string template, [FromQuery] string[] text) |
|
|
|
{ |
|
|
|
{ |
|
|
|
try |
|
|
|
try |
|
|
@ -64,7 +72,7 @@ public class ImageManipulationController : BaseController<ImageManipulationContr |
|
|
|
return result as IResult; |
|
|
|
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) |
|
|
|
catch (ArgumentException ex) |
|
|
|
{ |
|
|
|
{ |
|
|
|