~fnux/telegram-tl-elixir

a41fd5de39256374508294282dfd50702e9584c9 — Timothée Floure 4 years ago 0fd09ad
Update documentation for flags + bump version to 0.2.0-beta
3 files changed, 18 insertions(+), 5 deletions(-)

M README.md
M lib/tl.ex
M mix.exs
M README.md => README.md +5 -4
@@ 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).

M lib/tl.ex => lib/tl.ex +12 -0
@@ 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)


M mix.exs => mix.exs +1 -1
@@ 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,