lobby2/docs/swagger.yaml
2024-12-08 02:30:07 +01:00

119 lines
2.7 KiB
YAML

basePath: /
definitions:
api.Message:
properties:
message:
type: string
type: object
nodes.KV:
additionalProperties:
type: string
type: object
nodes.Node:
properties:
hostname:
type: string
kv:
$ref: '#/definitions/nodes.KV'
labels:
items:
type: string
type: array
last_update:
type: integer
type: object
info:
contact: {}
description: API of Lobby 2 project that helps to discover and connect to other
nodes and their services.
title: Lobby2 API
version: "2.0"
paths:
/nodes:
get:
description: List of all discovered nodes and their labels.
produces:
- application/json
responses:
"200":
description: List of nodes
schema:
items:
$ref: '#/definitions/nodes.Node'
type: array
"401":
description: Forbidden access
schema:
$ref: '#/definitions/api.Message'
security:
- Bearer: []
summary: List of nodes
/nodes/{hostname}:
get:
description: Return one nodes based on given hostname
parameters:
- description: Node hostname
in: path
name: hostname
required: true
type: string
produces:
- application/json
responses:
"200":
description: Node details
schema:
items:
$ref: '#/definitions/nodes.Node'
type: array
"401":
description: Forbidden access
schema:
$ref: '#/definitions/api.Message'
security:
- Bearer: []
summary: Get node
post:
description: Send new data or update existing data about a node
parameters:
- description: Node hostname
in: path
name: hostname
required: true
type: string
- description: Node labels
in: body
name: labels
required: true
schema:
items:
type: string
type: array
- description: Key-value
in: body
name: kv
required: true
schema:
$ref: '#/definitions/nodes.KV'
produces:
- application/json
responses:
"200":
description: Node details
schema:
items:
$ref: '#/definitions/nodes.Node'
type: array
"401":
description: Forbidden access
schema:
$ref: '#/definitions/api.Message'
security:
- Bearer: []
summary: Refresh node
securityDefinitions:
Bearer:
in: header
name: Authorization
type: apiKey
swagger: "2.0"