{"_id":"5703e5e7bb69fc1700553d11","user":"5631f962c3b04b0d00ba9bf1","category":{"_id":"5703d527bb69fc1700553ce4","project":"5703d527bb69fc1700553ce0","__v":0,"version":"5703d527bb69fc1700553ce3","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-04-05T15:09:27.645Z","from_sync":false,"order":0,"slug":"documentation","title":"Documentation"},"version":{"_id":"5703d527bb69fc1700553ce3","hasDoc":true,"__v":6,"hasReference":true,"project":"5703d527bb69fc1700553ce0","createdAt":"2016-04-05T15:09:27.620Z","releaseDate":"2016-04-05T15:09:27.620Z","categories":["5703d527bb69fc1700553ce4","5703d8b7aceacc17003ef303","5703e60b6116142000db25f6","57e0db616a1c2e0e0081fe64","57e0f141ff540c22007b45fa","57e0f14b8929550e00f1d9bc"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"0.0.6","version":"0.0.6"},"__v":6,"parentDoc":null,"project":"5703d527bb69fc1700553ce0","githubsync":"","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-04-05T16:20:55.250Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"The project is composed by the following modules:\n- [tl-builder: Type Language compiler](#section-tl-builder-type-language-http-core-telegram-org-mtproto-tl-compiler)\n- [tl: Type Language library](#section-tl-type-language-library)\n- [mtproto: MTProto Mobile Protocol library](#section-mtproto-mtproto-mobile-protocol-https-core-telegram-org-mtproto-library)\n- [api](#section-api)\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Important\",\n  \"body\": \"This structure helps keeping a modular implementation, leaving you the choice of the what you want do use or implement yourself. It's **strongly** recommended to use the `api` module that is the highest level of abstraction for the Telegram API.\\nBut for **advance usage** or people who would want to implement their own client, the documentation will still detail all modules.\"\n}\n[/block]\n# tl-builder: [Type Language](http://core.telegram.org/mtproto/TL) compiler\n----------------\nConverts json-representation of [TL Schema](http://core.telegram.org/schema) to Java classes with generated classes for serializing and deserializing api messages and methods to their binary representation (see [Binary Data Serialization](https://core.telegram.org/mtproto/serialize)).\nThis module is using JavaPoet to generate the classes.\n#### Usage\n1. Run the main class in tl-builder module with the layer value\n\nThe classes will be generated in the ```tl``` module in the package ```com.github.badoualy.telegram.tl.api```.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Can I generate classes for an older layer?\",\n  \"body\": \"Yes, \\n- Place the **json tl-schema** in the `resources` folder, name it `tl-schema-X.json` where `X` is the layer version\\n- Edit `Main.kt` and change the value of `TL_SCHEMA_LEVEL` with the layer level\\n- Run the class as explained previously :)\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Where can I get the json tl-schema?\",\n  \"body\": \"Sadly, Telegram library is outdated, and despite they claim having a public API, the public support clearly stopped a very long time ago. Clearly they must have a private doc, I doubt that the official developers are developing without any kind of documentation.\\nI hope they'll update it one day (because the very little we have is very messy...). So to find the new layers schema, you'll have to look into the official apps repo.\"\n}\n[/block]\n# tl: [Type Language]() library\n----------------\nContains the base type of the Type Language (int, long, Vecor, ...) and the classes generated by the ```tl-builder```. This module is the lowest level in the library, it supplies all the necessary classes to serialize/deserialize objects describe in the [TL Schema](https://core.telegram.org/schema).\n#### About TL Language\n\"*TL Language (Type Language or Time Limit) serves to describe the used system of types, constructors, and existing functions. In fact, the combinator description format presented in Binary Data Serialization is used.*\"\n\n\n# mtproto: [MTProto Mobile Protocol](https://core.telegram.org/mtproto) library\n----------------\nContains all the necessary stuff to make RPC (Remote Procedure Call) and handle all the low-level stuff (like handling salt, etc.)\n#### About MTProto..\n\n**MTProto** is the [Telegram Messenger](http://www.telegram.org ) protocol \n_\"designed for access to a server API from applications running on mobile devices\"_.\n\nThe Mobile Protocol is subdivided into three components ([from the official site](https://core.telegram.org/mtproto#general-description)):\n\n - High-level component (API query language): defines the method whereby API \n queries and responses are converted to binary messages.\n \n - Cryptographic (authorization) layer: defines the method by which messages \n are encrypted prior to being transmitted through the transport protocol.      \n \n - Transport component: defines the method for the client and the server to transmit \n messages over some other existing network protocol (such as, http, https, tcp, udp).\n\n\n# api\n----------------\nHigh-level API to easily use Telegram's [api methods](https://core.telegram.org/methods) without having to understand the first thing about MTProto or TL Language :)\nAn old fashioned Java API (like using [RestFB](https://github.com/restfb/restfb) or a any Rest API binding).","excerpt":"","slug":"structure","type":"basic","title":"Structure"}
The project is composed by the following modules: - [tl-builder: Type Language compiler](#section-tl-builder-type-language-http-core-telegram-org-mtproto-tl-compiler) - [tl: Type Language library](#section-tl-type-language-library) - [mtproto: MTProto Mobile Protocol library](#section-mtproto-mtproto-mobile-protocol-https-core-telegram-org-mtproto-library) - [api](#section-api) [block:callout] { "type": "info", "title": "Important", "body": "This structure helps keeping a modular implementation, leaving you the choice of the what you want do use or implement yourself. It's **strongly** recommended to use the `api` module that is the highest level of abstraction for the Telegram API.\nBut for **advance usage** or people who would want to implement their own client, the documentation will still detail all modules." } [/block] # tl-builder: [Type Language](http://core.telegram.org/mtproto/TL) compiler ---------------- Converts json-representation of [TL Schema](http://core.telegram.org/schema) to Java classes with generated classes for serializing and deserializing api messages and methods to their binary representation (see [Binary Data Serialization](https://core.telegram.org/mtproto/serialize)). This module is using JavaPoet to generate the classes. #### Usage 1. Run the main class in tl-builder module with the layer value The classes will be generated in the ```tl``` module in the package ```com.github.badoualy.telegram.tl.api```. [block:callout] { "type": "info", "title": "Can I generate classes for an older layer?", "body": "Yes, \n- Place the **json tl-schema** in the `resources` folder, name it `tl-schema-X.json` where `X` is the layer version\n- Edit `Main.kt` and change the value of `TL_SCHEMA_LEVEL` with the layer level\n- Run the class as explained previously :)" } [/block] [block:callout] { "type": "warning", "title": "Where can I get the json tl-schema?", "body": "Sadly, Telegram library is outdated, and despite they claim having a public API, the public support clearly stopped a very long time ago. Clearly they must have a private doc, I doubt that the official developers are developing without any kind of documentation.\nI hope they'll update it one day (because the very little we have is very messy...). So to find the new layers schema, you'll have to look into the official apps repo." } [/block] # tl: [Type Language]() library ---------------- Contains the base type of the Type Language (int, long, Vecor, ...) and the classes generated by the ```tl-builder```. This module is the lowest level in the library, it supplies all the necessary classes to serialize/deserialize objects describe in the [TL Schema](https://core.telegram.org/schema). #### About TL Language "*TL Language (Type Language or Time Limit) serves to describe the used system of types, constructors, and existing functions. In fact, the combinator description format presented in Binary Data Serialization is used.*" # mtproto: [MTProto Mobile Protocol](https://core.telegram.org/mtproto) library ---------------- Contains all the necessary stuff to make RPC (Remote Procedure Call) and handle all the low-level stuff (like handling salt, etc.) #### About MTProto.. **MTProto** is the [Telegram Messenger](http://www.telegram.org ) protocol _"designed for access to a server API from applications running on mobile devices"_. The Mobile Protocol is subdivided into three components ([from the official site](https://core.telegram.org/mtproto#general-description)): - High-level component (API query language): defines the method whereby API queries and responses are converted to binary messages. - Cryptographic (authorization) layer: defines the method by which messages are encrypted prior to being transmitted through the transport protocol. - Transport component: defines the method for the client and the server to transmit messages over some other existing network protocol (such as, http, https, tcp, udp). # api ---------------- High-level API to easily use Telegram's [api methods](https://core.telegram.org/methods) without having to understand the first thing about MTProto or TL Language :) An old fashioned Java API (like using [RestFB](https://github.com/restfb/restfb) or a any Rest API binding).