lockserver/openapi/openapi.yaml

104 lines
2.5 KiB
YAML

openapi: "3.1.0"
info:
version: 0.1.0
title: Lockserver
license:
name: CC-BY-SA-4.0
url: https://creativecommons.org/licenses/by/4.0/
paths:
/locks/{lock}/slots/{slot}:
get:
operationId: get_lock_code_slot
parameters:
- name: lock
in: path
description: ID of lock
required: true
schema:
type: integer
- name: slot
in: path
description: ID of code slot
required: true
schema:
type: integer
responses:
'200':
description: A lock code slot
content:
application/json:
schema:
$ref: '#/components/schemas/LockCodeSlot'
put:
operationId: put_lock_code_slot
parameters:
- name: lock
in: path
description: ID of lock
required: true
schema:
type: integer
- name: slot
in: path
description: ID of code slot
required: true
schema:
type: integer
requestBody:
description: the new value for the slot
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/LockCodeSlot'
/admin/user-codes:
get:
operationId: get_all_user_codes
responses:
'200':
description: all current and future user codes
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/UserCode'
post:
operationId: add_user_code
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UserCode'
responses:
'201':
description: user code was created
content:
application/json:
schema:
$ref: '#/components/schemas/UserCode'
components:
schemas:
LockCodeSlot:
type: object
required:
- code
- enabled
properties:
code:
type: string
enabled:
type: boolean
UserCode:
type: object
properties:
code:
type: string
user:
type: string
starts:
description: when the code becomes active
type: string
ends:
description: when the code expires
type: string