@@ 10,14 10,15 @@ The package and its documentation are on
## Configuration
-If no configuration is specified, the
-[API layer 23](https://core.telegram.org/schema?layer=23) will be used.
+If no configuration is specified, the API layer 57 **[1]** will be used.
Although this library was only tested with the above layer version, you can
specify a custom source in you `config.exs` :
```
config :telegram_tl, tl_path: "/path/to/mtproto.json",
- api_version: 23,
- api_path: "/path/to/api-layer-23.json"
+ api_version: 57,
+ api_path: "/path/to/api-layer-57.json"
```
+
+**[1]** : the last documented version is [API layer 23](https://core.telegram.org/schema?layer=23).
@@ 8,10 8,22 @@ defmodule TL do
[core.telegram.org/schema/mtproto](https://core.telegram.org/schema/mtproto)
and [core.telegram.org/schema](https://core.telegram.org/schema).
+ **About flags :** you must provide the index of the enabled flags in the `flags`
+ field. Except for `flags.X?true`, any enabled flag must be provided with a value.
+
## Example
iex> TL.build "ping", %{:ping_id => 666}
<<236, 119, 190, 122, 154, 2, 0, 0, 0, 0, 0, 0>>
+
+ # Flags, example for :
+ # auth.sendCode#86aef0ec flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string = auth.SentCode;
+ # Here flags with index '0' ([0]) are enabled. If you want to enable
+ # flags with index 0, 2 or 4 : [0,2,4].
+ iex> TL.build("auth.sendCode", %{flags: [0], phone_number: "0041763332222", sms_type: 0, api_id: 1234, api_hash: "hashashash", lang_code: "en", current_number: "BoolFalse"})
+ <<236, 240, 174, 134, 1, 0, 0, 0, 13, 48, 48, 52, 49, 55, 54, 51, 51, 51, 50,
+ 50, 50, 50, 0, 0, 66, 111, 111, 108, 70, 97, 108, 115, 101, 210, 4, 0, 0, 10,
+ 104, 97, 115, 104, 97, 115, 104, 97, 115, 104, 0>>
"""
def build(container, content), do: TL.Build.encode(container, content)