gabbhack / bot-api-gen

Types and methods generator for tbot. [NOT MAINTAINED ANYMORE]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NOT MAINTAINED ANYMORE

bot-api-gen

Types and methods generator for tbot.

Getting started

Requirements

  • Swift 5.4.0
  • swift-format

Installation

  1. Clone the repo git clone https://github.com/tgswift/bot-api-gen
  2. Go to the directory cd bot-api-gen
  3. Run generator swift run
  4. 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

  1. Fork
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Code
  4. Format swift-format -m format -r -i --configuration .swift-format Sources
  5. Commit your Changes (git commit -m 'Add some AmazingFeature')
  6. Push to the Branch (git push origin feature/AmazingFeature)
  7. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Acknowledgements

About

Types and methods generator for tbot. [NOT MAINTAINED ANYMORE]

License:MIT License


Languages

Language:Swift 100.0%