aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Entities/Http/Common.cs
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-07-27 21:47:14 +0800
committerGitHub <noreply@github.com>2019-07-27 21:47:14 +0800
commit590a8c576f17817539505ef2ca50f52e840a61d2 (patch)
tree572a2ae5c65c484718b3bfda68fd8babc56fe6f2 /Timeline/Entities/Http/Common.cs
parent3de4179449a209646e0e5a967d270f7fa0878c03 (diff)
parent58985e8f2a6931029974067b2c1e78963e4508f0 (diff)
downloadtimeline-590a8c576f17817539505ef2ca50f52e840a61d2.tar.gz
timeline-590a8c576f17817539505ef2ca50f52e840a61d2.tar.bz2
timeline-590a8c576f17817539505ef2ca50f52e840a61d2.zip
Merge pull request #25 from crupest/auth
Refactor a lot, especially authentication.
Diffstat (limited to 'Timeline/Entities/Http/Common.cs')
-rw-r--r--Timeline/Entities/Http/Common.cs38
1 files changed, 23 insertions, 15 deletions
diff --git a/Timeline/Entities/Http/Common.cs b/Timeline/Entities/Http/Common.cs
index 9575e6fa..3a45a0ae 100644
--- a/Timeline/Entities/Http/Common.cs
+++ b/Timeline/Entities/Http/Common.cs
@@ -1,29 +1,37 @@
namespace Timeline.Entities.Http
{
- public class ReturnCodeMessageResponse
+ public class CommonResponse
{
- public ReturnCodeMessageResponse()
+ public CommonResponse()
{
}
- public ReturnCodeMessageResponse(int code)
- {
- ReturnCode = code;
- }
-
- public ReturnCodeMessageResponse(string message)
+ public CommonResponse(int code, string message)
{
+ Code = code;
Message = message;
}
- public ReturnCodeMessageResponse(int code, string message)
- {
- ReturnCode = code;
- Message = message;
- }
+ public int Code { get; set; }
+ public string Message { get; set; }
+ }
+
+ public static class CommonPutResponse
+ {
+ public const int CreatedCode = 0;
+ public const int ModifiedCode = 1;
+
+ public static CommonResponse Created { get; } = new CommonResponse(CreatedCode, "A new item is created.");
+ public static CommonResponse Modified { get; } = new CommonResponse(ModifiedCode, "An existent item is modified.");
+ }
+
+ public static class CommonDeleteResponse
+ {
+ public const int DeletedCode = 0;
+ public const int NotExistsCode = 1;
- public int? ReturnCode { get; set; } = null;
- public string Message { get; set; } = null;
+ public static CommonResponse Deleted { get; } = new CommonResponse(DeletedCode, "An existent item is deleted.");
+ public static CommonResponse NotExists { get; } = new CommonResponse(NotExistsCode, "The item does not exist.");
}
}