Add initial API documentation

This commit is contained in:
BernardoGiordano 2018-08-20 14:50:42 +02:00
parent 71e1a36587
commit 3c51a92688
2 changed files with 221 additions and 0 deletions

2
server/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
saves
connection.json

219
server/swagger.yaml Normal file
View file

@ -0,0 +1,219 @@
swagger: '2.0'
info:
version: 1.0.0
title: Checkpoint API
description: >-
Rest APIs to use with Checkpoint's server
schemes:
- https
host: localhost
basePath: /api
tags:
- name: resources
description: web resources
paths:
/v1/save:
put:
tags:
- resources
summary: Uploads a save to the server
description: todo
operationId: putSave
produces:
- application/json
consumes:
- multipart/form-data
parameters:
- in: header
name: Serial
description: Console serial code
type: string
required: true
- in: formData
name: metadata
type: file
description: Save object as JSON file
required: true
- in: formData
name: attachment
type: file
description: ZIP attachment containing the save backup
required: true
responses:
'204':
description: OK NO CONTENT
'400':
description: BAD REQUEST
schema:
$ref: '#/definitions/Result'
'500':
description: INTERNAL SERVER ERROR
schema:
$ref: '#/definitions/Result'
/v1/saves/{titleId}:
get:
tags:
- resources
summary: Gets the list of saves with a certain title id
description: todo
operationId: getSavesByTitleId
produces:
- application/json
parameters:
- in: header
name: Serial
description: Console serial code
type: string
required: true
- in: path
name: titleId
type: integer
format: int64
description: title id of the desired title
required: true
responses:
'200':
description: OK CONTENT
schema:
type: array
items:
$ref: '#/definitions/Save'
'400':
description: BAD REQUEST
schema:
$ref: '#/definitions/Result'
'404':
description: NOT FOUND
schema:
$ref: '#/definitions/Result'
'500':
description: INTERNAL SERVER ERROR
schema:
$ref: '#/definitions/Result'
/v1/save/{id}:
get:
tags:
- resources
summary: Gets a save from the server
description: todo
operationId: getSaveById
produces:
- application/json
parameters:
- in: header
name: Serial
description: Console serial code
type: string
required: true
- in: path
name: id
type: integer
format: int64
description: id of the desired title
required: true
responses:
'200':
description: OK CONTENT
schema:
type: array
items:
$ref: '#/definitions/Save'
'400':
description: BAD REQUEST
schema:
$ref: '#/definitions/Result'
'404':
description: NOT FOUND
schema:
$ref: '#/definitions/Result'
'500':
description: INTERNAL SERVER ERROR
schema:
$ref: '#/definitions/Result'
delete:
tags:
- resources
summary: Deletes a save from the server
description: todo
operationId: deleteSaveById
produces:
- application/json
parameters:
- in: header
name: Serial
description: Console serial code
type: string
required: true
- in: path
name: id
type: integer
format: int64
description: id of the desired title
required: true
responses:
'204':
description: OK NO CONTENT
'400':
description: BAD REQUEST
schema:
$ref: '#/definitions/Result'
'404':
description: NOT FOUND
schema:
$ref: '#/definitions/Result'
'500':
description: INTERNAL SERVER ERROR
schema:
$ref: '#/definitions/Result'
securityDefinitions:
token:
type: apiKey
name: Token
in: header
definitions:
Result:
type: object
properties:
code:
type: integer
format: int64
message:
type: string
xml:
name: Result
Save:
type: object
properties:
id:
type: integer
format: int64
date:
type: string
format: date-time
hash:
type: string
minLength: 32
maxLength: 32
path:
type: string
private:
type: boolean
product_code:
type: string
minLength: 1
maxLength: 32
serial:
type: string
minLength: 64
maxLength: 64
title_id:
type: integer
format: int64
type:
type: string
enum:
- DS
- 3DS
- Switch
username:
type: string