From e51197a3e56d0ce3d05170c3b933b786f51e715d Mon Sep 17 00:00:00 2001 From: Roland Osborne Date: Thu, 27 Jan 2022 23:19:11 -0800 Subject: [PATCH] added article expiration --- doc/api.oa3 | 39 ++++++++++++++++++++++++++++++ net/server/internal/api_content.go | 5 ++++ net/server/internal/routers.go | 8 +++++- 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/doc/api.oa3 b/doc/api.oa3 index 4974b0f4..166bbc95 100644 --- a/doc/api.oa3 +++ b/doc/api.oa3 @@ -1783,6 +1783,44 @@ paths: data: type: string + /content/articles/{articleId}/expiration: + put: + tags: + - content + description: Set expiration for article. Access granted to app token of account holder. + operationId: set-article-expiration + security: + - bearerAuth: [] + parameters: + - name: articleId + in: path + description: specified article id + required: true + schema: + type: string + responses: + '200': + description: success + '401': + description: permission denied + '404': + description: article not found + '410': + description: account disabled + '500': + description: internal server error + requestBody: + content: + application/json: + schema: + type: object + required: + - expires + properties: + expires: + type: number + format: int32 + /content/articles/{articleId}/groups/{groupId}: post: tags: @@ -4553,3 +4591,4 @@ components: type: http scheme: bearer + diff --git a/net/server/internal/api_content.go b/net/server/internal/api_content.go index b0b4c17a..21c516f8 100644 --- a/net/server/internal/api_content.go +++ b/net/server/internal/api_content.go @@ -133,6 +133,11 @@ func SetArticleConfirmed(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) } +func SetArticleExpiration(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + w.WriteHeader(http.StatusOK) +} + func SetArticleGroup(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") w.WriteHeader(http.StatusOK) diff --git a/net/server/internal/routers.go b/net/server/internal/routers.go index 4787201a..ab43dfe0 100644 --- a/net/server/internal/routers.go +++ b/net/server/internal/routers.go @@ -579,6 +579,13 @@ var routes = Routes{ SetArticleConfirmed, }, + Route{ + "SetArticleExpiration", + strings.ToUpper("Put"), + "/content/articles/{articleId}/expiration", + SetArticleExpiration, + }, + Route{ "SetArticleGroup", strings.ToUpper("Post"), @@ -908,4 +915,3 @@ var routes = Routes{ Status, }, } -