diff options
author | crupest <crupest@outlook.com> | 2021-02-10 02:03:06 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-02-10 02:03:06 +0800 |
commit | 253b06dfaa091d986a8714c081fd1e01679f538a (patch) | |
tree | 9200a7f6607889fcfb13b7ba14cc30db54fe3499 /BackEnd/Timeline/Controllers/TimelinePostController.cs | |
parent | bc2d6676276ea85a974f57f96b038e35e6ce7460 (diff) | |
download | timeline-253b06dfaa091d986a8714c081fd1e01679f538a.tar.gz timeline-253b06dfaa091d986a8714c081fd1e01679f538a.tar.bz2 timeline-253b06dfaa091d986a8714c081fd1e01679f538a.zip |
...
Diffstat (limited to 'BackEnd/Timeline/Controllers/TimelinePostController.cs')
-rw-r--r-- | BackEnd/Timeline/Controllers/TimelinePostController.cs | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/BackEnd/Timeline/Controllers/TimelinePostController.cs b/BackEnd/Timeline/Controllers/TimelinePostController.cs index 44498c58..a0fd1687 100644 --- a/BackEnd/Timeline/Controllers/TimelinePostController.cs +++ b/BackEnd/Timeline/Controllers/TimelinePostController.cs @@ -112,7 +112,7 @@ namespace Timeline.Controllers [ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
- public async Task<IActionResult> DataGet([FromRoute][GeneralTimelineName] string timeline, [FromRoute] long post, [FromHeader(Name = "If-None-Match")] string? ifNoneMatch)
+ public async Task<IActionResult> DataIndexGet([FromRoute][GeneralTimelineName] string timeline, [FromRoute] long post, [FromHeader(Name = "If-None-Match")] string? ifNoneMatch)
{
_ = ifNoneMatch;
@@ -140,6 +140,24 @@ namespace Timeline.Controllers }
/// <summary>
+ /// Get the data of a post. Usually a image post.
+ /// </summary>
+ /// <param name="timeline">Timeline name.</param>
+ /// <param name="post">The id of the post.</param>
+ /// <param name="ifNoneMatch">If-None-Match header.</param>
+ /// <returns>The data.</returns>
+ [HttpGet("{post}/data/{data_index}")]
+ [Produces("image/png", "image/jpeg", "image/gif", "image/webp", "application/json", "text/json")]
+ [ProducesResponseType(typeof(byte[]), StatusCodes.Status200OK)]
+ [ProducesResponseType(typeof(void), StatusCodes.Status304NotModified)]
+ [ProducesResponseType(StatusCodes.Status400BadRequest)]
+ [ProducesResponseType(StatusCodes.Status403Forbidden)]
+ [ProducesResponseType(StatusCodes.Status404NotFound)]
+ public async Task<IActionResult> DataGet([FromRoute][GeneralTimelineName] string timeline, [FromRoute] long post, [FromHeader(Name = "If-None-Match")] string? ifNoneMatch)
+ {
+ }
+
+ /// <summary>
/// Create a new post.
/// </summary>
/// <param name="timeline">Timeline name.</param>
@@ -163,18 +181,18 @@ namespace Timeline.Controllers var requestContent = body.Content;
- TimelinePostCreateRequestContent createContent;
+ TimelinePostCreateRequestData createContent;
switch (requestContent.Type)
{
- case TimelinePostContentTypes.Text:
+ case TimelinePostDataKind.Text:
if (requestContent.Text is null)
{
return BadRequest(ErrorResponse.Common.CustomMessage_InvalidModel(Resources.Messages.TimelineController_TextContentTextRequired));
}
createContent = new TimelinePostCreateRequestTextContent(requestContent.Text);
break;
- case TimelinePostContentTypes.Image:
+ case TimelinePostDataKind.Image:
if (requestContent.Data is null)
return BadRequest(ErrorResponse.Common.CustomMessage_InvalidModel(Resources.Messages.TimelineController_ImageContentDataRequired));
@@ -189,7 +207,7 @@ namespace Timeline.Controllers return BadRequest(ErrorResponse.Common.CustomMessage_InvalidModel(Resources.Messages.TimelineController_ImageContentDataNotBase64));
}
- createContent = new TimelinePostCreateRequestImageContent(data);
+ createContent = new TimelinePostCreateRequestImageData(data);
break;
default:
return BadRequest(ErrorResponse.Common.CustomMessage_InvalidModel(Resources.Messages.TimelineController_ContentUnknownType));
|