Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/PaulSonOfLars/telegram-bot-api-spec

A simple JSON description of the telegram bot API which updates itself every day.
https://github.com/PaulSonOfLars/telegram-bot-api-spec

definition definition-generation generation schema spec specification telegram telegram-api telegram-api-json telegram-bot-api telegram-bot-api-json telegram-bot-api-schema telegram-bot-api-spec telegram-bots

Last synced: about 1 month ago
JSON representation

A simple JSON description of the telegram bot API which updates itself every day.

Awesome Lists containing this project

README

        

# telegram-bot-api-spec

This repo provides the necessary scripts to scrape the [telegram bot api docs] for method, types, and docstrings.

The main usecase of having this data is expected to be to generate automated libraries which follow the bot api
documentation to the letter. Assuming the docs are correct, autogenerated libraries provide the following:
- Easy to update. Simply re-generate the code using the new JSON spec.
- Typo free. All methods/fields are guaranteed to be correct.
- No missing fields. If its in the spec, its in your code!

The output of this script `api.json`, is formatted as such:

```
{
"methods": {
: {
"name": // string, method name
"href": // string, link to docs
"returns": // array of string, possible return types
"description": // array of string, documentation lines
"fields": [
{
"name": // string, field name
"types": // array of string, possible field types
"required": // bool, whether field is required
"description": // string, documentation for field
},
...
], // array of fields
"subtypes": // array of string, all the types that subtype this item (eg, InputMedia has subtypes InputMediaAnimation, InputMediaDocument etc)
"subtype_of": // array of string, all the "parent" types of this type (eg, InputMediaAnimation is a subtype of InputMedia)
},
...
}, // map of method name -> method details
"types": {
: {
"name": // string, type name
"href": // string, link to docs
"description": // array of string, documentation lines
"fields": [
{
"name": // string, field name
"types": // array of string, possible field types
"required": // bool, whether field is required
"description": // string, documentation for field
},
...
], // array of type fields
},
...
} // map of type name -> type details
}
```

[telegram bot api docs]: https://core.telegram.org/bots/api