users swagger def

This commit is contained in:
Gnieark 2019-12-03 21:30:47 +01:00
parent 1b47bbfc63
commit 6924473f78

View File

@ -1,110 +1,195 @@
swagger: "2.0" swagger: "2.0"
info: info:
description: "SimplePAD API" description: "Resources Manager API"
version: "1.0.0" version: "1.0.0"
title: "SimplePad API" title: "SimplePad API"
host: "simplepad.localhost" host: "localhost"
basePath: "/api" basePath: "/api"
tags: tags:
- name: "pad" - name: "user"
description: "CRUD Pads" description: "Operations about user"
schemes: schemes:
- "https" - "https"
- "http" - "http"
paths: paths:
/pad: /user:
post: post:
tags: tags:
- "pad" - "user"
summary: "Create a new pad" summary: "Create user"
description: "Create a new PAD (with a random id)" description: "Need pass an api key to authentificate."
consumes: operationId: "createUser"
- "application/json"
produces: produces:
- "application/json" - "application/json"
parameters: parameters:
- in: "body" - in: "body"
name: "body" name: "body"
description: "Created user object"
required: true required: true
schema: schema:
$ref: "#/definitions/Pad" $ref: "#/definitions/User"
- in: header
name: X-API-Key
type: string
required: true
responses: responses:
405: default:
description: "Invalid input" description: "successful operation"
200: /user/createWithArray:
description: "SuccessFull" post:
schema: tags:
$ref: "#/definitions/Pad" - "user"
summary: "Creates list of users with given input array"
/pad/{pad_id}: description: ""
operationId: "createUsersWithArrayInput"
produces:
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "List of user object"
required: true
schema:
type: "array"
items:
$ref: "#/definitions/User"
- in: header
name: X-API-Key
type: string
required: true
responses:
default:
description: "successful operation"
/user/createWithList:
post:
tags:
- "user"
summary: "Creates list of users with given input array"
description: ""
operationId: "createUsersWithListInput"
produces:
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "List of user object"
required: true
schema:
type: "array"
items:
$ref: "#/definitions/User"
- in: header
name: X-API-Key
type: string
required: true
responses:
default:
description: "successful operation"
/user/{username}:
get: get:
tags: tags:
- "pad" - "user"
summary: "Get user by user name"
description: ""
operationId: "getUserByName"
produces: produces:
- "application/xml"
- "application/json" - "application/json"
parameters: parameters:
- in: "path" - name: "username"
name: "pad_id" in: "path"
description: "The name that needs to be fetched."
required: true required: true
type: "string"
- in: header
name: X-API-Key
type: string type: string
maxLength: 6 required: false
minLength: 6
responses: responses:
404:
description: "Does not exists"
200: 200:
description: "SuccessFull" description: "successful operation"
schema: schema:
$ref: "#/definitions/Pad" $ref: "#/definitions/User"
post: 400:
description: "Invalid username supplied"
404:
description: "User not found"
put:
tags: tags:
- "pad" - "user"
description: "Create a new PAD with the given ID" summary: "Updated user"
description: "This can only be done by the logged in user."
operationId: "updateUser"
produces: produces:
- "application/xml"
- "application/json" - "application/json"
parameters: parameters:
- in: "path" - name: "username"
name: "pad_id" in: "path"
description: "name that need to be updated"
required: true required: true
type: string type: "string"
maxLength: 6
minLength: 6
- in: "body" - in: "body"
name: "body" name: "body"
description: "content" description: "Updated user object"
required: true required: true
schema: schema:
$ref: "#/definitions/PadPost" $ref: "#/definitions/User"
- in: header
name: X-API-Key
type: string
required: true
responses: responses:
405: 400:
description: "Invalid input" description: "Invalid user supplied"
409: 404:
description: "Given Id already exists" description: "User not found"
200: delete:
description: "SuccessFull" tags:
schema: - "user"
$ref: "#/definitions/Pad" summary: "Delete user"
description: "This can only be done by the logged in user."
operationId: "deleteUser"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "username"
in: "path"
description: "The name that needs to be deleted"
required: true
type: "string"
- in: header
name: X-API-Key
type: string
required: true
responses:
400:
description: "Invalid username supplied"
404:
description: "User not found"
definitions: definitions:
Pad: User:
type: "object" type: "object"
properties: properties:
id: id:
type: string type: "integer"
maxLength: 6 format: "int64"
minLength: 6 username:
content: type: "string"
type: string firstName:
create_date: type: "string"
type: string lastName:
format: date type: "string"
PadPost: email:
type: "object" type: "string"
required: password:
- content type: "string"
properties: phone:
content: type: "string"
type: string userStatus:
type: "integer"
format: "int32"
description: "User Status"