docs: bots API (#6091)

* docs: bot API commands

* generate API commands doc

* generate commands docs with parameters and responses

* add API types

* more types

* document all types (with some deviations from JSON encodings)

* rename types

* interface objects

* separator

* command syntax

* more syntax

* API events

* event types

* fix all type definitions

* pre-process types outside of rendering

* pre-process event types

* overview

* pre-process commands

* param syntax WIP

* syntax for types in command parameters

* API error response and chat event

* remove unsupported/deprecated command parameters

* reorder

* syntax for choice

* show command errors

* event descriptions

* python syntax for commands and types (#6099)

* python syntax for commands and types

* python snippets: convert numbers to string

* fixes

* update readme, enable all tests

* fix operators test

* update plans

---------

Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com>
This commit is contained in:
Evgeny
2025-07-24 13:12:53 +01:00
committed by GitHub
co-authored by spaced4ndy
parent 052b9ad628
commit cf8bd7f6ac
32 changed files with 8447 additions and 131 deletions
+30
View File
@@ -0,0 +1,30 @@
{-# LANGUAGE LambdaCase #-}
module API.Docs.Syntax.Types where
import Data.List.NonEmpty (NonEmpty)
import Data.Semigroup
import Data.String
type ExprParam = String -- param name
data Expr
= Concat (NonEmpty Expr)
| Const String
| Param ExprParam
| Optional Expr Expr ExprParam -- Nothing expr, Just expr (using [$0] as ExprParam), optional param
| Choice ExprParam (NonEmpty (String, Expr)) Expr -- union type param, choices for "type" tags, else
| Join Char ExprParam
| Json ExprParam
| OnOff ExprParam -- does not include leading space
| OnOffParam String ExprParam (Maybe Bool) -- name, param, default. Includes leading space in all cases. Name must not be empty
deriving (Eq, Show)
isConst :: Expr -> Bool
isConst = \case
Const _ -> True
_ -> False
instance IsString Expr where fromString = Const
instance Semigroup Expr where sconcat = Concat