Telegram TL v0.2.1 TL.Schema

Parse and search the MTProto TL-schema (See core.telegram.org/schema/mtproto) and the API TL-schema (See core.telegram.org/schema for API layer 23).

Summary

Functions

Returns the Telegram API TL-schema

Return the version of the API layer used

Search descriptors in the schema(s)

Search in a specific schema

Returns the MTProto TL-schema

Functions

api()

Returns the Telegram API TL-schema.

Example

iex> TL.Schema.api
%{"constructors" => [%{"id" => "-1132882121", "params" => [],
  "predicate" => "boolFalse", "type" => "Bool"}, ...], ...}
api_layer_version()

Return the version of the API layer used.

Example

iex> TL.Schema.api_layer_version
57
search(key, value)

Search descriptors in the schema(s)

  • key : field name
  • value : field value

Examples

iex> TL.Schema.search "method", "messages.setTyping"
{:match,
[%{"id" => "-1551737264", "method" => "messages.setTyping",
  "params" => [%{"name" => "peer", "type" => "InputPeer"},
   %{"name" => "action", "type" => "SendMessageAction"}], "type" => "Bool"}]}
iex> TL.Schema.search "id", "-1551737264"
{:match,
[%{"id" => "-1551737264", "method" => "messages.setTyping",
  "params" => [%{"name" => "peer", "type" => "InputPeer"},
   %{"name" => "action", "type" => "SendMessageAction"}], "type" => "Bool"}]}
iex> TL.Schema.search "method", "unknown_method"
{:nothing, nil}
iex> TL.Schema.search "method_or_predicate", "messages.sendMedia" # to search in both method and predicates
{:match, ...}
search(key, value, schema)

Search in a specific schema.

  • key - example : "predicate"
  • value - example : "ping"
  • schema - schema to search into, either :tl or :api.
tl()

Returns the MTProto TL-schema.

Example

iex> TL.Schema.tl
%{"constructors" => [%{"id" => "481674261", "params" => [],
  "predicate" => "vector", "type" => "Vector t"},
                     %{"id" => "85337187", "params" => ... %},
                     ...]}