From 45ae774bf98800a13485f16884f7aa6aa8983555 Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 28 Apr 2019 02:38:43 +0300 Subject: [PATCH] Add README to tdweb package. GitOrigin-RevId: 448a7a5f54a1cf5b08bb2062c38cde5c47b6f832 --- example/web/README.md | 5 +++++ example/web/tdweb/README.md | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 example/web/tdweb/README.md diff --git a/example/web/README.md b/example/web/README.md index dd8ddbe4f..a7ba4188f 100644 --- a/example/web/README.md +++ b/example/web/README.md @@ -22,3 +22,8 @@ cd /example/web ./copy-tdlib.sh ./build-tdweb.sh ``` +* The built package is now located in `tdweb` directory. + +## Using tdweb NPM package + +See [tdweb](https://www.npmjs.com/package/@arseny30/tdweb) or [README.md](https://github.com/tdlib/td/tree/master/example/web/tdweb/README.md) for the package documentation. diff --git a/example/web/tdweb/README.md b/example/web/tdweb/README.md new file mode 100644 index 000000000..96caaad06 --- /dev/null +++ b/example/web/tdweb/README.md @@ -0,0 +1,20 @@ +## tdweb - TDLib in a browser + +[TDLib](https://github.com/tdlib/td) is a library for building Telegram clients. This is a convenient wrapper for the TDLib in a browser which controls TDLib instance creation, +handles interaction with the TDLib and manages a filesystem for persistent TDLib data. + +For interaction with the TDLib you need to create an instance of a class `TdClient`, providing a handler for incoming updates and other options if needed. +After that you can send queries to the TDLib instance using the method `TdClient.send` which returns a Promise object representing the result of the query. + +See a [Getting Started](https://core.telegram.org/tdlib/getting-started) for a description of basic TDLib concepts and a short introduction to TDLib usage. + +See the [td_api.tl](https://github.com/tdlib/td/blob/master/td/generate/scheme/td_api.tl) scheme or +the automatically generated [HTML documentation](https://core.telegram.org/tdlib/docs/td__api_8h.html) for a list of all available +TDLib [methods](https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1_function.html) and [classes](https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1_object.html). +The JSON representation of TDLib API objects is straightforward: all API objects are represented as JSON objects with the same keys as the API object field names in the +[td_api.tl](https://github.com/tdlib/td/blob/master/td/generate/scheme/td_api.tl) scheme. Note that in the automatically generated Ñ++ documentation all fields has additional terminating underscore +which shouldn't be used in the JSON interface. The object type name is stored in the special field '@type' which is optional in places where a type is uniquely determined by the context. +Fields of Bool type are stored as Boolean, fields of int32, int53 and double types are stored as Number, fields of int64 and string types are stored as String, +fields of bytes type are base64 encoded and then stored as String, fields of vector type are stored as Array. +You can also add a field '@extra' to any query to TDLib and the response will contain field '@extra' with exactly the same value. +