256 lines
6.8 KiB
YAML
256 lines
6.8 KiB
YAML
openapi: 3.1.0
|
|
x-stoplight:
|
|
id: gr7tm5a03g740
|
|
info:
|
|
title: OpenAPI
|
|
version: '1.0'
|
|
servers:
|
|
- url: 'http://localhost:3000'
|
|
paths:
|
|
'/users/{userId}':
|
|
parameters:
|
|
- schema:
|
|
type: integer
|
|
name: userId
|
|
in: path
|
|
required: true
|
|
description: Id of an existing user.
|
|
get:
|
|
summary: Get User Info by User ID
|
|
tags: []
|
|
responses:
|
|
'200':
|
|
description: User Found
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/User'
|
|
examples:
|
|
Get User Alice Smith:
|
|
value:
|
|
id: 142
|
|
firstName: Alice
|
|
lastName: Smith
|
|
email: alice.smith@gmail.com
|
|
dateOfBirth: '1997-10-31'
|
|
emailVerified: true
|
|
signUpDate: '2019-08-24'
|
|
'404':
|
|
description: User Not Found
|
|
operationId: get-users-userId
|
|
description: Retrieve the information of the user with the matching user ID.
|
|
patch:
|
|
summary: Update User Information
|
|
operationId: patch-users-userId
|
|
responses:
|
|
'200':
|
|
description: User Updated
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/User'
|
|
examples:
|
|
Updated User Rebecca Baker:
|
|
value:
|
|
id: 13
|
|
firstName: Rebecca
|
|
lastName: Baker
|
|
email: rebecca@gmail.com
|
|
dateOfBirth: '1985-10-02'
|
|
emailVerified: false
|
|
createDate: '2019-08-24'
|
|
'404':
|
|
description: User Not Found
|
|
'409':
|
|
description: Email Already Taken
|
|
description: Update the information of an existing user.
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
firstName:
|
|
type: string
|
|
lastName:
|
|
type: string
|
|
email:
|
|
type: string
|
|
description: 'If a new email is given, the user''s email verified property will be set to false.'
|
|
dateOfBirth:
|
|
type: string
|
|
examples:
|
|
Update First Name:
|
|
value:
|
|
firstName: Rebecca
|
|
Update Email:
|
|
value:
|
|
email: rebecca@gmail.com
|
|
Update Last Name & Date of Birth:
|
|
value:
|
|
lastName: Baker
|
|
dateOfBirth: '1985-10-02'
|
|
description: Patch user properties to update.
|
|
/user:
|
|
post:
|
|
summary: Create New User
|
|
operationId: post-user
|
|
responses:
|
|
'200':
|
|
description: User Created
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/User'
|
|
examples:
|
|
New User Bob Fellow:
|
|
value:
|
|
id: 12
|
|
firstName: Bob
|
|
lastName: Fellow
|
|
email: bob.fellow@gmail.com
|
|
dateOfBirth: '1996-08-24'
|
|
emailVerified: false
|
|
createDate: '2020-11-18'
|
|
'400':
|
|
description: Missing Required Information
|
|
'409':
|
|
description: Email Already Taken
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
firstName:
|
|
type: string
|
|
lastName:
|
|
type: string
|
|
email:
|
|
type: string
|
|
dateOfBirth:
|
|
type: string
|
|
format: date
|
|
required:
|
|
- firstName
|
|
- lastName
|
|
- email
|
|
- dateOfBirth
|
|
examples:
|
|
Create User Bob Fellow:
|
|
value:
|
|
firstName: Bob
|
|
lastName: Fellow
|
|
email: bob.fellow@gmail.com
|
|
dateOfBirth: '1996-08-24'
|
|
description: Post the necessary fields for the API to create a new user.
|
|
description: Create a new user.
|
|
components:
|
|
schemas:
|
|
Player:
|
|
title: Player
|
|
x-stoplight:
|
|
id: be41fcacb2693
|
|
type: object
|
|
examples: []
|
|
properties:
|
|
id:
|
|
$ref: '#/components/schemas/EntityID'
|
|
description: Unique identifier for the given user.
|
|
name:
|
|
type: string
|
|
required:
|
|
- id
|
|
Weapon:
|
|
title: Weapon
|
|
x-stoplight:
|
|
id: 7zc6t20eh3pcc
|
|
type: object
|
|
properties:
|
|
id:
|
|
$ref: '#/components/schemas/WeaponID'
|
|
internal:
|
|
type: string
|
|
example: mp_weapon_sniper
|
|
name:
|
|
type: string
|
|
example: Kraber
|
|
description:
|
|
type: string
|
|
image:
|
|
type: string
|
|
format: uri
|
|
example: 'https://static.wikia.nocookie.net/titanfall_gamepedia/images/8/8b/Icon_kraber.png'
|
|
required:
|
|
- id
|
|
- internal
|
|
Map:
|
|
title: Map
|
|
x-stoplight:
|
|
id: hoh2m6pr6gli7
|
|
type: object
|
|
properties:
|
|
id:
|
|
$ref: '#/components/schemas/MapID'
|
|
internal:
|
|
type: string
|
|
example: mp_angel_city
|
|
name:
|
|
type: string
|
|
description:
|
|
type: string
|
|
image:
|
|
type: string
|
|
format: uri
|
|
required:
|
|
- id
|
|
- internal
|
|
Kill:
|
|
title: Kill
|
|
x-stoplight:
|
|
id: a9q2tvsts3z32
|
|
type: object
|
|
properties:
|
|
id:
|
|
type: integer
|
|
readOnly: true
|
|
server:
|
|
type: string
|
|
example: fvnkhead's 7v7
|
|
attacker:
|
|
$ref: '#/components/schemas/EntityID'
|
|
attacker_weapon:
|
|
$ref: '#/components/schemas/WeaponID'
|
|
victim:
|
|
$ref: '#/components/schemas/EntityID'
|
|
victim_weapon:
|
|
$ref: '#/components/schemas/WeaponID'
|
|
map:
|
|
$ref: '#/components/schemas/MapID'
|
|
distance:
|
|
type: number
|
|
example: 35.45
|
|
date:
|
|
type: string
|
|
format: date-time
|
|
readOnly: true
|
|
required:
|
|
- server
|
|
- attacker
|
|
- victim
|
|
EntityID:
|
|
title: EntityID
|
|
x-stoplight:
|
|
id: 9icavmq5bgsqp
|
|
type: integer
|
|
WeaponID:
|
|
title: WeaponID
|
|
x-stoplight:
|
|
id: p92aomkxku2po
|
|
type: integer
|
|
MapID:
|
|
title: MapID
|
|
x-stoplight:
|
|
id: zoazw8eoi7qwr
|
|
type: integer
|