### [TL language](https://core.telegram.org/schema) parser for Elixir [![Hex.pm](https://img.shields.io/hexpm/v/tl.svg)](https://hex.pm/packages/tl) [![Travis](https://img.shields.io/travis/ccsteam/tl.svg)](https://travis-ci.org/ccsteam/tl)
---
Parser generator based on TL schemas. Library version based on [main TL schema](https://core.telegram.org/schema) (currently 57 layer), also contains [service messages](https://core.telegram.org/schema/mtproto) and official [end-to-end](https://core.telegram.org/schema/end-to-end) (up to 23 layer).
---
## Installation
1. Add `tl` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:tl, "~> 57.0"}]
end
```
2. Ensure `tl` is started before your application:
```elixir
def application do
[applications: [:tl]]
end
```
---
### Usage
Encoding:
```elixir
iex> struct = %TL.MTProto.Ping{ping_id: 1}
iex> packet = TL.Serializer.encode(struct)
<<236, 119, 190, 122, 1, 0, 0, 0, 0, 0, 0, 0>>
```
Decoding:
```elixir
iex> packet = <<236, 119, 190, 122, 1, 0, 0, 0, 0, 0, 0, 0>>
iex> TL.Serializer.decode(packet)
{:ok, %TL.MTProto.Ping{ping_id: 1}}
```
---
### Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request