NOT MAINTAINED ANYMORE
bot-api-gen
Types and methods generator for tbot
.
Getting started
Requirements
- Swift 5.4.0
- swift-format
Installation
- Clone the repo
git clone https://github.com/tgswift/bot-api-gen
- Go to the directory
cd bot-api-gen
- Run generator
swift run
- Get types and methods from
generated
directory
Configuration
Rendering
By default generator use this settings:
let CONFIG = Config(
source: "https://ark0f.github.io/tg-bot-api/custom.min.json",
templatesPath: "templates",
typeTemplate: "Type.swift",
typeSaveTo: "generated/types",
methodTemplate: "Method.swift",
methodSaveTo: "generated/methods"
)
You can change them in the Config.swift
file.
Formatting
After generation, the generator automatically formats the generated files using swift-format. Its settings are located in the .swift-format
file
Skip objects
The generator is quite simple, so it skips complex sum-types (e.g. BotCommandScope).
In addition, it skips the other types and methods specified in Config.swift
. These are usually types or methods that are already written manually in tbot
.
Generator prints the skipped types and methods.
Contributing
- Fork
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Code
- Format
swift-format -m format -r -i --configuration .swift-format Sources
- Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE for more information.