Merge remote-tracking branch 'refs/remotes/origin/websockets' into websockets

This commit is contained in:
Aaron Kimbre 2025-02-20 14:44:34 -06:00
commit 72d1b434ed
2 changed files with 284 additions and 0 deletions

163
docs/asyncapi.yaml Normal file
View File

@ -0,0 +1,163 @@
asyncapi: 2.0.0
info:
title: DarkflameServer WebSocket API
version: 1.0.0
description: API documentation for DarkflameServer WebSocket endpoints
servers:
production:
url: http://localhost:2005/ws
protocol: http
description: Production server
channels:
chat:
subscribe:
summary: Subscribe to chat messages
message:
contentType: application/json
payload:
$ref: '#/components/schemas/ChatMessage'
publish:
summary: Send a chat message
message:
contentType: application/json
payload:
$ref: '#/components/schemas/ChatMessage'
player:
subscribe:
summary: Subscribe to player updates
message:
contentType: application/json
payload:
$ref: '#/components/schemas/PlayerUpdate'
team:
subscribe:
summary: Subscribe to team updates
message:
contentType: application/json
payload:
$ref: '#/components/schemas/TeamUpdate'
subscribe:
publish:
summary: Subscribe to an event
message:
contentType: application/json
payload:
$ref: '#/components/schemas/Subscription'
unsubscribe:
publish:
summary: Unsubscribe from an event
message:
contentType: application/json
payload:
$ref: '#/components/schemas/Subscription'
components:
schemas:
ChatMessage:
type: object
properties:
user:
type: string
example: "Player1"
message:
type: string
example: "Hello, world!"
gmlevel:
type: integer
minimum: 0
maximum: 9
example: 0
zone:
type: integer
example: 1000
PlayerUpdate:
type: object
properties:
player_data:
$ref: '#/components/schemas/Player'
update_type:
type: string
example: "JOIN"
TeamUpdate:
type: object
properties:
team_data:
$ref: '#/components/schemas/Team'
update_type:
type: string
example: "CREATE"
Subscription:
type: object
required:
- subscription
properties:
subscription:
type: string
example: "chat_local"
Player:
type: object
properties:
id:
type: integer
format: int64
example: 1152921508901824000
gm_level:
type: integer
format: uint8
example: 0
name:
type: string
example: thisisatestname
muted:
type: boolean
example: false
zone_id:
$ref: '#/components/schemas/ZoneID'
ZoneID:
type: object
properties:
map_id:
type: integer
format: uint16
example: 1200
instance_id:
type: integer
format: uint16
example: 2
clone_id:
type: integer
format: uint32
example: 0
Team:
type: object
properties:
id:
type: integer
format: int64
example: 1152921508901824000
loot_flag:
type: integer
format: uint8
example: 1
local:
type: boolean
example: false
leader:
type: string
example: thisisatestname
members:
type: array
items:
$ref: '#/components/schemas/Player'

121
docs/openapi.yaml Normal file
View File

@ -0,0 +1,121 @@
openapi: 3.0.0
info:
title: DarkflameServer API
version: 1.0.0
description: API documentation for DarkflameServer HTTP endpoints
servers:
- url: http://localhost:2005/api/v1
paths:
/players:
get:
summary: Get list of online players
responses:
'200':
description: A list of online players
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Player'
'204':
description: No players online
content:
application/json:
schema:
type: object
properties:
error:
type: string
example: "No Players Online"
/teams:
get:
summary: Get list of online teams
responses:
'200':
description: A list of online teams
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Team'
'204':
description: No teams online
content:
application/json:
schema:
type: object
properties:
error:
type: string
example: "No Teams Online"
/announce:
post:
summary: Send an announcement
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Announcement'
responses:
'200':
description: Announcement sent successfully
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: "Announcement Sent"
'400':
description: Invalid JSON or missing required fields
content:
application/json:
schema:
type: object
properties:
error:
type: string
example: "Invalid JSON"
components:
schemas:
Player:
type: object
properties:
playerID:
type: integer
example: 12345
playerName:
type: string
example: "Player1"
Team:
type: object
properties:
teamID:
type: integer
example: 67890
teamName:
type: string
example: "Team1"
Announcement:
type: object
required:
- title
- message
properties:
title:
type: string
example: "Server Maintenance"
message:
type: string
example: "The server will be down for maintenance at 10 PM."