{"id":15486506,"url":"https://github.com/marshalx/tlo","last_synced_at":"2025-04-22T16:26:39.316Z","repository":{"id":57377315,"uuid":"395785376","full_name":"MarshalX/tlo","owner":"MarshalX","description":"Reader of binary serialized Type Language schemes for Python and JavaScript/TypeScript","archived":false,"fork":false,"pushed_at":"2021-08-15T12:11:06.000Z","size":13964,"stargazers_count":15,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-19T07:15:28.972Z","etag":null,"topics":["javascript","library","mtproto","node","nodejs","parser","python","schema","tdlib","telegram","telegram-api","tl","tl-parser","tl-schema","tlo","tlo-reader","type-language","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MarshalX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"MarshalX"}},"created_at":"2021-08-13T20:21:55.000Z","updated_at":"2024-09-29T19:56:08.000Z","dependencies_parsed_at":"2022-09-19T20:46:51.011Z","dependency_job_id":null,"html_url":"https://github.com/MarshalX/tlo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarshalX%2Ftlo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarshalX%2Ftlo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarshalX%2Ftlo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarshalX%2Ftlo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MarshalX","download_url":"https://codeload.github.com/MarshalX/tlo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249279346,"owners_count":21242907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","library","mtproto","node","nodejs","parser","python","schema","tdlib","telegram","telegram-api","tl","tl-parser","tl-schema","tlo","tlo-reader","type-language","typescript"],"created_at":"2024-10-02T06:08:41.739Z","updated_at":"2025-04-16T21:31:18.875Z","avatar_url":"https://github.com/MarshalX.png","language":"TypeScript","funding_links":["https://github.com/sponsors/MarshalX"],"categories":[],"sub_categories":[],"readme":"## Type Language Object\n\n\u003e Reader of [binary serialized](https://core.telegram.org/mtproto/serialize) Type Language Schema\n\n### Example of result in the end of reading TLO\n\n#### Python \n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/MarshalX/tlo/main/.github/resources/demo_python.gif\" alt=\"demo python\"\u003e\n\u003c/p\u003e\n\n#### JavaScript/TypeScript\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/MarshalX/tlo/main/.github/resources/demo_javascript.gif\" alt=\"demo javascript\"\u003e\n\u003c/p\u003e\n\n### Declaimer\n\nThis code has not been tested sufficiently. \nIt's a rewritten version of original reader in C++.\nIf you are going to use this for code generation, \nplease do additional tests. \nRecheck my implementation for errors and so on.\n\n### Context\n\nThe [Type Language (TL)](https://core.telegram.org/mtproto/TL) was\ninvented many years ago. It was originally used in [VK](https://vk.com/),\nand now in [Telegram](https://telegram.org). \nThe creators of this language invented and \nwrote all the necessary tools to work with it.\nFor example, a [parser of the language](https://github.com/vysheng/tl-parser)\nand its [binary format](https://core.telegram.org/mtproto/serialize)\nfor serialization was developed.\n\n### What is this for?\n\nTo work with TL Schemes using OOP. To generate the client MTProto code using\nofficial TL parsers and binary formats.\n\nMany Open Source MTProto client use their own implementation of parsers, \nwhich are not ultimatum. They are hardcoded for their minimal task.\n\nHardcode is not the way of Telegram. Official Telegram's Open Source projects \ntake the right approach. So, for example, [tdlib](https://github.com/tdlib/td)\ngenerates several interfaces for different languages and this is how it looks:\n\nRaw TL Schema -\u003e Tl Parser -\u003e binary TL Object -\u003e **TLO reader** -\u003e code generator.\n\n| Step name | Description |\n| --------- | ----------- |\n| Raw TL Schema  | Can be founded [here](https://core.telegram.org/schema) and in official Telegram repositories of client ([tdesktop/Telegram/Resources/tl](https://github.com/telegramdesktop/tdesktop/tree/dev/Telegram/Resources/tl), [tdlib/generate/scheme](https://github.com/tdlib/td/tree/master/td/generate/scheme)).  |\n| Tl Parser | Official TL parser written in C++. Now it's a part of [tdlib/td/generate/tl-parser](https://github.com/tdlib/td/tree/master/td/generate/tl-parser). In the input it takes raw TL schema file. The output is TLO file. |\n| binary TL Object | The output of Tl Parser. |\n| **TLO reader** | **This repository contains implementation of it in Python and JavaScript.** Reader of binary file. Provide access to combinators, types, functions, arguments and so on via Object Oriented Programming. |\n| code generator | Any code generator. In [tdlib/td/generate](https://github.com/tdlib/td/tree/master/td/generate) there is generator for C++, JNI, .NET and JSON interfaces. |\n\n### Installing\n\n#### For Python\n```bash\npip install tlo\n```\n\n#### For JavaScript/TypeScript\n```bash\nnpm install tlo\n```\n\n### Usage\n\nYou can find TLO files for tests [here](https://github.com/MarshalX/tlo/tree/main/tlo_for_tests).\n\n#### Python (3.6+)\n```python\nfrom tlo import read_tl_config_from_file, read_tl_config\n\n\n# use read_tl_config(data) to pass bytes directly\nconfig = read_tl_config_from_file('td_api.tlo')\n```\n\n#### JavaScript/TypeScript\n```javascript\nconst tlo = require('tlo');\n//import {read_tl_config_from_file, read_tl_config} from 'tlo';\n\n// use read_tl_config(data) to pass buffer directly\ntlo.read_tl_config_from_file('./tlo_for_tests/telegram_api.tlo', (config) =\u003e {\n    console.log(config);\n});\n```\n\n### Licence\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarshalx%2Ftlo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarshalx%2Ftlo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarshalx%2Ftlo/lists"}