From a41fd5de39256374508294282dfd50702e9584c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Floure?= Date: Tue, 8 Aug 2017 09:03:13 +0200 Subject: [PATCH] Update documentation for flags + bump version to 0.2.0-beta --- README.md | 9 +++++---- lib/tl.ex | 12 ++++++++++++ mix.exs | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0cfa26e..561fa06 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/lib/tl.ex b/lib/tl.ex index 66670f8..34c286d 100644 --- a/lib/tl.ex +++ b/lib/tl.ex @@ -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) diff --git a/mix.exs b/mix.exs index 8858a1f..6cf83b0 100644 --- a/mix.exs +++ b/mix.exs @@ -3,7 +3,7 @@ defmodule TL.Mixfile do def project do [app: :telegram_tl, - version: "0.1.1-beta", + version: "0.2.0-beta", elixir: "~> 1.5", build_embedded: Mix.env == :prod, start_permanent: Mix.env == :prod, -- 2.34.2