commit 0bb2f404289bd4f1768b378011e5882eefdf16cb
parent 8d5fb78ccdaffed216401291ebff387c2e483181
Author: MTRNord <mtrnord1@gmail.com>
Date: Sun, 18 Feb 2018 20:34:55 +0100
Add "POST /papers" to API Definition && Add UUID to Author Object (in case of multiple users with same username)
Diffstat:
2 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/api/openapi.yaml b/api/openapi.yaml
@@ -45,6 +45,45 @@ paths:
type: "string"
uuid:
type: "string"
+ post:
+ tags:
+ - paper
+ summary: Add a new Paper
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ name:
+ type: string
+ description:
+ type: string
+ author:
+ type: object
+ properties:
+ uuid:
+ type: string
+ responses:
+ '200': # status code
+ description: A JSON array containing a short info about the just added Papers (might be different ordered)
+ headers:
+ API-VERSION:
+ schema:
+ type: string
+ default: 0.0.0
+ description: Current API Version.
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ properties:
+ name:
+ type: "string"
+ uuid:
+ type: "string"
/paper/{uuid}:
get:
tags:
@@ -81,6 +120,8 @@ paths:
author:
type: object
properties:
+ uuid:
+ type: string
username:
type: string
profile_image_url:
diff --git a/api/webserver.go b/api/webserver.go
@@ -40,6 +40,7 @@ type Paper struct {
}
type Author struct {
+ UUID string `json:"uuid,omitempty"`
Username string `json:"username,omitempty"`
ProfileIMGURL string `json:"profile_image_url,omitempty"`
TwitterProfile string `json:"twitter_profile,omitempty"`