├── .gitignore ├── LICENSE ├── README.md ├── __init__.py ├── api ├── __init__.py ├── bots_api.py ├── chats_api.py ├── messages_api.py ├── subscriptions_api.py └── upload_api.py ├── api_client.py ├── configuration.py ├── models ├── __init__.py ├── action_request_body.py ├── attachment.py ├── attachment_payload.py ├── attachment_request.py ├── audio_attachment.py ├── audio_attachment_request.py ├── bot_added_to_chat_update.py ├── bot_command.py ├── bot_info.py ├── bot_patch.py ├── bot_removed_from_chat_update.py ├── bot_started_update.py ├── button.py ├── callback.py ├── callback_answer.py ├── callback_button.py ├── callback_constructor_input.py ├── chat.py ├── chat_admin_permission.py ├── chat_button.py ├── chat_list.py ├── chat_member.py ├── chat_members_list.py ├── chat_patch.py ├── chat_status.py ├── chat_title_changed_update.py ├── chat_type.py ├── constructed_message.py ├── constructed_message_body.py ├── constructor_answer.py ├── constructor_input.py ├── contact_attachment.py ├── contact_attachment_payload.py ├── contact_attachment_request.py ├── contact_attachment_request_payload.py ├── emphasized_markup.py ├── error.py ├── file_attachment.py ├── file_attachment_payload.py ├── file_attachment_request.py ├── get_pinned_message_result.py ├── get_subscriptions_result.py ├── heading_markup.py ├── highlighted_markup.py ├── image.py ├── inline_keyboard_attachment.py ├── inline_keyboard_attachment_request.py ├── inline_keyboard_attachment_request_payload.py ├── intent.py ├── keyboard.py ├── link_button.py ├── link_markup.py ├── linked_message.py ├── location_attachment.py ├── location_attachment_request.py ├── markup_element.py ├── media_attachment_payload.py ├── message.py ├── message_body.py ├── message_callback_update.py ├── message_chat_created_update.py ├── message_constructed_update.py ├── message_construction_request.py ├── message_constructor_input.py ├── message_created_update.py ├── message_edited_update.py ├── message_link_type.py ├── message_list.py ├── message_removed_update.py ├── message_stat.py ├── monospaced_markup.py ├── new_message_body.py ├── new_message_link.py ├── photo_attachment.py ├── photo_attachment_payload.py ├── photo_attachment_request.py ├── photo_attachment_request_payload.py ├── photo_token.py ├── photo_tokens.py ├── pin_message_body.py ├── recipient.py ├── request_contact_button.py ├── request_geo_location_button.py ├── send_message_result.py ├── sender_action.py ├── share_attachment.py ├── share_attachment_payload.py ├── share_attachment_request.py ├── simple_query_result.py ├── sticker_attachment.py ├── sticker_attachment_payload.py ├── sticker_attachment_request.py ├── sticker_attachment_request_payload.py ├── strikethrough_markup.py ├── strong_markup.py ├── subscription.py ├── subscription_request_body.py ├── text_format.py ├── underline_markup.py ├── update.py ├── update_list.py ├── upload_endpoint.py ├── upload_type.py ├── uploaded_info.py ├── user.py ├── user_added_to_chat_update.py ├── user_ids_list.py ├── user_mention_markup.py ├── user_removed_from_chat_update.py ├── user_with_photo.py ├── video_attachment.py └── video_attachment_request.py ├── rest.py └── utl.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | .pytest_cache/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | db.sqlite3 58 | 59 | # Flask stuff: 60 | instance/ 61 | .webassets-cache 62 | 63 | # Scrapy stuff: 64 | .scrapy 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # PyBuilder 70 | target/ 71 | 72 | # Jupyter Notebook 73 | .ipynb_checkpoints 74 | 75 | # pyenv 76 | .python-version 77 | 78 | # celery beat schedule file 79 | celerybeat-schedule 80 | 81 | # SageMath parsed files 82 | *.sage.py 83 | 84 | # Environments 85 | .env 86 | .venv 87 | env/ 88 | venv/ 89 | ENV/ 90 | env.bak/ 91 | venv.bak/ 92 | 93 | # Spyder project settings 94 | .spyderproject 95 | .spyproject 96 | 97 | # Rope project settings 98 | .ropeproject 99 | 100 | # mkdocs documentation 101 | /site 102 | 103 | # mypy 104 | .mypy_cache/ 105 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and get_external_name of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TamTam openapi_client. Python 2 and 3 compatibility 2 | Клиент бота для ТамТам на основе OpenAPI JSON schema for TamTam Bot API https://github.com/tamtam-chat/tamtam-bot-api-schema 3 | *** 4 | Можно использовать напрямую, а можно через оболочку TamTamBot для удобства: https://github.com/asvbkr/TamTamBot 5 | *** 6 | Первичная генерация - https://openapi-generator.tech/docs/generators.html 7 | *** 8 | Требует наличия пакетов: six, certifi, urllib3 9 | -------------------------------------------------------------------------------- /api/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | # flake8: noqa 4 | 5 | # import apis into api package 6 | from openapi_client.api.bots_api import BotsApi 7 | from openapi_client.api.chats_api import ChatsApi 8 | from openapi_client.api.messages_api import MessagesApi 9 | from openapi_client.api.subscriptions_api import SubscriptionsApi 10 | from openapi_client.api.upload_api import UploadApi 11 | -------------------------------------------------------------------------------- /models/bot_info.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | TamTam Bot API 5 | 6 | # About Bot API allows bots to interact with TamTam. Methods are called by sending HTTPS requests to [botapi.tamtam.chat](https://botapi.tamtam.chat) domain. Bots are third-party applications that use TamTam features. A bot can legitimately take part in a conversation. It can be achieved through HTTP requests to the TamTam Bot API. ## Features TamTam bots of the current version are able to: - Communicate with users and respond to requests - Recommend users complete actions via programmed buttons - Request personal data from users (name, short reference, phone number) We'll keep working on expanding bot capabilities in the future. ## Examples Bots can be used for the following purposes: - Providing support, answering frequently asked questions - Sending typical information - Voting - Likes/dislikes - Following external links - Forwarding a user to a chat/channel ## @PrimeBot [PrimeBot](https://tt.me/primebot) is the main bot in TamTam, all bots creator. Use PrimeBot to create and edit your bots. Feel free to contact us for any questions, [@support](https://tt.me/support) or [team@tamtam.chat](mailto:team@tamtam.chat). ## HTTP verbs `GET` — getting resources, parameters are transmitted via URL `POST` — creation of resources (for example, sending new messages) `PUT` — editing resources `DELETE` — deleting resources `PATCH` — patching resources ## HTTP response codes `200` — successful operation `400` — invalid request `401` — authentication error `404` — resource not found `405` — method is not allowed `429` — the number of requests is exceeded `503` — service unavailable ## Resources format For content requests (PUT and POST) and responses, the API uses the JSON format. All strings are UTF-8 encoded. Date/time fields are represented as the number of milliseconds that have elapsed since 00:00 January 1, 1970 in the long format. To get it, you can simply multiply the UNIX timestamp by 1000. All date/time fields have a UTC timezone. ## Error responses In case of an error, the API returns a response with the corresponding HTTP code and JSON with the following fields: `code` - the string with the error key `message` - a string describing the error
For example: ```bash > http https://botapi.tamtam.chat/chats?access_token={EXAMPLE_TOKEN} HTTP / 1.1 403 Forbidden Cache-Control: no-cache Connection: Keep-Alive Content-Length: 57 Content-Type: application / json; charset = utf-8 Set-Cookie: web_ui_lang = ru; Path = /; Domain = .tamtam.chat; Expires = 2019-03-24T11: 45: 36.500Z { \"code\": \"verify.token\", \"message\": \"Invalid access_token\" } ``` ## Receiving notifications TamTam Bot API supports 2 options of receiving notifications on new events for bots: - Push notifications via WebHook. To receive data via WebHook, you'll have to [add subscription](https://dev.tamtam.chat/#operation/subscribe); - Notifications upon request via [long polling](#operation/getUpdates) API. All data can be received via long polling **by default** after creating the bot. Both methods **cannot** be used simultaneously. Refer to the response schema of [/updates](https://dev.tamtam.chat/#operation/getUpdates) method to check all available types of updates. ### Webhook There is some notes about how we handle webhook subscription: 1. Sometimes webhook notification cannot be delivered in case when bot server or network is down. In such case we well retry delivery in a short period of time (from 30 to 60 seconds) and will do this until get `200 OK` status code from your server, but not longer than **8 hours** (*may change over time*) since update happened. We also consider any non `200`-response from server as failed delivery. 2. To protect your bot from unexpected high load we send **no more than 100** notifications per second by default. If you want increase this limit, contact us at [@support](https://tt.me/support). It should be from one of the following subnets: ``` 185.16.150.0/30 185.16.150.84/30 185.16.150.152/30 185.16.150.192/30 ``` ## Message buttons You can program buttons for users answering a bot. TamTam supports the following types of buttons: `callback` — sends a notification with payload to a bot (via WebHook or long polling) `link` — makes a user to follow a link `request_contact` — requests the user permission to access contact information (phone number, short link, email) `request_geo_location` — asks user to provide current geo location `chat` — creates chat associated with message To start create buttons [send message](#operation/sendMessage) with `InlineKeyboardAttachment`: ```json { \"text\": \"It is message with inline keyboard\", \"attachments\": [ { \"type\": \"inline_keyboard\", \"payload\": { \"buttons\": [ [ { \"type\": \"callback\", \"text\": \"Press me!\", \"payload\": \"button1 pressed\" } ], [ { \"type\": \"chat\", \"text\": \"Discuss\", \"chat_title\": \"Message discussion\" } ] ] } } ] } ``` ### Chat button Chat button is a button that starts chat assosiated with the current message. It will be **private** chat with a link, bot will be added as administrator by default. Chat will be created as soon as the first user taps on button. Bot will receive `message_chat_created` update. Bot can set title and description of new chat by setting `chat_title` and `chat_description` properties. Whereas keyboard can contain several `chat`-buttons there is `uuid` property to distinct them between each other. In case you do not pass `uuid` we will generate it. If you edit message, pass `uuid` so we know that this button starts the same chat as before. Chat button also can contain `start_payload` that will be sent to bot as part of `message_chat_created` update. ## Deep linking TamTam supports deep linking mechanism for bots. It allows passing additional payload to the bot on startup. Deep link can contain any data encoded into string up to **128** characters long. Longer strings will be omitted and **not** passed to the bot. Each bot has start link that looks like: ``` https://tt.me/%BOT_USERNAME%/start/%PAYLOAD% ``` As soon as user clicks on such link we open dialog with bot and send this payload to bot as part of `bot_started` update: ```json { \"update_type\": \"bot_started\", \"timestamp\": 1573226679188, \"chat_id\": 1234567890, \"user\": { \"user_id\": 1234567890, \"name\": \"Boris\", \"username\": \"borisd84\" }, \"payload\": \"any data meaningful to bot\" } ``` Deep linking mechanism is supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Constructors Constructor is a bot that can create a message for user: add buttons, attach some media, insert text. You can enable constructor mode for your bot via [@PrimeBot](https://tt.me/primebot) sending [/constructor_mode](https://tt.me/primebot/start/constructor_mode) command. For bot developers, it looks like request-response interaction where TamTam application sends `message_construction_request` on behalf of user. Bot [responds](#operation/construct) to it with `messages` ready to go or `keyboard` in case it requires further action from user. Bot also can set up UI parts such as `hint` or `placeholder`, allow or not user's input: ![Constructor UI parts](https://dev.tamtam.chat/static/hint-079a332a51a2e9e6d415ec716389661b.png) As soon as user finishes composing a message, they can post it. Bot will receive `message_constructed_update` with posted message. Constructors are supported for iOS version 2.7.0 and Android 2.9.0 and higher. # Versioning API models and interface may change over time. To make sure your bot will get the right info, we strongly recommend adding API version number to each request. You can add it as `v` parameter to each HTTP-request. For instance, `v=0.1.2`. To specify the data model version you are getting through WebHook subscription, use the `version` property in the request body of the [subscribe](https://dev.tamtam.chat/#operation/subscribe) request. # Libraries We have developed the official [Java client](https://github.com/tamtam-chat/tamtam-bot-api) and [SDK](https://github.com/tamtam-chat/tamtam-bot-sdk). Also check out unofficial libraries, created by our enthusiasts: - [Kotlin DSL client](https://github.com/Namazed/TamTamBotApiClientDsl) - [GO client](https://github.com/neonxp/tamtam) - [Node.js module](https://github.com/vershininivan/node-tamtam-botapi) #### Python: - [Python client](https://github.com/asvbkr/openapi_client) - [tamtam.py](https://github.com/uwinx/tamtam.py) - [registriren/botapitamtam](https://github.com/registriren/botapitamtam) # Changelog ##### Version 0.3.0 - Added methods to [pin](#operation/pinMessage)/[unpin](#operation/unpinMessage) messages in chats/channels - Added `is_bot` flag to [`User`](#tag/user_model) model Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.1..v0.3.0) for this release. ##### Version 0.2.1 - [Added](#operation/getChatByLink) method to get chat by its `@link` - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR1240) `description` for users in some cases - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR2555) `user_locale` to `message_created` update in dialogs Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..v0.2.1) for this release. ##### Version 0.2.0 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/09c95259d6c8c424f82b50eab93872e7db2ca208) new type of button to start new chat - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ea4581d83d7132663d6cc5c2c61c058a2bd46aac) Constructors API that allows bots to create message on behalf of a user - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/c5ff03175407819aceebd9c25de49eed566a0ce1) support for deep-links - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ff4cc4f93662d6c25db11fac72d9fcbf1f66cad8) ability to block users in chats - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/b965bfb0d02933e819435312e6ab184a3dfc0250) `chat_id` and `user_id` to `message_removed` update - Added meta information for video attachments - Other minor improvements and fixes. Check out complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.1.11...v0.1.10) for this version ##### Version 0.1.10 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/a9ef3a1b8f4e1a75b55a9b80877eddc2c6f07ec4) `disable_link_preview` parameter to POST:/messages method to disable links parsing in text - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/eb99e8ab97b55fa196d9957fca34d2316a4ca8aa) `sending_file` action - [Removed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/7a5ab5f0ea1336b3460d1827a6a7b3b141e19776) several deprecated properties - `photo` upload type [renamed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/74505883e6acb306686a6d141414aeaf5131ef49) to `image`. *C* is for consistency To see changelog for older versions visit our [GitHub](https://github.com/tamtam-chat/tamtam-bot-api-schema/releases). # noqa: E501 7 | 8 | OpenAPI spec version: 0.3.0 9 | Generated by: https://openapi-generator.tech 10 | """ 11 | 12 | import pprint 13 | 14 | import six 15 | 16 | from .user_with_photo import UserWithPhoto 17 | 18 | 19 | class BotInfo(UserWithPhoto): 20 | """NOTE: This class is auto generated by OpenAPI Generator. 21 | Ref: https://openapi-generator.tech 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | openapi_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | openapi_types = { 34 | 'description': 'str', 35 | 'user_id': 'int', 36 | 'name': 'str', 37 | 'username': 'str', 38 | 'is_bot': 'bool', 39 | 'last_activity_time': int, 40 | 'avatar_url': 'str', 41 | 'full_avatar_url': 'str', 42 | 'commands': 'list[BotCommand]' 43 | } 44 | 45 | attribute_map = { 46 | 'description': 'description', 47 | 'user_id': 'user_id', 48 | 'name': 'name', 49 | 'username': 'username', 50 | 'is_bot': 'is_bot', 51 | 'last_activity_time': 'last_activity_time', 52 | 'avatar_url': 'avatar_url', 53 | 'full_avatar_url': 'full_avatar_url', 54 | 'commands': 'commands' 55 | } 56 | 57 | def __init__(self, description=None, user_id=None, name=None, username=None, is_bot=None, last_activity_time=None, avatar_url=None, full_avatar_url=None, commands=None): # noqa: E501 58 | """BotInfo - a model defined in OpenAPI""" # noqa: E501 59 | 60 | super(BotInfo, self).__init__(description, user_id, name, username, is_bot, last_activity_time, avatar_url, full_avatar_url) 61 | self._commands = None 62 | self.discriminator = None 63 | 64 | self.commands = commands 65 | 66 | @property 67 | def commands(self): 68 | """Gets the commands of this BotInfo. # noqa: E501 69 | 70 | Commands supported by bot # noqa: E501 71 | 72 | :return: The commands of this BotInfo. # noqa: E501 73 | :rtype: list[BotCommand] 74 | """ 75 | return self._commands 76 | 77 | @commands.setter 78 | def commands(self, commands): 79 | """Sets the commands of this BotInfo. 80 | 81 | Commands supported by bot # noqa: E501 82 | 83 | :param commands: The commands of this BotInfo. # noqa: E501 84 | :type: list[BotCommand] 85 | """ 86 | 87 | self._commands = commands 88 | 89 | def to_dict(self): 90 | """Returns the model properties as a dict""" 91 | result = {} 92 | 93 | for attr, _ in six.iteritems(self.openapi_types): 94 | value = getattr(self, attr) 95 | if isinstance(value, list): 96 | result[attr] = list(map( 97 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 98 | value 99 | )) 100 | elif hasattr(value, "to_dict"): 101 | result[attr] = value.to_dict() 102 | elif isinstance(value, dict): 103 | result[attr] = dict(map( 104 | lambda item: (item[0], item[1].to_dict()) 105 | if hasattr(item[1], "to_dict") else item, 106 | value.items() 107 | )) 108 | else: 109 | result[attr] = value 110 | 111 | return result 112 | 113 | def to_str(self): 114 | """Returns the string representation of the model""" 115 | return pprint.pformat(self.to_dict()) 116 | 117 | def __repr__(self): 118 | """For `print` and `pprint`""" 119 | return self.to_str() 120 | 121 | def __eq__(self, other): 122 | """Returns true if both objects are equal""" 123 | if not isinstance(other, BotInfo): 124 | return False 125 | 126 | return self.__dict__ == other.__dict__ 127 | 128 | def __ne__(self, other): 129 | """Returns true if both objects are not equal""" 130 | return not self == other 131 | -------------------------------------------------------------------------------- /models/chat_admin_permission.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | TamTam Bot API 5 | 6 | # About Bot API allows bots to interact with TamTam. Methods are called by sending HTTPS requests to [botapi.tamtam.chat](https://botapi.tamtam.chat) domain. Bots are third-party applications that use TamTam features. A bot can legitimately take part in a conversation. It can be achieved through HTTP requests to the TamTam Bot API. ## Features TamTam bots of the current version are able to: - Communicate with users and respond to requests - Recommend users complete actions via programmed buttons - Request personal data from users (name, short reference, phone number) We'll keep working on expanding bot capabilities in the future. ## Examples Bots can be used for the following purposes: - Providing support, answering frequently asked questions - Sending typical information - Voting - Likes/dislikes - Following external links - Forwarding a user to a chat/channel ## @PrimeBot [PrimeBot](https://tt.me/primebot) is the main bot in TamTam, all bots creator. Use PrimeBot to create and edit your bots. Feel free to contact us for any questions, [@support](https://tt.me/support) or [team@tamtam.chat](mailto:team@tamtam.chat). ## HTTP verbs `GET` — getting resources, parameters are transmitted via URL `POST` — creation of resources (for example, sending new messages) `PUT` — editing resources `DELETE` — deleting resources `PATCH` — patching resources ## HTTP response codes `200` — successful operation `400` — invalid request `401` — authentication error `404` — resource not found `405` — method is not allowed `429` — the number of requests is exceeded `503` — service unavailable ## Resources format For content requests (PUT and POST) and responses, the API uses the JSON format. All strings are UTF-8 encoded. Date/time fields are represented as the number of milliseconds that have elapsed since 00:00 January 1, 1970 in the long format. To get it, you can simply multiply the UNIX timestamp by 1000. All date/time fields have a UTC timezone. ## Error responses In case of an error, the API returns a response with the corresponding HTTP code and JSON with the following fields: `code` - the string with the error key `message` - a string describing the error
For example: ```bash > http https://botapi.tamtam.chat/chats?access_token={EXAMPLE_TOKEN} HTTP / 1.1 403 Forbidden Cache-Control: no-cache Connection: Keep-Alive Content-Length: 57 Content-Type: application / json; charset = utf-8 Set-Cookie: web_ui_lang = ru; Path = /; Domain = .tamtam.chat; Expires = 2019-03-24T11: 45: 36.500Z { \"code\": \"verify.token\", \"message\": \"Invalid access_token\" } ``` ## Receiving notifications TamTam Bot API supports 2 options of receiving notifications on new events for bots: - Push notifications via WebHook. To receive data via WebHook, you'll have to [add subscription](https://dev.tamtam.chat/#operation/subscribe); - Notifications upon request via [long polling](#operation/getUpdates) API. All data can be received via long polling **by default** after creating the bot. Both methods **cannot** be used simultaneously. Refer to the response schema of [/updates](https://dev.tamtam.chat/#operation/getUpdates) method to check all available types of updates. ### Webhook There is some notes about how we handle webhook subscription: 1. Sometimes webhook notification cannot be delivered in case when bot server or network is down. In such case we well retry delivery in a short period of time (from 30 to 60 seconds) and will do this until get `200 OK` status code from your server, but not longer than **8 hours** (*may change over time*) since update happened. We also consider any non `200`-response from server as failed delivery. 2. To protect your bot from unexpected high load we send **no more than 100** notifications per second by default. If you want increase this limit, contact us at [@support](https://tt.me/support). It should be from one of the following subnets: ``` 185.16.150.0/30 185.16.150.84/30 185.16.150.152/30 185.16.150.192/30 ``` ## Message buttons You can program buttons for users answering a bot. TamTam supports the following types of buttons: `callback` — sends a notification with payload to a bot (via WebHook or long polling) `link` — makes a user to follow a link `request_contact` — requests the user permission to access contact information (phone number, short link, email) `request_geo_location` — asks user to provide current geo location `chat` — creates chat associated with message To start create buttons [send message](#operation/sendMessage) with `InlineKeyboardAttachment`: ```json { \"text\": \"It is message with inline keyboard\", \"attachments\": [ { \"type\": \"inline_keyboard\", \"payload\": { \"buttons\": [ [ { \"type\": \"callback\", \"text\": \"Press me!\", \"payload\": \"button1 pressed\" } ], [ { \"type\": \"chat\", \"text\": \"Discuss\", \"chat_title\": \"Message discussion\" } ] ] } } ] } ``` ### Chat button Chat button is a button that starts chat assosiated with the current message. It will be **private** chat with a link, bot will be added as administrator by default. Chat will be created as soon as the first user taps on button. Bot will receive `message_chat_created` update. Bot can set title and description of new chat by setting `chat_title` and `chat_description` properties. Whereas keyboard can contain several `chat`-buttons there is `uuid` property to distinct them between each other. In case you do not pass `uuid` we will generate it. If you edit message, pass `uuid` so we know that this button starts the same chat as before. Chat button also can contain `start_payload` that will be sent to bot as part of `message_chat_created` update. ## Deep linking TamTam supports deep linking mechanism for bots. It allows passing additional payload to the bot on startup. Deep link can contain any data encoded into string up to **128** characters long. Longer strings will be omitted and **not** passed to the bot. Each bot has start link that looks like: ``` https://tt.me/%BOT_USERNAME%/start/%PAYLOAD% ``` As soon as user clicks on such link we open dialog with bot and send this payload to bot as part of `bot_started` update: ```json { \"update_type\": \"bot_started\", \"timestamp\": 1573226679188, \"chat_id\": 1234567890, \"user\": { \"user_id\": 1234567890, \"name\": \"Boris\", \"username\": \"borisd84\" }, \"payload\": \"any data meaningful to bot\" } ``` Deep linking mechanism is supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Constructors Constructor is a bot that can create a message for user: add buttons, attach some media, insert text. You can enable constructor mode for your bot via [@PrimeBot](https://tt.me/primebot) sending [/constructor_mode](https://tt.me/primebot/start/constructor_mode) command. For bot developers, it looks like request-response interaction where TamTam application sends `message_construction_request` on behalf of user. Bot [responds](#operation/construct) to it with `messages` ready to go or `keyboard` in case it requires further action from user. Bot also can set up UI parts such as `hint` or `placeholder`, allow or not user's input: ![Constructor UI parts](https://dev.tamtam.chat/static/hint-079a332a51a2e9e6d415ec716389661b.png) As soon as user finishes composing a message, they can post it. Bot will receive `message_constructed_update` with posted message. Constructors are supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Text formatting Message text can be improved with basic formatting such as: **strong**, *emphasis*, ~strikethough~, underline, `code` or link. You can use either markdown-like or HTML formatting. To enable text formatting set the `format` property of [NewMessageBody](#tag/new_message_model). ### TamTam flavored Markdown To enable [Markdown](https://spec.commonmark.org/0.29/) parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `markdown`. We currently support only the following syntax: `*empasized*` or `_empasized_` for *italic* text `**strong**` or `__strong__` for __bold__ text `~~strikethough~~` for ~strikethough~ text `++underline++` for underlined text ``` `code` ``` or ` ```code``` ` for `monospaced` text `^^important^^` for highlighted text (colored in red, by default) `[Inline URL](https://dev.tamtam.chat/)` for inline URLs `[User mention](tamtam://user/%user_id%)` for user mentions without username ### HTML support To enable HTML parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `html`. Only the following HTML tags are supported. All others will be stripped: Emphasized: `` or `` Strong: `` or `` Strikethrough: `` or `` Underlined: `` or `` Link: `Docs` Monospaced text: `
` or ``  Highlighted text: ``  Text formatting is supported for iOS since version 3.1 and Android since 2.20.0.  # Versioning API models and interface may change over time. To make sure your bot will get the right info, we strongly recommend adding API version number to each request. You can add it as `v` parameter to each HTTP-request. For instance, `v=0.1.2`. To specify the data model version you are getting through WebHook subscription, use the `version` property in the request body of the [subscribe](https://dev.tamtam.chat/#operation/subscribe) request.  # Libraries We have developed the official [Java client](https://github.com/tamtam-chat/tamtam-bot-api) and [SDK](https://github.com/tamtam-chat/tamtam-bot-sdk).  Also check out unofficial libraries, created by our enthusiasts: - [Kotlin DSL client](https://github.com/Namazed/TamTamBotApiClientDsl) - [GO client](https://github.com/neonxp/tamtam) - [Node.js module](https://github.com/vershininivan/node-tamtam-botapi)  #### Python: - [Python client](https://github.com/asvbkr/openapi_client) - [tamtam.py](https://github.com/uwinx/tamtam.py) - [registriren/botapitamtam](https://github.com/registriren/botapitamtam)  # Changelog ##### Version 0.3.0 - Added methods to [pin](#operation/pinMessage)/[unpin](#operation/unpinMessage) messages in chats/channels - Added `is_bot` flag to [`User`](#tag/user_model) model  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.1..v0.3.0) for this release.  ##### Version 0.2.1 - [Added](#operation/getChatByLink) method to get chat by its `@link` - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR1240) `description` for users in some cases - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR2555) `user_locale` to `message_created` update in dialogs  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..v0.2.1) for this release.  ##### Version 0.2.0 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/09c95259d6c8c424f82b50eab93872e7db2ca208) new type of button to start new chat - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ea4581d83d7132663d6cc5c2c61c058a2bd46aac) Constructors API that allows bots to create message on behalf of a user - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/c5ff03175407819aceebd9c25de49eed566a0ce1) support for deep-links - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ff4cc4f93662d6c25db11fac72d9fcbf1f66cad8) ability to block users in chats - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/b965bfb0d02933e819435312e6ab184a3dfc0250) `chat_id` and `user_id` to `message_removed` update - Added meta information for video attachments - Other minor improvements and fixes. Check out complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.1.11...v0.1.10) for this version  ##### Version 0.1.10 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/a9ef3a1b8f4e1a75b55a9b80877eddc2c6f07ec4) `disable_link_preview` parameter to POST:/messages method to disable links parsing in text - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/eb99e8ab97b55fa196d9957fca34d2316a4ca8aa) `sending_file` action - [Removed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/7a5ab5f0ea1336b3460d1827a6a7b3b141e19776) several deprecated properties - `photo` upload type [renamed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/74505883e6acb306686a6d141414aeaf5131ef49) to `image`. *C* is for consistency  To see changelog for older versions visit our [GitHub](https://github.com/tamtam-chat/tamtam-bot-api-schema/releases).  # noqa: E501
 7 | 
 8 |     OpenAPI spec version: 0.5.2
 9 |     Generated by: https://openapi-generator.tech
10 | """
11 | 
12 | 
13 | import pprint
14 | import re  # noqa: F401
15 | 
16 | import six
17 | 
18 | 
19 | class ChatAdminPermission(object):
20 |     """NOTE: This class is auto generated by OpenAPI Generator.
21 |     Ref: https://openapi-generator.tech
22 | 
23 |     Do not edit the class manually.
24 |     """
25 | 
26 |     """
27 |     allowed enum values
28 |     """
29 |     READ_ALL_MESSAGES = "read_all_messages"
30 |     ADD_REMOVE_MEMBERS = "add_remove_members"
31 |     ADD_ADMINS = "add_admins"
32 |     CHANGE_CHAT_INFO = "change_chat_info"
33 |     PIN_MESSAGE = "pin_message"
34 |     WRITE = "write"
35 | 
36 |     """
37 |     Attributes:
38 |       openapi_types (dict): The key is attribute name
39 |                             and the value is attribute type.
40 |       attribute_map (dict): The key is attribute name
41 |                             and the value is json key in definition.
42 |     """
43 |     openapi_types = {
44 |     }
45 | 
46 |     attribute_map = {
47 |     }
48 | 
49 |     def __init__(self):  # noqa: E501
50 |         """ChatAdminPermission - a model defined in OpenAPI"""  # noqa: E501
51 |         self.discriminator = None
52 | 
53 |     def to_dict(self):
54 |         """Returns the model properties as a dict"""
55 |         result = {}
56 | 
57 |         for attr, _ in six.iteritems(self.openapi_types):
58 |             value = getattr(self, attr)
59 |             if isinstance(value, list):
60 |                 result[attr] = list(map(
61 |                     lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
62 |                     value
63 |                 ))
64 |             elif hasattr(value, "to_dict"):
65 |                 result[attr] = value.to_dict()
66 |             elif isinstance(value, dict):
67 |                 result[attr] = dict(map(
68 |                     lambda item: (item[0], item[1].to_dict())
69 |                     if hasattr(item[1], "to_dict") else item,
70 |                     value.items()
71 |                 ))
72 |             else:
73 |                 result[attr] = value
74 | 
75 |         return result
76 | 
77 |     def to_str(self):
78 |         """Returns the string representation of the model"""
79 |         return pprint.pformat(self.to_dict())
80 | 
81 |     def __repr__(self):
82 |         """For `print` and `pprint`"""
83 |         return self.to_str()
84 | 
85 |     def __eq__(self, other):
86 |         """Returns true if both objects are equal"""
87 |         if not isinstance(other, ChatAdminPermission):
88 |             return False
89 | 
90 |         return self.__dict__ == other.__dict__
91 | 
92 |     def __ne__(self, other):
93 |         """Returns true if both objects are not equal"""
94 |         return not self == other
95 | 


--------------------------------------------------------------------------------
/models/chat_status.py:
--------------------------------------------------------------------------------
 1 | # coding: utf-8
 2 | 
 3 | """
 4 |     TamTam Bot API
 5 | 
 6 |     # About Bot API allows bots to interact with TamTam. Methods are called by sending HTTPS requests to [botapi.tamtam.chat](https://botapi.tamtam.chat) domain. Bots are third-party applications that use TamTam features. A bot can legitimately take part in a conversation. It can be achieved through HTTP requests to the TamTam Bot API.  ## Features TamTam bots of the current version are able to: - Communicate with users and respond to requests - Recommend users complete actions via programmed buttons - Request personal data from users (name, short reference, phone number) We'll keep working on expanding bot capabilities in the future.  ## Examples Bots can be used for the following purposes: - Providing support, answering frequently asked questions - Sending typical information - Voting - Likes/dislikes - Following external links - Forwarding a user to a chat/channel  ## @PrimeBot [PrimeBot](https://tt.me/primebot) is the main bot in TamTam, all bots creator. Use PrimeBot to create and edit your bots. Feel free to contact us for any questions, [@support](https://tt.me/support) or [team@tamtam.chat](mailto:team@tamtam.chat).  ## HTTP verbs `GET` — getting resources, parameters are transmitted via URL  `POST` — creation of resources (for example, sending new messages)  `PUT` — editing resources  `DELETE` — deleting resources  `PATCH` — patching resources  ## HTTP response codes `200` — successful operation  `400` — invalid request  `401` — authentication error  `404` — resource not found  `405` — method is not allowed  `429` — the number of requests is exceeded  `503` — service unavailable  ## Resources format For content requests (PUT and POST) and responses, the API uses the JSON format. All strings are UTF-8 encoded. Date/time fields are represented as the number of milliseconds that have elapsed since 00:00 January 1, 1970 in the long format. To get it, you can simply multiply the UNIX timestamp by 1000. All date/time fields have a UTC timezone. ## Error responses In case of an error, the API returns a response with the corresponding HTTP code and JSON with the following fields:  `code` - the string with the error key  `message` - a string describing the error 
For example: ```bash > http https://botapi.tamtam.chat/chats?access_token={EXAMPLE_TOKEN} HTTP / 1.1 403 Forbidden Cache-Control: no-cache Connection: Keep-Alive Content-Length: 57 Content-Type: application / json; charset = utf-8 Set-Cookie: web_ui_lang = ru; Path = /; Domain = .tamtam.chat; Expires = 2019-03-24T11: 45: 36.500Z { \"code\": \"verify.token\", \"message\": \"Invalid access_token\" } ``` ## Receiving notifications TamTam Bot API supports 2 options of receiving notifications on new events for bots: - Push notifications via WebHook. To receive data via WebHook, you'll have to [add subscription](https://dev.tamtam.chat/#operation/subscribe); - Notifications upon request via [long polling](#operation/getUpdates) API. All data can be received via long polling **by default** after creating the bot. Both methods **cannot** be used simultaneously. Refer to the response schema of [/updates](https://dev.tamtam.chat/#operation/getUpdates) method to check all available types of updates. ### Webhook There is some notes about how we handle webhook subscription: 1. Sometimes webhook notification cannot be delivered in case when bot server or network is down. In such case we well retry delivery in a short period of time (from 30 to 60 seconds) and will do this until get `200 OK` status code from your server, but not longer than **8 hours** (*may change over time*) since update happened. We also consider any non `200`-response from server as failed delivery. 2. To protect your bot from unexpected high load we send **no more than 100** notifications per second by default. If you want increase this limit, contact us at [@support](https://tt.me/support). It should be from one of the following subnets: ``` 185.16.150.0/30 185.16.150.84/30 185.16.150.152/30 185.16.150.192/30 ``` ## Message buttons You can program buttons for users answering a bot. TamTam supports the following types of buttons: `callback` — sends a notification with payload to a bot (via WebHook or long polling) `link` — makes a user to follow a link `request_contact` — requests the user permission to access contact information (phone number, short link, email) `request_geo_location` — asks user to provide current geo location `chat` — creates chat associated with message To start create buttons [send message](#operation/sendMessage) with `InlineKeyboardAttachment`: ```json { \"text\": \"It is message with inline keyboard\", \"attachments\": [ { \"type\": \"inline_keyboard\", \"payload\": { \"buttons\": [ [ { \"type\": \"callback\", \"text\": \"Press me!\", \"payload\": \"button1 pressed\" } ], [ { \"type\": \"chat\", \"text\": \"Discuss\", \"chat_title\": \"Message discussion\" } ] ] } } ] } ``` ### Chat button Chat button is a button that starts chat assosiated with the current message. It will be **private** chat with a link, bot will be added as administrator by default. Chat will be created as soon as the first user taps on button. Bot will receive `message_chat_created` update. Bot can set title and description of new chat by setting `chat_title` and `chat_description` properties. Whereas keyboard can contain several `chat`-buttons there is `uuid` property to distinct them between each other. In case you do not pass `uuid` we will generate it. If you edit message, pass `uuid` so we know that this button starts the same chat as before. Chat button also can contain `start_payload` that will be sent to bot as part of `message_chat_created` update. ## Deep linking TamTam supports deep linking mechanism for bots. It allows passing additional payload to the bot on startup. Deep link can contain any data encoded into string up to **128** characters long. Longer strings will be omitted and **not** passed to the bot. Each bot has start link that looks like: ``` https://tt.me/%BOT_USERNAME%/start/%PAYLOAD% ``` As soon as user clicks on such link we open dialog with bot and send this payload to bot as part of `bot_started` update: ```json { \"update_type\": \"bot_started\", \"timestamp\": 1573226679188, \"chat_id\": 1234567890, \"user\": { \"user_id\": 1234567890, \"name\": \"Boris\", \"username\": \"borisd84\" }, \"payload\": \"any data meaningful to bot\" } ``` Deep linking mechanism is supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Constructors Constructor is a bot that can create a message for user: add buttons, attach some media, insert text. You can enable constructor mode for your bot via [@PrimeBot](https://tt.me/primebot) sending [/constructor_mode](https://tt.me/primebot/start/constructor_mode) command. For bot developers, it looks like request-response interaction where TamTam application sends `message_construction_request` on behalf of user. Bot [responds](#operation/construct) to it with `messages` ready to go or `keyboard` in case it requires further action from user. Bot also can set up UI parts such as `hint` or `placeholder`, allow or not user's input: ![Constructor UI parts](https://dev.tamtam.chat/static/hint-079a332a51a2e9e6d415ec716389661b.png) As soon as user finishes composing a message, they can post it. Bot will receive `message_constructed_update` with posted message. Constructors are supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Text formatting Message text can be improved with basic formatting such as: **strong**, *emphasis*, ~strikethough~, underline, `code` or link. You can use either markdown-like or HTML formatting. To enable text formatting set the `format` property of [NewMessageBody](#tag/new_message_model). ### TamTam flavored Markdown To enable [Markdown](https://spec.commonmark.org/0.29/) parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `markdown`. We currently support only the following syntax: `*empasized*` or `_empasized_` for *italic* text `**strong**` or `__strong__` for __bold__ text `~~strikethough~~` for ~strikethough~ text `++underline++` for underlined text ``` `code` ``` or ` ```code``` ` for `monospaced` text `^^important^^` for highlighted text (colored in red, by default) `[Inline URL](https://dev.tamtam.chat/)` for inline URLs `[User mention](tamtam://user/%user_id%)` for user mentions without username ### HTML support To enable HTML parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `html`. Only the following HTML tags are supported. All others will be stripped: Emphasized: `` or `` Strong: `` or `` Strikethrough: `` or `` Underlined: `` or `` Link: `Docs` Monospaced text: `
` or ``  Highlighted text: ``  Text formatting is supported for iOS since version 3.1 and Android since 2.20.0.  # Versioning API models and interface may change over time. To make sure your bot will get the right info, we strongly recommend adding API version number to each request. You can add it as `v` parameter to each HTTP-request. For instance, `v=0.1.2`. To specify the data model version you are getting through WebHook subscription, use the `version` property in the request body of the [subscribe](https://dev.tamtam.chat/#operation/subscribe) request.  # Libraries We have developed the official [Java client](https://github.com/tamtam-chat/tamtam-bot-api) and [SDK](https://github.com/tamtam-chat/tamtam-bot-sdk).  Also check out unofficial libraries, created by our enthusiasts: - [Kotlin DSL client](https://github.com/Namazed/TamTamBotApiClientDsl) - [GO client](https://github.com/neonxp/tamtam) - [Node.js module](https://github.com/vershininivan/node-tamtam-botapi)  #### Python: - [Python client](https://github.com/asvbkr/openapi_client) - [tamtam.py](https://github.com/uwinx/tamtam.py) - [registriren/botapitamtam](https://github.com/registriren/botapitamtam)  # Changelog ##### Version 0.3.0 - Added methods to [pin](#operation/pinMessage)/[unpin](#operation/unpinMessage) messages in chats/channels - Added `is_bot` flag to [`User`](#tag/user_model) model  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.1..v0.3.0) for this release.  ##### Version 0.2.1 - [Added](#operation/getChatByLink) method to get chat by its `@link` - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR1240) `description` for users in some cases - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR2555) `user_locale` to `message_created` update in dialogs  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..v0.2.1) for this release.  ##### Version 0.2.0 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/09c95259d6c8c424f82b50eab93872e7db2ca208) new type of button to start new chat - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ea4581d83d7132663d6cc5c2c61c058a2bd46aac) Constructors API that allows bots to create message on behalf of a user - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/c5ff03175407819aceebd9c25de49eed566a0ce1) support for deep-links - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ff4cc4f93662d6c25db11fac72d9fcbf1f66cad8) ability to block users in chats - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/b965bfb0d02933e819435312e6ab184a3dfc0250) `chat_id` and `user_id` to `message_removed` update - Added meta information for video attachments - Other minor improvements and fixes. Check out complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.1.11...v0.1.10) for this version  ##### Version 0.1.10 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/a9ef3a1b8f4e1a75b55a9b80877eddc2c6f07ec4) `disable_link_preview` parameter to POST:/messages method to disable links parsing in text - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/eb99e8ab97b55fa196d9957fca34d2316a4ca8aa) `sending_file` action - [Removed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/7a5ab5f0ea1336b3460d1827a6a7b3b141e19776) several deprecated properties - `photo` upload type [renamed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/74505883e6acb306686a6d141414aeaf5131ef49) to `image`. *C* is for consistency  To see changelog for older versions visit our [GitHub](https://github.com/tamtam-chat/tamtam-bot-api-schema/releases).  # noqa: E501
 7 | 
 8 |     OpenAPI spec version: 0.5.2
 9 |     Generated by: https://openapi-generator.tech
10 | """
11 | 
12 | 
13 | import pprint
14 | import re  # noqa: F401
15 | 
16 | import six
17 | 
18 | 
19 | class ChatStatus(object):
20 |     """NOTE: This class is auto generated by OpenAPI Generator.
21 |     Ref: https://openapi-generator.tech
22 | 
23 |     Do not edit the class manually.
24 |     """
25 | 
26 |     """
27 |     allowed enum values
28 |     """
29 |     ACTIVE = "active"
30 |     REMOVED = "removed"
31 |     LEFT = "left"
32 |     CLOSED = "closed"
33 |     SUSPENDED = "suspended"
34 | 
35 |     """
36 |     Attributes:
37 |       openapi_types (dict): The key is attribute name
38 |                             and the value is attribute type.
39 |       attribute_map (dict): The key is attribute name
40 |                             and the value is json key in definition.
41 |     """
42 |     openapi_types = {
43 |     }
44 | 
45 |     attribute_map = {
46 |     }
47 | 
48 |     def __init__(self):  # noqa: E501
49 |         """ChatStatus - a model defined in OpenAPI"""  # noqa: E501
50 |         self.discriminator = None
51 | 
52 |     def to_dict(self):
53 |         """Returns the model properties as a dict"""
54 |         result = {}
55 | 
56 |         for attr, _ in six.iteritems(self.openapi_types):
57 |             value = getattr(self, attr)
58 |             if isinstance(value, list):
59 |                 result[attr] = list(map(
60 |                     lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
61 |                     value
62 |                 ))
63 |             elif hasattr(value, "to_dict"):
64 |                 result[attr] = value.to_dict()
65 |             elif isinstance(value, dict):
66 |                 result[attr] = dict(map(
67 |                     lambda item: (item[0], item[1].to_dict())
68 |                     if hasattr(item[1], "to_dict") else item,
69 |                     value.items()
70 |                 ))
71 |             else:
72 |                 result[attr] = value
73 | 
74 |         return result
75 | 
76 |     def to_str(self):
77 |         """Returns the string representation of the model"""
78 |         return pprint.pformat(self.to_dict())
79 | 
80 |     def __repr__(self):
81 |         """For `print` and `pprint`"""
82 |         return self.to_str()
83 | 
84 |     def __eq__(self, other):
85 |         """Returns true if both objects are equal"""
86 |         if not isinstance(other, ChatStatus):
87 |             return False
88 | 
89 |         return self.__dict__ == other.__dict__
90 | 
91 |     def __ne__(self, other):
92 |         """Returns true if both objects are not equal"""
93 |         return not self == other
94 | 


--------------------------------------------------------------------------------
/models/chat_type.py:
--------------------------------------------------------------------------------
 1 | # coding: utf-8
 2 | 
 3 | """
 4 |     TamTam Bot API
 5 | 
 6 |     # About Bot API allows bots to interact with TamTam. Methods are called by sending HTTPS requests to [botapi.tamtam.chat](https://botapi.tamtam.chat) domain. Bots are third-party applications that use TamTam features. A bot can legitimately take part in a conversation. It can be achieved through HTTP requests to the TamTam Bot API.  ## Features TamTam bots of the current version are able to: - Communicate with users and respond to requests - Recommend users complete actions via programmed buttons - Request personal data from users (name, short reference, phone number) We'll keep working on expanding bot capabilities in the future.  ## Examples Bots can be used for the following purposes: - Providing support, answering frequently asked questions - Sending typical information - Voting - Likes/dislikes - Following external links - Forwarding a user to a chat/channel  ## @PrimeBot [PrimeBot](https://tt.me/primebot) is the main bot in TamTam, all bots creator. Use PrimeBot to create and edit your bots. Feel free to contact us for any questions, [@support](https://tt.me/support) or [team@tamtam.chat](mailto:team@tamtam.chat).  ## HTTP verbs `GET` — getting resources, parameters are transmitted via URL  `POST` — creation of resources (for example, sending new messages)  `PUT` — editing resources  `DELETE` — deleting resources  `PATCH` — patching resources  ## HTTP response codes `200` — successful operation  `400` — invalid request  `401` — authentication error  `404` — resource not found  `405` — method is not allowed  `429` — the number of requests is exceeded  `503` — service unavailable  ## Resources format For content requests (PUT and POST) and responses, the API uses the JSON format. All strings are UTF-8 encoded. Date/time fields are represented as the number of milliseconds that have elapsed since 00:00 January 1, 1970 in the long format. To get it, you can simply multiply the UNIX timestamp by 1000. All date/time fields have a UTC timezone. ## Error responses In case of an error, the API returns a response with the corresponding HTTP code and JSON with the following fields:  `code` - the string with the error key  `message` - a string describing the error 
For example: ```bash > http https://botapi.tamtam.chat/chats?access_token={EXAMPLE_TOKEN} HTTP / 1.1 403 Forbidden Cache-Control: no-cache Connection: Keep-Alive Content-Length: 57 Content-Type: application / json; charset = utf-8 Set-Cookie: web_ui_lang = ru; Path = /; Domain = .tamtam.chat; Expires = 2019-03-24T11: 45: 36.500Z { \"code\": \"verify.token\", \"message\": \"Invalid access_token\" } ``` ## Receiving notifications TamTam Bot API supports 2 options of receiving notifications on new events for bots: - Push notifications via WebHook. To receive data via WebHook, you'll have to [add subscription](https://dev.tamtam.chat/#operation/subscribe); - Notifications upon request via [long polling](#operation/getUpdates) API. All data can be received via long polling **by default** after creating the bot. Both methods **cannot** be used simultaneously. Refer to the response schema of [/updates](https://dev.tamtam.chat/#operation/getUpdates) method to check all available types of updates. ### Webhook There is some notes about how we handle webhook subscription: 1. Sometimes webhook notification cannot be delivered in case when bot server or network is down. In such case we well retry delivery in a short period of time (from 30 to 60 seconds) and will do this until get `200 OK` status code from your server, but not longer than **8 hours** (*may change over time*) since update happened. We also consider any non `200`-response from server as failed delivery. 2. To protect your bot from unexpected high load we send **no more than 100** notifications per second by default. If you want increase this limit, contact us at [@support](https://tt.me/support). It should be from one of the following subnets: ``` 185.16.150.0/30 185.16.150.84/30 185.16.150.152/30 185.16.150.192/30 ``` ## Message buttons You can program buttons for users answering a bot. TamTam supports the following types of buttons: `callback` — sends a notification with payload to a bot (via WebHook or long polling) `link` — makes a user to follow a link `request_contact` — requests the user permission to access contact information (phone number, short link, email) `request_geo_location` — asks user to provide current geo location `chat` — creates chat associated with message To start create buttons [send message](#operation/sendMessage) with `InlineKeyboardAttachment`: ```json { \"text\": \"It is message with inline keyboard\", \"attachments\": [ { \"type\": \"inline_keyboard\", \"payload\": { \"buttons\": [ [ { \"type\": \"callback\", \"text\": \"Press me!\", \"payload\": \"button1 pressed\" } ], [ { \"type\": \"chat\", \"text\": \"Discuss\", \"chat_title\": \"Message discussion\" } ] ] } } ] } ``` ### Chat button Chat button is a button that starts chat assosiated with the current message. It will be **private** chat with a link, bot will be added as administrator by default. Chat will be created as soon as the first user taps on button. Bot will receive `message_chat_created` update. Bot can set title and description of new chat by setting `chat_title` and `chat_description` properties. Whereas keyboard can contain several `chat`-buttons there is `uuid` property to distinct them between each other. In case you do not pass `uuid` we will generate it. If you edit message, pass `uuid` so we know that this button starts the same chat as before. Chat button also can contain `start_payload` that will be sent to bot as part of `message_chat_created` update. ## Deep linking TamTam supports deep linking mechanism for bots. It allows passing additional payload to the bot on startup. Deep link can contain any data encoded into string up to **128** characters long. Longer strings will be omitted and **not** passed to the bot. Each bot has start link that looks like: ``` https://tt.me/%BOT_USERNAME%/start/%PAYLOAD% ``` As soon as user clicks on such link we open dialog with bot and send this payload to bot as part of `bot_started` update: ```json { \"update_type\": \"bot_started\", \"timestamp\": 1573226679188, \"chat_id\": 1234567890, \"user\": { \"user_id\": 1234567890, \"name\": \"Boris\", \"username\": \"borisd84\" }, \"payload\": \"any data meaningful to bot\" } ``` Deep linking mechanism is supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Constructors Constructor is a bot that can create a message for user: add buttons, attach some media, insert text. You can enable constructor mode for your bot via [@PrimeBot](https://tt.me/primebot) sending [/constructor_mode](https://tt.me/primebot/start/constructor_mode) command. For bot developers, it looks like request-response interaction where TamTam application sends `message_construction_request` on behalf of user. Bot [responds](#operation/construct) to it with `messages` ready to go or `keyboard` in case it requires further action from user. Bot also can set up UI parts such as `hint` or `placeholder`, allow or not user's input: ![Constructor UI parts](https://dev.tamtam.chat/static/hint-079a332a51a2e9e6d415ec716389661b.png) As soon as user finishes composing a message, they can post it. Bot will receive `message_constructed_update` with posted message. Constructors are supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Text formatting Message text can be improved with basic formatting such as: **strong**, *emphasis*, ~strikethough~, underline, `code` or link. You can use either markdown-like or HTML formatting. To enable text formatting set the `format` property of [NewMessageBody](#tag/new_message_model). ### TamTam flavored Markdown To enable [Markdown](https://spec.commonmark.org/0.29/) parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `markdown`. We currently support only the following syntax: `*empasized*` or `_empasized_` for *italic* text `**strong**` or `__strong__` for __bold__ text `~~strikethough~~` for ~strikethough~ text `++underline++` for underlined text ``` `code` ``` or ` ```code``` ` for `monospaced` text `^^important^^` for highlighted text (colored in red, by default) `[Inline URL](https://dev.tamtam.chat/)` for inline URLs `[User mention](tamtam://user/%user_id%)` for user mentions without username ### HTML support To enable HTML parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `html`. Only the following HTML tags are supported. All others will be stripped: Emphasized: `` or `` Strong: `` or `` Strikethrough: `` or `` Underlined: `` or `` Link: `Docs` Monospaced text: `
` or ``  Highlighted text: ``  Text formatting is supported for iOS since version 3.1 and Android since 2.20.0.  # Versioning API models and interface may change over time. To make sure your bot will get the right info, we strongly recommend adding API version number to each request. You can add it as `v` parameter to each HTTP-request. For instance, `v=0.1.2`. To specify the data model version you are getting through WebHook subscription, use the `version` property in the request body of the [subscribe](https://dev.tamtam.chat/#operation/subscribe) request.  # Libraries We have developed the official [Java client](https://github.com/tamtam-chat/tamtam-bot-api) and [SDK](https://github.com/tamtam-chat/tamtam-bot-sdk).  Also check out unofficial libraries, created by our enthusiasts: - [Kotlin DSL client](https://github.com/Namazed/TamTamBotApiClientDsl) - [GO client](https://github.com/neonxp/tamtam) - [Node.js module](https://github.com/vershininivan/node-tamtam-botapi)  #### Python: - [Python client](https://github.com/asvbkr/openapi_client) - [tamtam.py](https://github.com/uwinx/tamtam.py) - [registriren/botapitamtam](https://github.com/registriren/botapitamtam)  # Changelog ##### Version 0.3.0 - Added methods to [pin](#operation/pinMessage)/[unpin](#operation/unpinMessage) messages in chats/channels - Added `is_bot` flag to [`User`](#tag/user_model) model  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.1..v0.3.0) for this release.  ##### Version 0.2.1 - [Added](#operation/getChatByLink) method to get chat by its `@link` - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR1240) `description` for users in some cases - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR2555) `user_locale` to `message_created` update in dialogs  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..v0.2.1) for this release.  ##### Version 0.2.0 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/09c95259d6c8c424f82b50eab93872e7db2ca208) new type of button to start new chat - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ea4581d83d7132663d6cc5c2c61c058a2bd46aac) Constructors API that allows bots to create message on behalf of a user - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/c5ff03175407819aceebd9c25de49eed566a0ce1) support for deep-links - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ff4cc4f93662d6c25db11fac72d9fcbf1f66cad8) ability to block users in chats - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/b965bfb0d02933e819435312e6ab184a3dfc0250) `chat_id` and `user_id` to `message_removed` update - Added meta information for video attachments - Other minor improvements and fixes. Check out complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.1.11...v0.1.10) for this version  ##### Version 0.1.10 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/a9ef3a1b8f4e1a75b55a9b80877eddc2c6f07ec4) `disable_link_preview` parameter to POST:/messages method to disable links parsing in text - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/eb99e8ab97b55fa196d9957fca34d2316a4ca8aa) `sending_file` action - [Removed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/7a5ab5f0ea1336b3460d1827a6a7b3b141e19776) several deprecated properties - `photo` upload type [renamed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/74505883e6acb306686a6d141414aeaf5131ef49) to `image`. *C* is for consistency  To see changelog for older versions visit our [GitHub](https://github.com/tamtam-chat/tamtam-bot-api-schema/releases).  # noqa: E501
 7 | 
 8 |     OpenAPI spec version: 0.5.2
 9 |     Generated by: https://openapi-generator.tech
10 | """
11 | 
12 | 
13 | import pprint
14 | import re  # noqa: F401
15 | 
16 | import six
17 | 
18 | 
19 | class ChatType(object):
20 |     """NOTE: This class is auto generated by OpenAPI Generator.
21 |     Ref: https://openapi-generator.tech
22 | 
23 |     Do not edit the class manually.
24 |     """
25 | 
26 |     """
27 |     allowed enum values
28 |     """
29 |     DIALOG = "dialog"
30 |     CHAT = "chat"
31 |     CHANNEL = "channel"
32 | 
33 |     """
34 |     Attributes:
35 |       openapi_types (dict): The key is attribute name
36 |                             and the value is attribute type.
37 |       attribute_map (dict): The key is attribute name
38 |                             and the value is json key in definition.
39 |     """
40 |     openapi_types = {
41 |     }
42 | 
43 |     attribute_map = {
44 |     }
45 | 
46 |     def __init__(self):  # noqa: E501
47 |         """ChatType - a model defined in OpenAPI"""  # noqa: E501
48 |         self.discriminator = None
49 | 
50 |     def to_dict(self):
51 |         """Returns the model properties as a dict"""
52 |         result = {}
53 | 
54 |         for attr, _ in six.iteritems(self.openapi_types):
55 |             value = getattr(self, attr)
56 |             if isinstance(value, list):
57 |                 result[attr] = list(map(
58 |                     lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
59 |                     value
60 |                 ))
61 |             elif hasattr(value, "to_dict"):
62 |                 result[attr] = value.to_dict()
63 |             elif isinstance(value, dict):
64 |                 result[attr] = dict(map(
65 |                     lambda item: (item[0], item[1].to_dict())
66 |                     if hasattr(item[1], "to_dict") else item,
67 |                     value.items()
68 |                 ))
69 |             else:
70 |                 result[attr] = value
71 | 
72 |         return result
73 | 
74 |     def to_str(self):
75 |         """Returns the string representation of the model"""
76 |         return pprint.pformat(self.to_dict())
77 | 
78 |     def __repr__(self):
79 |         """For `print` and `pprint`"""
80 |         return self.to_str()
81 | 
82 |     def __eq__(self, other):
83 |         """Returns true if both objects are equal"""
84 |         if not isinstance(other, ChatType):
85 |             return False
86 | 
87 |         return self.__dict__ == other.__dict__
88 | 
89 |     def __ne__(self, other):
90 |         """Returns true if both objects are not equal"""
91 |         return not self == other
92 | 


--------------------------------------------------------------------------------
/models/emphasized_markup.py:
--------------------------------------------------------------------------------
  1 | # coding: utf-8
  2 | 
  3 | # noinspection SpellCheckingInspection
  4 | """
  5 |     TamTam Bot API
  6 | 
  7 |     # About Bot API allows bots to interact with TamTam. Methods are called by sending HTTPS requests to [botapi.tamtam.chat](https://botapi.tamtam.chat) domain. Bots are third-party applications that use TamTam features. A bot can legitimately take part in a conversation. It can be achieved through HTTP requests to the TamTam Bot API.  ## Features TamTam bots of the current version are able to: - Communicate with users and respond to requests - Recommend users complete actions via programmed buttons - Request personal data from users (name, short reference, phone number) We'll keep working on expanding bot capabilities in the future.  ## Examples Bots can be used for the following purposes: - Providing support, answering frequently asked questions - Sending typical information - Voting - Likes/dislikes - Following external links - Forwarding a user to a chat/channel  ## @PrimeBot [PrimeBot](https://tt.me/primebot) is the main bot in TamTam, all bots creator. Use PrimeBot to create and edit your bots. Feel free to contact us for any questions, [@support](https://tt.me/support) or [team@tamtam.chat](mailto:team@tamtam.chat).  ## HTTP verbs `GET` — getting resources, parameters are transmitted via URL  `POST` — creation of resources (for example, sending new messages)  `PUT` — editing resources  `DELETE` — deleting resources  `PATCH` — patching resources  ## HTTP response codes `200` — successful operation  `400` — invalid request  `401` — authentication error  `404` — resource not found  `405` — method is not allowed  `429` — the number of requests is exceeded  `503` — service unavailable  ## Resources format For content requests (PUT and POST) and responses, the API uses the JSON format. All strings are UTF-8 encoded. Date/time fields are represented as the number of milliseconds that have elapsed since 00:00 January 1, 1970 in the long format. To get it, you can simply multiply the UNIX timestamp by 1000. All date/time fields have a UTC timezone. ## Error responses In case of an error, the API returns a response with the corresponding HTTP code and JSON with the following fields:  `code` - the string with the error key  `message` - a string describing the error 
For example: ```bash > http https://botapi.tamtam.chat/chats?access_token={EXAMPLE_TOKEN} HTTP / 1.1 403 Forbidden Cache-Control: no-cache Connection: Keep-Alive Content-Length: 57 Content-Type: application / json; charset = utf-8 Set-Cookie: web_ui_lang = ru; Path = /; Domain = .tamtam.chat; Expires = 2019-03-24T11: 45: 36.500Z { \"code\": \"verify.token\", \"message\": \"Invalid access_token\" } ``` ## Receiving notifications TamTam Bot API supports 2 options of receiving notifications on new events for bots: - Push notifications via WebHook. To receive data via WebHook, you'll have to [add subscription](https://dev.tamtam.chat/#operation/subscribe); - Notifications upon request via [long polling](#operation/getUpdates) API. All data can be received via long polling **by default** after creating the bot. Both methods **cannot** be used simultaneously. Refer to the response schema of [/updates](https://dev.tamtam.chat/#operation/getUpdates) method to check all available types of updates. ### Webhook There is some notes about how we handle webhook subscription: 1. Sometimes webhook notification cannot be delivered in case when bot server or network is down. In such case we well retry delivery in a short period of time (from 30 to 60 seconds) and will do this until get `200 OK` status code from your server, but not longer than **8 hours** (*may change over time*) since update happened. We also consider any non `200`-response from server as failed delivery. 2. To protect your bot from unexpected high load we send **no more than 100** notifications per second by default. If you want increase this limit, contact us at [@support](https://tt.me/support). It should be from one of the following subnets: ``` 185.16.150.0/30 185.16.150.84/30 185.16.150.152/30 185.16.150.192/30 ``` ## Message buttons You can program buttons for users answering a bot. TamTam supports the following types of buttons: `callback` — sends a notification with payload to a bot (via WebHook or long polling) `link` — makes a user to follow a link `request_contact` — requests the user permission to access contact information (phone number, short link, email) `request_geo_location` — asks user to provide current geo location `chat` — creates chat associated with message To start create buttons [send message](#operation/sendMessage) with `InlineKeyboardAttachment`: ```json { \"text\": \"It is message with inline keyboard\", \"attachments\": [ { \"type\": \"inline_keyboard\", \"payload\": { \"buttons\": [ [ { \"type\": \"callback\", \"text\": \"Press me!\", \"payload\": \"button1 pressed\" } ], [ { \"type\": \"chat\", \"text\": \"Discuss\", \"chat_title\": \"Message discussion\" } ] ] } } ] } ``` ### Chat button Chat button is a button that starts chat assosiated with the current message. It will be **private** chat with a link, bot will be added as administrator by default. Chat will be created as soon as the first user taps on button. Bot will receive `message_chat_created` update. Bot can set title and description of new chat by setting `chat_title` and `chat_description` properties. Whereas keyboard can contain several `chat`-buttons there is `uuid` property to distinct them between each other. In case you do not pass `uuid` we will generate it. If you edit message, pass `uuid` so we know that this button starts the same chat as before. Chat button also can contain `start_payload` that will be sent to bot as part of `message_chat_created` update. ## Deep linking TamTam supports deep linking mechanism for bots. It allows passing additional payload to the bot on startup. Deep link can contain any data encoded into string up to **128** characters long. Longer strings will be omitted and **not** passed to the bot. Each bot has start link that looks like: ``` https://tt.me/%BOT_USERNAME%/start/%PAYLOAD% ``` As soon as user clicks on such link we open dialog with bot and send this payload to bot as part of `bot_started` update: ```json { \"update_type\": \"bot_started\", \"timestamp\": 1573226679188, \"chat_id\": 1234567890, \"user\": { \"user_id\": 1234567890, \"name\": \"Boris\", \"username\": \"borisd84\" }, \"payload\": \"any data meaningful to bot\" } ``` Deep linking mechanism is supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Constructors Constructor is a bot that can create a message for user: add buttons, attach some media, insert text. You can enable constructor mode for your bot via [@PrimeBot](https://tt.me/primebot) sending [/constructor_mode](https://tt.me/primebot/start/constructor_mode) command. For bot developers, it looks like request-response interaction where TamTam application sends `message_construction_request` on behalf of user. Bot [responds](#operation/construct) to it with `messages` ready to go or `keyboard` in case it requires further action from user. Bot also can set up UI parts such as `hint` or `placeholder`, allow or not user's input: ![Constructor UI parts](https://dev.tamtam.chat/static/hint-079a332a51a2e9e6d415ec716389661b.png) As soon as user finishes composing a message, they can post it. Bot will receive `message_constructed_update` with posted message. Constructors are supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Text formatting Message text can be improved with basic formatting such as: **strong**, *emphasis*, ~strikethough~, underline, `code` or link. You can use either markdown-like or HTML formatting. To enable text formatting set the `format` property of [NewMessageBody](#tag/new_message_model). ### TamTam flavored Markdown To enable [Markdown](https://spec.commonmark.org/0.29/) parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `markdown`. We currently support only the following syntax: `*empasized*` or `_empasized_` for *italic* text `**strong**` or `__strong__` for __bold__ text `~~strikethough~~` for ~strikethough~ text `++underline++` for underlined text ``` `code` ``` or ` ```code``` ` for `monospaced` text `^^important^^` for highlighted text (colored in red, by default) `[Inline URL](https://dev.tamtam.chat/)` for inline URLs `[User mention](tamtam://user/%user_id%)` for user mentions without username ### HTML support To enable HTML parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `html`. Only the following HTML tags are supported. All others will be stripped: Emphasized: `` or `` Strong: `` or `` Strikethrough: `` or `` Underlined: `` or `` Link: `Docs` Monospaced text: `
` or ``  Highlighted text: ``  Text formatting is supported for iOS since version 3.1 and Android since 2.20.0.  # Versioning API models and interface may change over time. To make sure your bot will get the right info, we strongly recommend adding API version number to each request. You can add it as `v` parameter to each HTTP-request. For instance, `v=0.1.2`. To specify the data model version you are getting through WebHook subscription, use the `version` property in the request body of the [subscribe](https://dev.tamtam.chat/#operation/subscribe) request.  # Libraries We have developed the official [Java client](https://github.com/tamtam-chat/tamtam-bot-api) and [SDK](https://github.com/tamtam-chat/tamtam-bot-sdk).  Also check out unofficial libraries, created by our enthusiasts: - [Kotlin DSL client](https://github.com/Namazed/TamTamBotApiClientDsl) - [GO client](https://github.com/neonxp/tamtam) - [Node.js module](https://github.com/vershininivan/node-tamtam-botapi)  #### Python: - [Python client](https://github.com/asvbkr/openapi_client) - [tamtam.py](https://github.com/uwinx/tamtam.py) - [registriren/botapitamtam](https://github.com/registriren/botapitamtam)  # Changelog ##### Version 0.3.0 - Added methods to [pin](#operation/pinMessage)/[unpin](#operation/unpinMessage) messages in chats/channels - Added `is_bot` flag to [`User`](#tag/user_model) model  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.1..v0.3.0) for this release.  ##### Version 0.2.1 - [Added](#operation/getChatByLink) method to get chat by its `@link` - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR1240) `description` for users in some cases - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR2555) `user_locale` to `message_created` update in dialogs  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..v0.2.1) for this release.  ##### Version 0.2.0 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/09c95259d6c8c424f82b50eab93872e7db2ca208) new type of button to start new chat - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ea4581d83d7132663d6cc5c2c61c058a2bd46aac) Constructors API that allows bots to create message on behalf of a user - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/c5ff03175407819aceebd9c25de49eed566a0ce1) support for deep-links - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ff4cc4f93662d6c25db11fac72d9fcbf1f66cad8) ability to block users in chats - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/b965bfb0d02933e819435312e6ab184a3dfc0250) `chat_id` and `user_id` to `message_removed` update - Added meta information for video attachments - Other minor improvements and fixes. Check out complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.1.11...v0.1.10) for this version  ##### Version 0.1.10 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/a9ef3a1b8f4e1a75b55a9b80877eddc2c6f07ec4) `disable_link_preview` parameter to POST:/messages method to disable links parsing in text - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/eb99e8ab97b55fa196d9957fca34d2316a4ca8aa) `sending_file` action - [Removed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/7a5ab5f0ea1336b3460d1827a6a7b3b141e19776) several deprecated properties - `photo` upload type [renamed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/74505883e6acb306686a6d141414aeaf5131ef49) to `image`. *C* is for consistency  To see changelog for older versions visit our [GitHub](https://github.com/tamtam-chat/tamtam-bot-api-schema/releases).  # noqa: E501
  8 | 
  9 |     OpenAPI spec version: 0.5.2
 10 |     Generated by: https://openapi-generator.tech
 11 | """
 12 | 
 13 | import pprint
 14 | import re  # noqa: F401
 15 | 
 16 | import six
 17 | 
 18 | from .markup_element import MarkupElement
 19 | 
 20 | 
 21 | from .text_format import TextFormat
 22 | 
 23 | 
 24 | # noinspection PyShadowingBuiltins
 25 | class EmphasizedMarkup(MarkupElement):
 26 |     """NOTE: This class is auto generated by OpenAPI Generator.
 27 |     Ref: https://openapi-generator.tech
 28 | 
 29 |     Do not edit the class manually.
 30 |     """
 31 | 
 32 |     """
 33 |     Attributes:
 34 |       openapi_types (dict): The key is attribute name
 35 |                             and the value is attribute type.
 36 |       attribute_map (dict): The key is attribute name
 37 |                             and the value is json key in definition.
 38 |     """
 39 |     openapi_types = {
 40 |         'type': 'str',
 41 |         '_from': 'int',
 42 |         'length': 'int',
 43 |     }
 44 | 
 45 |     attribute_map = {
 46 |         'type': 'type',
 47 |         '_from': 'from',
 48 |         'length': 'length',
 49 |     }
 50 | 
 51 |     def __init__(self, type="emphasized", _from=None, length=None):  # noqa: E501
 52 |         """EmphasizedMarkup - a model defined in OpenAPI"""  # noqa: E501
 53 |         super(EmphasizedMarkup, self).__init__(type, _from, length)
 54 |         self.discriminator = None
 55 | 
 56 |     def markup_apply(self, text, format):
 57 |         # type: (str, TextFormat) -> str
 58 |         if format == TextFormat.HTML:
 59 |             return f'{text}'
 60 |         else:
 61 |             return f'*{text}*'
 62 | 
 63 |     def to_dict(self):
 64 |         """Returns the model properties as a dict"""
 65 |         result = {}
 66 | 
 67 |         for attr, _ in six.iteritems(self.openapi_types):
 68 |             value = getattr(self, attr)
 69 |             if isinstance(value, list):
 70 |                 result[attr] = list(map(
 71 |                     lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
 72 |                     value
 73 |                 ))
 74 |             elif hasattr(value, "to_dict"):
 75 |                 result[attr] = value.to_dict()
 76 |             elif isinstance(value, dict):
 77 |                 result[attr] = dict(map(
 78 |                     lambda item: (item[0], item[1].to_dict())
 79 |                     if hasattr(item[1], "to_dict") else item,
 80 |                     value.items()
 81 |                 ))
 82 |             else:
 83 |                 result[attr] = value
 84 | 
 85 |         return result
 86 | 
 87 |     def to_str(self):
 88 |         """Returns the string representation of the model"""
 89 |         return pprint.pformat(self.to_dict())
 90 | 
 91 |     def __repr__(self):
 92 |         """For `print` and `pprint`"""
 93 |         return self.to_str()
 94 | 
 95 |     def __eq__(self, other):
 96 |         """Returns true if both objects are equal"""
 97 |         if not isinstance(other, EmphasizedMarkup):
 98 |             return False
 99 | 
100 |         return self.__dict__ == other.__dict__
101 | 
102 |     def __ne__(self, other):
103 |         """Returns true if both objects are not equal"""
104 |         return not self == other
105 | 
106 |     def __hash__(self):
107 |         return super().__hash__()
108 | 


--------------------------------------------------------------------------------
/models/heading_markup.py:
--------------------------------------------------------------------------------
  1 | # coding: utf-8
  2 | 
  3 | # noinspection SpellCheckingInspection
  4 | """
  5 |     TamTam Bot API
  6 | 
  7 |     # About Bot API allows bots to interact with TamTam. Methods are called by sending HTTPS requests to [botapi.tamtam.chat](https://botapi.tamtam.chat) domain. Bots are third-party applications that use TamTam features. A bot can legitimately take part in a conversation. It can be achieved through HTTP requests to the TamTam Bot API.  ## Features TamTam bots of the current version are able to: - Communicate with users and respond to requests - Recommend users complete actions via programmed buttons - Request personal data from users (name, short reference, phone number) We'll keep working on expanding bot capabilities in the future.  ## Examples Bots can be used for the following purposes: - Providing support, answering frequently asked questions - Sending typical information - Voting - Likes/dislikes - Following external links - Forwarding a user to a chat/channel  ## @PrimeBot [PrimeBot](https://tt.me/primebot) is the main bot in TamTam, all bots creator. Use PrimeBot to create and edit your bots. Feel free to contact us for any questions, [@support](https://tt.me/support) or [team@tamtam.chat](mailto:team@tamtam.chat).  ## HTTP verbs `GET` — getting resources, parameters are transmitted via URL  `POST` — creation of resources (for example, sending new messages)  `PUT` — editing resources  `DELETE` — deleting resources  `PATCH` — patching resources  ## HTTP response codes `200` — successful operation  `400` — invalid request  `401` — authentication error  `404` — resource not found  `405` — method is not allowed  `429` — the number of requests is exceeded  `503` — service unavailable  ## Resources format For content requests (PUT and POST) and responses, the API uses the JSON format. All strings are UTF-8 encoded. Date/time fields are represented as the number of milliseconds that have elapsed since 00:00 January 1, 1970 in the long format. To get it, you can simply multiply the UNIX timestamp by 1000. All date/time fields have a UTC timezone. ## Error responses In case of an error, the API returns a response with the corresponding HTTP code and JSON with the following fields:  `code` - the string with the error key  `message` - a string describing the error 
For example: ```bash > http https://botapi.tamtam.chat/chats?access_token={EXAMPLE_TOKEN} HTTP / 1.1 403 Forbidden Cache-Control: no-cache Connection: Keep-Alive Content-Length: 57 Content-Type: application / json; charset = utf-8 Set-Cookie: web_ui_lang = ru; Path = /; Domain = .tamtam.chat; Expires = 2019-03-24T11: 45: 36.500Z { \"code\": \"verify.token\", \"message\": \"Invalid access_token\" } ``` ## Receiving notifications TamTam Bot API supports 2 options of receiving notifications on new events for bots: - Push notifications via WebHook. To receive data via WebHook, you'll have to [add subscription](https://dev.tamtam.chat/#operation/subscribe); - Notifications upon request via [long polling](#operation/getUpdates) API. All data can be received via long polling **by default** after creating the bot. Both methods **cannot** be used simultaneously. Refer to the response schema of [/updates](https://dev.tamtam.chat/#operation/getUpdates) method to check all available types of updates. ### Webhook There is some notes about how we handle webhook subscription: 1. Sometimes webhook notification cannot be delivered in case when bot server or network is down. In such case we well retry delivery in a short period of time (from 30 to 60 seconds) and will do this until get `200 OK` status code from your server, but not longer than **8 hours** (*may change over time*) since update happened. We also consider any non `200`-response from server as failed delivery. 2. To protect your bot from unexpected high load we send **no more than 100** notifications per second by default. If you want increase this limit, contact us at [@support](https://tt.me/support). It should be from one of the following subnets: ``` 185.16.150.0/30 185.16.150.84/30 185.16.150.152/30 185.16.150.192/30 ``` ## Message buttons You can program buttons for users answering a bot. TamTam supports the following types of buttons: `callback` — sends a notification with payload to a bot (via WebHook or long polling) `link` — makes a user to follow a link `request_contact` — requests the user permission to access contact information (phone number, short link, email) `request_geo_location` — asks user to provide current geo location `chat` — creates chat associated with message To start create buttons [send message](#operation/sendMessage) with `InlineKeyboardAttachment`: ```json { \"text\": \"It is message with inline keyboard\", \"attachments\": [ { \"type\": \"inline_keyboard\", \"payload\": { \"buttons\": [ [ { \"type\": \"callback\", \"text\": \"Press me!\", \"payload\": \"button1 pressed\" } ], [ { \"type\": \"chat\", \"text\": \"Discuss\", \"chat_title\": \"Message discussion\" } ] ] } } ] } ``` ### Chat button Chat button is a button that starts chat assosiated with the current message. It will be **private** chat with a link, bot will be added as administrator by default. Chat will be created as soon as the first user taps on button. Bot will receive `message_chat_created` update. Bot can set title and description of new chat by setting `chat_title` and `chat_description` properties. Whereas keyboard can contain several `chat`-buttons there is `uuid` property to distinct them between each other. In case you do not pass `uuid` we will generate it. If you edit message, pass `uuid` so we know that this button starts the same chat as before. Chat button also can contain `start_payload` that will be sent to bot as part of `message_chat_created` update. ## Deep linking TamTam supports deep linking mechanism for bots. It allows passing additional payload to the bot on startup. Deep link can contain any data encoded into string up to **128** characters long. Longer strings will be omitted and **not** passed to the bot. Each bot has start link that looks like: ``` https://tt.me/%BOT_USERNAME%/start/%PAYLOAD% ``` As soon as user clicks on such link we open dialog with bot and send this payload to bot as part of `bot_started` update: ```json { \"update_type\": \"bot_started\", \"timestamp\": 1573226679188, \"chat_id\": 1234567890, \"user\": { \"user_id\": 1234567890, \"name\": \"Boris\", \"username\": \"borisd84\" }, \"payload\": \"any data meaningful to bot\" } ``` Deep linking mechanism is supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Constructors Constructor is a bot that can create a message for user: add buttons, attach some media, insert text. You can enable constructor mode for your bot via [@PrimeBot](https://tt.me/primebot) sending [/constructor_mode](https://tt.me/primebot/start/constructor_mode) command. For bot developers, it looks like request-response interaction where TamTam application sends `message_construction_request` on behalf of user. Bot [responds](#operation/construct) to it with `messages` ready to go or `keyboard` in case it requires further action from user. Bot also can set up UI parts such as `hint` or `placeholder`, allow or not user's input: ![Constructor UI parts](https://dev.tamtam.chat/static/hint-079a332a51a2e9e6d415ec716389661b.png) As soon as user finishes composing a message, they can post it. Bot will receive `message_constructed_update` with posted message. Constructors are supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Text formatting Message text can be improved with basic formatting such as: **strong**, *emphasis*, ~strikethough~, underline, `code` or link. You can use either markdown-like or HTML formatting. To enable text formatting set the `format` property of [NewMessageBody](#tag/new_message_model). ### TamTam flavored Markdown To enable [Markdown](https://spec.commonmark.org/0.29/) parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `markdown`. We currently support only the following syntax: `*empasized*` or `_empasized_` for *italic* text `**strong**` or `__strong__` for __bold__ text `~~strikethough~~` for ~strikethough~ text `++underline++` for underlined text ``` `code` ``` or ` ```code``` ` for `monospaced` text `^^important^^` for highlighted text (colored in red, by default) `[Inline URL](https://dev.tamtam.chat/)` for inline URLs `[User mention](tamtam://user/%user_id%)` for user mentions without username ### HTML support To enable HTML parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `html`. Only the following HTML tags are supported. All others will be stripped: Emphasized: `` or `` Strong: `` or `` Strikethrough: `` or `` Underlined: `` or `` Link: `Docs` Monospaced text: `
` or ``  Highlighted text: ``  Text formatting is supported for iOS since version 3.1 and Android since 2.20.0.  # Versioning API models and interface may change over time. To make sure your bot will get the right info, we strongly recommend adding API version number to each request. You can add it as `v` parameter to each HTTP-request. For instance, `v=0.1.2`. To specify the data model version you are getting through WebHook subscription, use the `version` property in the request body of the [subscribe](https://dev.tamtam.chat/#operation/subscribe) request.  # Libraries We have developed the official [Java client](https://github.com/tamtam-chat/tamtam-bot-api) and [SDK](https://github.com/tamtam-chat/tamtam-bot-sdk).  Also check out unofficial libraries, created by our enthusiasts: - [Kotlin DSL client](https://github.com/Namazed/TamTamBotApiClientDsl) - [GO client](https://github.com/neonxp/tamtam) - [Node.js module](https://github.com/vershininivan/node-tamtam-botapi)  #### Python: - [Python client](https://github.com/asvbkr/openapi_client) - [tamtam.py](https://github.com/uwinx/tamtam.py) - [registriren/botapitamtam](https://github.com/registriren/botapitamtam)  # Changelog ##### Version 0.3.0 - Added methods to [pin](#operation/pinMessage)/[unpin](#operation/unpinMessage) messages in chats/channels - Added `is_bot` flag to [`User`](#tag/user_model) model  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.1..v0.3.0) for this release.  ##### Version 0.2.1 - [Added](#operation/getChatByLink) method to get chat by its `@link` - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR1240) `description` for users in some cases - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR2555) `user_locale` to `message_created` update in dialogs  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..v0.2.1) for this release.  ##### Version 0.2.0 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/09c95259d6c8c424f82b50eab93872e7db2ca208) new type of button to start new chat - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ea4581d83d7132663d6cc5c2c61c058a2bd46aac) Constructors API that allows bots to create message on behalf of a user - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/c5ff03175407819aceebd9c25de49eed566a0ce1) support for deep-links - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ff4cc4f93662d6c25db11fac72d9fcbf1f66cad8) ability to block users in chats - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/b965bfb0d02933e819435312e6ab184a3dfc0250) `chat_id` and `user_id` to `message_removed` update - Added meta information for video attachments - Other minor improvements and fixes. Check out complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.1.11...v0.1.10) for this version  ##### Version 0.1.10 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/a9ef3a1b8f4e1a75b55a9b80877eddc2c6f07ec4) `disable_link_preview` parameter to POST:/messages method to disable links parsing in text - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/eb99e8ab97b55fa196d9957fca34d2316a4ca8aa) `sending_file` action - [Removed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/7a5ab5f0ea1336b3460d1827a6a7b3b141e19776) several deprecated properties - `photo` upload type [renamed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/74505883e6acb306686a6d141414aeaf5131ef49) to `image`. *C* is for consistency  To see changelog for older versions visit our [GitHub](https://github.com/tamtam-chat/tamtam-bot-api-schema/releases).  # noqa: E501
  8 | 
  9 |     OpenAPI spec version: 0.5.2
 10 |     Generated by: https://openapi-generator.tech
 11 | """
 12 | 
 13 | import pprint
 14 | import re  # noqa: F401
 15 | 
 16 | import six
 17 | 
 18 | from .markup_element import MarkupElement
 19 | 
 20 | from .text_format import TextFormat
 21 | 
 22 | 
 23 | # noinspection PyShadowingBuiltins
 24 | class HeadingMarkup(MarkupElement):
 25 |     """NOTE: This class is auto generated by OpenAPI Generator.
 26 |     Ref: https://openapi-generator.tech
 27 | 
 28 |     Do not edit the class manually.
 29 |     """
 30 | 
 31 |     """
 32 |     Attributes:
 33 |       openapi_types (dict): The key is attribute name
 34 |                             and the value is attribute type.
 35 |       attribute_map (dict): The key is attribute name
 36 |                             and the value is json key in definition.
 37 |     """
 38 |     openapi_types = {
 39 |         'type': 'str',
 40 |         '_from': 'int',
 41 |         'length': 'int',
 42 |     }
 43 | 
 44 |     attribute_map = {
 45 |         'type': 'type',
 46 |         '_from': 'from',
 47 |         'length': 'length',
 48 |     }
 49 | 
 50 |     def __init__(self, type="heading", _from=None, length=None):  # noqa: E501
 51 |         """HeadingMarkup - a model defined in OpenAPI"""  # noqa: E501
 52 |         super(HeadingMarkup, self).__init__(type, _from, length)
 53 |         self.discriminator = None
 54 | 
 55 |     def markup_apply(self, text, format):
 56 |         # type: (str, TextFormat) -> str
 57 |         if format == TextFormat.HTML:
 58 |             return f'

{text}

' 59 | else: 60 | return f'# {text}' 61 | 62 | def to_dict(self): 63 | """Returns the model properties as a dict""" 64 | result = {} 65 | 66 | for attr, _ in six.iteritems(self.openapi_types): 67 | value = getattr(self, attr) 68 | if isinstance(value, list): 69 | result[attr] = list(map( 70 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 71 | value 72 | )) 73 | elif hasattr(value, "to_dict"): 74 | result[attr] = value.to_dict() 75 | elif isinstance(value, dict): 76 | result[attr] = dict(map( 77 | lambda item: (item[0], item[1].to_dict()) 78 | if hasattr(item[1], "to_dict") else item, 79 | value.items() 80 | )) 81 | else: 82 | result[attr] = value 83 | 84 | return result 85 | 86 | def to_str(self): 87 | """Returns the string representation of the model""" 88 | return pprint.pformat(self.to_dict()) 89 | 90 | def __repr__(self): 91 | """For `print` and `pprint`""" 92 | return self.to_str() 93 | 94 | def __eq__(self, other): 95 | """Returns true if both objects are equal""" 96 | if not isinstance(other, HeadingMarkup): 97 | return False 98 | 99 | return self.__dict__ == other.__dict__ 100 | 101 | def __ne__(self, other): 102 | """Returns true if both objects are not equal""" 103 | return not self == other 104 | 105 | def __hash__(self): 106 | return super().__hash__() 107 | -------------------------------------------------------------------------------- /models/intent.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | TamTam Bot API 5 | 6 | # About Bot API allows bots to interact with TamTam. Methods are called by sending HTTPS requests to [botapi.tamtam.chat](https://botapi.tamtam.chat) domain. Bots are third-party applications that use TamTam features. A bot can legitimately take part in a conversation. It can be achieved through HTTP requests to the TamTam Bot API. ## Features TamTam bots of the current version are able to: - Communicate with users and respond to requests - Recommend users complete actions via programmed buttons - Request personal data from users (name, short reference, phone number) We'll keep working on expanding bot capabilities in the future. ## Examples Bots can be used for the following purposes: - Providing support, answering frequently asked questions - Sending typical information - Voting - Likes/dislikes - Following external links - Forwarding a user to a chat/channel ## @PrimeBot [PrimeBot](https://tt.me/primebot) is the main bot in TamTam, all bots creator. Use PrimeBot to create and edit your bots. Feel free to contact us for any questions, [@support](https://tt.me/support) or [team@tamtam.chat](mailto:team@tamtam.chat). ## HTTP verbs `GET` — getting resources, parameters are transmitted via URL `POST` — creation of resources (for example, sending new messages) `PUT` — editing resources `DELETE` — deleting resources `PATCH` — patching resources ## HTTP response codes `200` — successful operation `400` — invalid request `401` — authentication error `404` — resource not found `405` — method is not allowed `429` — the number of requests is exceeded `503` — service unavailable ## Resources format For content requests (PUT and POST) and responses, the API uses the JSON format. All strings are UTF-8 encoded. Date/time fields are represented as the number of milliseconds that have elapsed since 00:00 January 1, 1970 in the long format. To get it, you can simply multiply the UNIX timestamp by 1000. All date/time fields have a UTC timezone. ## Error responses In case of an error, the API returns a response with the corresponding HTTP code and JSON with the following fields: `code` - the string with the error key `message` - a string describing the error
For example: ```bash > http https://botapi.tamtam.chat/chats?access_token={EXAMPLE_TOKEN} HTTP / 1.1 403 Forbidden Cache-Control: no-cache Connection: Keep-Alive Content-Length: 57 Content-Type: application / json; charset = utf-8 Set-Cookie: web_ui_lang = ru; Path = /; Domain = .tamtam.chat; Expires = 2019-03-24T11: 45: 36.500Z { \"code\": \"verify.token\", \"message\": \"Invalid access_token\" } ``` ## Receiving notifications TamTam Bot API supports 2 options of receiving notifications on new events for bots: - Push notifications via WebHook. To receive data via WebHook, you'll have to [add subscription](https://dev.tamtam.chat/#operation/subscribe); - Notifications upon request via [long polling](#operation/getUpdates) API. All data can be received via long polling **by default** after creating the bot. Both methods **cannot** be used simultaneously. Refer to the response schema of [/updates](https://dev.tamtam.chat/#operation/getUpdates) method to check all available types of updates. ### Webhook There is some notes about how we handle webhook subscription: 1. Sometimes webhook notification cannot be delivered in case when bot server or network is down. In such case we well retry delivery in a short period of time (from 30 to 60 seconds) and will do this until get `200 OK` status code from your server, but not longer than **8 hours** (*may change over time*) since update happened. We also consider any non `200`-response from server as failed delivery. 2. To protect your bot from unexpected high load we send **no more than 100** notifications per second by default. If you want increase this limit, contact us at [@support](https://tt.me/support). It should be from one of the following subnets: ``` 185.16.150.0/30 185.16.150.84/30 185.16.150.152/30 185.16.150.192/30 ``` ## Message buttons You can program buttons for users answering a bot. TamTam supports the following types of buttons: `callback` — sends a notification with payload to a bot (via WebHook or long polling) `link` — makes a user to follow a link `request_contact` — requests the user permission to access contact information (phone number, short link, email) `request_geo_location` — asks user to provide current geo location `chat` — creates chat associated with message To start create buttons [send message](#operation/sendMessage) with `InlineKeyboardAttachment`: ```json { \"text\": \"It is message with inline keyboard\", \"attachments\": [ { \"type\": \"inline_keyboard\", \"payload\": { \"buttons\": [ [ { \"type\": \"callback\", \"text\": \"Press me!\", \"payload\": \"button1 pressed\" } ], [ { \"type\": \"chat\", \"text\": \"Discuss\", \"chat_title\": \"Message discussion\" } ] ] } } ] } ``` ### Chat button Chat button is a button that starts chat assosiated with the current message. It will be **private** chat with a link, bot will be added as administrator by default. Chat will be created as soon as the first user taps on button. Bot will receive `message_chat_created` update. Bot can set title and description of new chat by setting `chat_title` and `chat_description` properties. Whereas keyboard can contain several `chat`-buttons there is `uuid` property to distinct them between each other. In case you do not pass `uuid` we will generate it. If you edit message, pass `uuid` so we know that this button starts the same chat as before. Chat button also can contain `start_payload` that will be sent to bot as part of `message_chat_created` update. ## Deep linking TamTam supports deep linking mechanism for bots. It allows passing additional payload to the bot on startup. Deep link can contain any data encoded into string up to **128** characters long. Longer strings will be omitted and **not** passed to the bot. Each bot has start link that looks like: ``` https://tt.me/%BOT_USERNAME%/start/%PAYLOAD% ``` As soon as user clicks on such link we open dialog with bot and send this payload to bot as part of `bot_started` update: ```json { \"update_type\": \"bot_started\", \"timestamp\": 1573226679188, \"chat_id\": 1234567890, \"user\": { \"user_id\": 1234567890, \"name\": \"Boris\", \"username\": \"borisd84\" }, \"payload\": \"any data meaningful to bot\" } ``` Deep linking mechanism is supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Constructors Constructor is a bot that can create a message for user: add buttons, attach some media, insert text. You can enable constructor mode for your bot via [@PrimeBot](https://tt.me/primebot) sending [/constructor_mode](https://tt.me/primebot/start/constructor_mode) command. For bot developers, it looks like request-response interaction where TamTam application sends `message_construction_request` on behalf of user. Bot [responds](#operation/construct) to it with `messages` ready to go or `keyboard` in case it requires further action from user. Bot also can set up UI parts such as `hint` or `placeholder`, allow or not user's input: ![Constructor UI parts](https://dev.tamtam.chat/static/hint-079a332a51a2e9e6d415ec716389661b.png) As soon as user finishes composing a message, they can post it. Bot will receive `message_constructed_update` with posted message. Constructors are supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Text formatting Message text can be improved with basic formatting such as: **strong**, *emphasis*, ~strikethough~, underline, `code` or link. You can use either markdown-like or HTML formatting. To enable text formatting set the `format` property of [NewMessageBody](#tag/new_message_model). ### TamTam flavored Markdown To enable [Markdown](https://spec.commonmark.org/0.29/) parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `markdown`. We currently support only the following syntax: `*empasized*` or `_empasized_` for *italic* text `**strong**` or `__strong__` for __bold__ text `~~strikethough~~` for ~strikethough~ text `++underline++` for underlined text ``` `code` ``` or ` ```code``` ` for `monospaced` text `^^important^^` for highlighted text (colored in red, by default) `[Inline URL](https://dev.tamtam.chat/)` for inline URLs `[User mention](tamtam://user/%user_id%)` for user mentions without username ### HTML support To enable HTML parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `html`. Only the following HTML tags are supported. All others will be stripped: Emphasized: `` or `` Strong: `` or `` Strikethrough: `` or `` Underlined: `` or `` Link: `Docs` Monospaced text: `
` or ``  Highlighted text: ``  Text formatting is supported for iOS since version 3.1 and Android since 2.20.0.  # Versioning API models and interface may change over time. To make sure your bot will get the right info, we strongly recommend adding API version number to each request. You can add it as `v` parameter to each HTTP-request. For instance, `v=0.1.2`. To specify the data model version you are getting through WebHook subscription, use the `version` property in the request body of the [subscribe](https://dev.tamtam.chat/#operation/subscribe) request.  # Libraries We have developed the official [Java client](https://github.com/tamtam-chat/tamtam-bot-api) and [SDK](https://github.com/tamtam-chat/tamtam-bot-sdk).  Also check out unofficial libraries, created by our enthusiasts: - [Kotlin DSL client](https://github.com/Namazed/TamTamBotApiClientDsl) - [GO client](https://github.com/neonxp/tamtam) - [Node.js module](https://github.com/vershininivan/node-tamtam-botapi)  #### Python: - [Python client](https://github.com/asvbkr/openapi_client) - [tamtam.py](https://github.com/uwinx/tamtam.py) - [registriren/botapitamtam](https://github.com/registriren/botapitamtam)  # Changelog ##### Version 0.3.0 - Added methods to [pin](#operation/pinMessage)/[unpin](#operation/unpinMessage) messages in chats/channels - Added `is_bot` flag to [`User`](#tag/user_model) model  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.1..v0.3.0) for this release.  ##### Version 0.2.1 - [Added](#operation/getChatByLink) method to get chat by its `@link` - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR1240) `description` for users in some cases - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR2555) `user_locale` to `message_created` update in dialogs  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..v0.2.1) for this release.  ##### Version 0.2.0 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/09c95259d6c8c424f82b50eab93872e7db2ca208) new type of button to start new chat - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ea4581d83d7132663d6cc5c2c61c058a2bd46aac) Constructors API that allows bots to create message on behalf of a user - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/c5ff03175407819aceebd9c25de49eed566a0ce1) support for deep-links - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ff4cc4f93662d6c25db11fac72d9fcbf1f66cad8) ability to block users in chats - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/b965bfb0d02933e819435312e6ab184a3dfc0250) `chat_id` and `user_id` to `message_removed` update - Added meta information for video attachments - Other minor improvements and fixes. Check out complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.1.11...v0.1.10) for this version  ##### Version 0.1.10 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/a9ef3a1b8f4e1a75b55a9b80877eddc2c6f07ec4) `disable_link_preview` parameter to POST:/messages method to disable links parsing in text - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/eb99e8ab97b55fa196d9957fca34d2316a4ca8aa) `sending_file` action - [Removed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/7a5ab5f0ea1336b3460d1827a6a7b3b141e19776) several deprecated properties - `photo` upload type [renamed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/74505883e6acb306686a6d141414aeaf5131ef49) to `image`. *C* is for consistency  To see changelog for older versions visit our [GitHub](https://github.com/tamtam-chat/tamtam-bot-api-schema/releases).  # noqa: E501
 7 | 
 8 |     OpenAPI spec version: 0.5.2
 9 |     Generated by: https://openapi-generator.tech
10 | """
11 | 
12 | 
13 | import pprint
14 | import re  # noqa: F401
15 | 
16 | import six
17 | 
18 | 
19 | class Intent(object):
20 |     """NOTE: This class is auto generated by OpenAPI Generator.
21 |     Ref: https://openapi-generator.tech
22 | 
23 |     Do not edit the class manually.
24 |     """
25 | 
26 |     """
27 |     allowed enum values
28 |     """
29 |     POSITIVE = "positive"
30 |     NEGATIVE = "negative"
31 |     DEFAULT = "default"
32 | 
33 |     """
34 |     Attributes:
35 |       openapi_types (dict): The key is attribute name
36 |                             and the value is attribute type.
37 |       attribute_map (dict): The key is attribute name
38 |                             and the value is json key in definition.
39 |     """
40 |     openapi_types = {
41 |     }
42 | 
43 |     attribute_map = {
44 |     }
45 | 
46 |     def __init__(self):  # noqa: E501
47 |         """Intent - a model defined in OpenAPI"""  # noqa: E501
48 |         self.discriminator = None
49 | 
50 |     def to_dict(self):
51 |         """Returns the model properties as a dict"""
52 |         result = {}
53 | 
54 |         for attr, _ in six.iteritems(self.openapi_types):
55 |             value = getattr(self, attr)
56 |             if isinstance(value, list):
57 |                 result[attr] = list(map(
58 |                     lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
59 |                     value
60 |                 ))
61 |             elif hasattr(value, "to_dict"):
62 |                 result[attr] = value.to_dict()
63 |             elif isinstance(value, dict):
64 |                 result[attr] = dict(map(
65 |                     lambda item: (item[0], item[1].to_dict())
66 |                     if hasattr(item[1], "to_dict") else item,
67 |                     value.items()
68 |                 ))
69 |             else:
70 |                 result[attr] = value
71 | 
72 |         return result
73 | 
74 |     def to_str(self):
75 |         """Returns the string representation of the model"""
76 |         return pprint.pformat(self.to_dict())
77 | 
78 |     def __repr__(self):
79 |         """For `print` and `pprint`"""
80 |         return self.to_str()
81 | 
82 |     def __eq__(self, other):
83 |         """Returns true if both objects are equal"""
84 |         if not isinstance(other, Intent):
85 |             return False
86 | 
87 |         return self.__dict__ == other.__dict__
88 | 
89 |     def __ne__(self, other):
90 |         """Returns true if both objects are not equal"""
91 |         return not self == other
92 | 


--------------------------------------------------------------------------------
/models/message_link_type.py:
--------------------------------------------------------------------------------
 1 | # coding: utf-8
 2 | 
 3 | """
 4 |     TamTam Bot API
 5 | 
 6 |     # About Bot API allows bots to interact with TamTam. Methods are called by sending HTTPS requests to [botapi.tamtam.chat](https://botapi.tamtam.chat) domain. Bots are third-party applications that use TamTam features. A bot can legitimately take part in a conversation. It can be achieved through HTTP requests to the TamTam Bot API.  ## Features TamTam bots of the current version are able to: - Communicate with users and respond to requests - Recommend users complete actions via programmed buttons - Request personal data from users (name, short reference, phone number) We'll keep working on expanding bot capabilities in the future.  ## Examples Bots can be used for the following purposes: - Providing support, answering frequently asked questions - Sending typical information - Voting - Likes/dislikes - Following external links - Forwarding a user to a chat/channel  ## @PrimeBot [PrimeBot](https://tt.me/primebot) is the main bot in TamTam, all bots creator. Use PrimeBot to create and edit your bots. Feel free to contact us for any questions, [@support](https://tt.me/support) or [team@tamtam.chat](mailto:team@tamtam.chat).  ## HTTP verbs `GET` — getting resources, parameters are transmitted via URL  `POST` — creation of resources (for example, sending new messages)  `PUT` — editing resources  `DELETE` — deleting resources  `PATCH` — patching resources  ## HTTP response codes `200` — successful operation  `400` — invalid request  `401` — authentication error  `404` — resource not found  `405` — method is not allowed  `429` — the number of requests is exceeded  `503` — service unavailable  ## Resources format For content requests (PUT and POST) and responses, the API uses the JSON format. All strings are UTF-8 encoded. Date/time fields are represented as the number of milliseconds that have elapsed since 00:00 January 1, 1970 in the long format. To get it, you can simply multiply the UNIX timestamp by 1000. All date/time fields have a UTC timezone. ## Error responses In case of an error, the API returns a response with the corresponding HTTP code and JSON with the following fields:  `code` - the string with the error key  `message` - a string describing the error 
For example: ```bash > http https://botapi.tamtam.chat/chats?access_token={EXAMPLE_TOKEN} HTTP / 1.1 403 Forbidden Cache-Control: no-cache Connection: Keep-Alive Content-Length: 57 Content-Type: application / json; charset = utf-8 Set-Cookie: web_ui_lang = ru; Path = /; Domain = .tamtam.chat; Expires = 2019-03-24T11: 45: 36.500Z { \"code\": \"verify.token\", \"message\": \"Invalid access_token\" } ``` ## Receiving notifications TamTam Bot API supports 2 options of receiving notifications on new events for bots: - Push notifications via WebHook. To receive data via WebHook, you'll have to [add subscription](https://dev.tamtam.chat/#operation/subscribe); - Notifications upon request via [long polling](#operation/getUpdates) API. All data can be received via long polling **by default** after creating the bot. Both methods **cannot** be used simultaneously. Refer to the response schema of [/updates](https://dev.tamtam.chat/#operation/getUpdates) method to check all available types of updates. ### Webhook There is some notes about how we handle webhook subscription: 1. Sometimes webhook notification cannot be delivered in case when bot server or network is down. In such case we well retry delivery in a short period of time (from 30 to 60 seconds) and will do this until get `200 OK` status code from your server, but not longer than **8 hours** (*may change over time*) since update happened. We also consider any non `200`-response from server as failed delivery. 2. To protect your bot from unexpected high load we send **no more than 100** notifications per second by default. If you want increase this limit, contact us at [@support](https://tt.me/support). It should be from one of the following subnets: ``` 185.16.150.0/30 185.16.150.84/30 185.16.150.152/30 185.16.150.192/30 ``` ## Message buttons You can program buttons for users answering a bot. TamTam supports the following types of buttons: `callback` — sends a notification with payload to a bot (via WebHook or long polling) `link` — makes a user to follow a link `request_contact` — requests the user permission to access contact information (phone number, short link, email) `request_geo_location` — asks user to provide current geo location `chat` — creates chat associated with message To start create buttons [send message](#operation/sendMessage) with `InlineKeyboardAttachment`: ```json { \"text\": \"It is message with inline keyboard\", \"attachments\": [ { \"type\": \"inline_keyboard\", \"payload\": { \"buttons\": [ [ { \"type\": \"callback\", \"text\": \"Press me!\", \"payload\": \"button1 pressed\" } ], [ { \"type\": \"chat\", \"text\": \"Discuss\", \"chat_title\": \"Message discussion\" } ] ] } } ] } ``` ### Chat button Chat button is a button that starts chat assosiated with the current message. It will be **private** chat with a link, bot will be added as administrator by default. Chat will be created as soon as the first user taps on button. Bot will receive `message_chat_created` update. Bot can set title and description of new chat by setting `chat_title` and `chat_description` properties. Whereas keyboard can contain several `chat`-buttons there is `uuid` property to distinct them between each other. In case you do not pass `uuid` we will generate it. If you edit message, pass `uuid` so we know that this button starts the same chat as before. Chat button also can contain `start_payload` that will be sent to bot as part of `message_chat_created` update. ## Deep linking TamTam supports deep linking mechanism for bots. It allows passing additional payload to the bot on startup. Deep link can contain any data encoded into string up to **128** characters long. Longer strings will be omitted and **not** passed to the bot. Each bot has start link that looks like: ``` https://tt.me/%BOT_USERNAME%/start/%PAYLOAD% ``` As soon as user clicks on such link we open dialog with bot and send this payload to bot as part of `bot_started` update: ```json { \"update_type\": \"bot_started\", \"timestamp\": 1573226679188, \"chat_id\": 1234567890, \"user\": { \"user_id\": 1234567890, \"name\": \"Boris\", \"username\": \"borisd84\" }, \"payload\": \"any data meaningful to bot\" } ``` Deep linking mechanism is supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Constructors Constructor is a bot that can create a message for user: add buttons, attach some media, insert text. You can enable constructor mode for your bot via [@PrimeBot](https://tt.me/primebot) sending [/constructor_mode](https://tt.me/primebot/start/constructor_mode) command. For bot developers, it looks like request-response interaction where TamTam application sends `message_construction_request` on behalf of user. Bot [responds](#operation/construct) to it with `messages` ready to go or `keyboard` in case it requires further action from user. Bot also can set up UI parts such as `hint` or `placeholder`, allow or not user's input: ![Constructor UI parts](https://dev.tamtam.chat/static/hint-079a332a51a2e9e6d415ec716389661b.png) As soon as user finishes composing a message, they can post it. Bot will receive `message_constructed_update` with posted message. Constructors are supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Text formatting Message text can be improved with basic formatting such as: **strong**, *emphasis*, ~strikethough~, underline, `code` or link. You can use either markdown-like or HTML formatting. To enable text formatting set the `format` property of [NewMessageBody](#tag/new_message_model). ### TamTam flavored Markdown To enable [Markdown](https://spec.commonmark.org/0.29/) parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `markdown`. We currently support only the following syntax: `*empasized*` or `_empasized_` for *italic* text `**strong**` or `__strong__` for __bold__ text `~~strikethough~~` for ~strikethough~ text `++underline++` for underlined text ``` `code` ``` or ` ```code``` ` for `monospaced` text `^^important^^` for highlighted text (colored in red, by default) `[Inline URL](https://dev.tamtam.chat/)` for inline URLs `[User mention](tamtam://user/%user_id%)` for user mentions without username ### HTML support To enable HTML parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `html`. Only the following HTML tags are supported. All others will be stripped: Emphasized: `` or `` Strong: `` or `` Strikethrough: `` or `` Underlined: `` or `` Link: `Docs` Monospaced text: `
` or ``  Highlighted text: ``  Text formatting is supported for iOS since version 3.1 and Android since 2.20.0.  # Versioning API models and interface may change over time. To make sure your bot will get the right info, we strongly recommend adding API version number to each request. You can add it as `v` parameter to each HTTP-request. For instance, `v=0.1.2`. To specify the data model version you are getting through WebHook subscription, use the `version` property in the request body of the [subscribe](https://dev.tamtam.chat/#operation/subscribe) request.  # Libraries We have developed the official [Java client](https://github.com/tamtam-chat/tamtam-bot-api) and [SDK](https://github.com/tamtam-chat/tamtam-bot-sdk).  Also check out unofficial libraries, created by our enthusiasts: - [Kotlin DSL client](https://github.com/Namazed/TamTamBotApiClientDsl) - [GO client](https://github.com/neonxp/tamtam) - [Node.js module](https://github.com/vershininivan/node-tamtam-botapi)  #### Python: - [Python client](https://github.com/asvbkr/openapi_client) - [tamtam.py](https://github.com/uwinx/tamtam.py) - [registriren/botapitamtam](https://github.com/registriren/botapitamtam)  # Changelog ##### Version 0.3.0 - Added methods to [pin](#operation/pinMessage)/[unpin](#operation/unpinMessage) messages in chats/channels - Added `is_bot` flag to [`User`](#tag/user_model) model  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.1..v0.3.0) for this release.  ##### Version 0.2.1 - [Added](#operation/getChatByLink) method to get chat by its `@link` - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR1240) `description` for users in some cases - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR2555) `user_locale` to `message_created` update in dialogs  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..v0.2.1) for this release.  ##### Version 0.2.0 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/09c95259d6c8c424f82b50eab93872e7db2ca208) new type of button to start new chat - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ea4581d83d7132663d6cc5c2c61c058a2bd46aac) Constructors API that allows bots to create message on behalf of a user - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/c5ff03175407819aceebd9c25de49eed566a0ce1) support for deep-links - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ff4cc4f93662d6c25db11fac72d9fcbf1f66cad8) ability to block users in chats - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/b965bfb0d02933e819435312e6ab184a3dfc0250) `chat_id` and `user_id` to `message_removed` update - Added meta information for video attachments - Other minor improvements and fixes. Check out complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.1.11...v0.1.10) for this version  ##### Version 0.1.10 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/a9ef3a1b8f4e1a75b55a9b80877eddc2c6f07ec4) `disable_link_preview` parameter to POST:/messages method to disable links parsing in text - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/eb99e8ab97b55fa196d9957fca34d2316a4ca8aa) `sending_file` action - [Removed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/7a5ab5f0ea1336b3460d1827a6a7b3b141e19776) several deprecated properties - `photo` upload type [renamed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/74505883e6acb306686a6d141414aeaf5131ef49) to `image`. *C* is for consistency  To see changelog for older versions visit our [GitHub](https://github.com/tamtam-chat/tamtam-bot-api-schema/releases).  # noqa: E501
 7 | 
 8 |     OpenAPI spec version: 0.5.2
 9 |     Generated by: https://openapi-generator.tech
10 | """
11 | 
12 | 
13 | import pprint
14 | import re  # noqa: F401
15 | 
16 | import six
17 | 
18 | 
19 | class MessageLinkType(object):
20 |     """NOTE: This class is auto generated by OpenAPI Generator.
21 |     Ref: https://openapi-generator.tech
22 | 
23 |     Do not edit the class manually.
24 |     """
25 | 
26 |     """
27 |     allowed enum values
28 |     """
29 |     FORWARD = "forward"
30 |     REPLY = "reply"
31 | 
32 |     """
33 |     Attributes:
34 |       openapi_types (dict): The key is attribute name
35 |                             and the value is attribute type.
36 |       attribute_map (dict): The key is attribute name
37 |                             and the value is json key in definition.
38 |     """
39 |     openapi_types = {
40 |     }
41 | 
42 |     attribute_map = {
43 |     }
44 | 
45 |     def __init__(self):  # noqa: E501
46 |         """MessageLinkType - a model defined in OpenAPI"""  # noqa: E501
47 |         self.discriminator = None
48 | 
49 |     def to_dict(self):
50 |         """Returns the model properties as a dict"""
51 |         result = {}
52 | 
53 |         for attr, _ in six.iteritems(self.openapi_types):
54 |             value = getattr(self, attr)
55 |             if isinstance(value, list):
56 |                 result[attr] = list(map(
57 |                     lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
58 |                     value
59 |                 ))
60 |             elif hasattr(value, "to_dict"):
61 |                 result[attr] = value.to_dict()
62 |             elif isinstance(value, dict):
63 |                 result[attr] = dict(map(
64 |                     lambda item: (item[0], item[1].to_dict())
65 |                     if hasattr(item[1], "to_dict") else item,
66 |                     value.items()
67 |                 ))
68 |             else:
69 |                 result[attr] = value
70 | 
71 |         return result
72 | 
73 |     def to_str(self):
74 |         """Returns the string representation of the model"""
75 |         return pprint.pformat(self.to_dict())
76 | 
77 |     def __repr__(self):
78 |         """For `print` and `pprint`"""
79 |         return self.to_str()
80 | 
81 |     def __eq__(self, other):
82 |         """Returns true if both objects are equal"""
83 |         if not isinstance(other, MessageLinkType):
84 |             return False
85 | 
86 |         return self.__dict__ == other.__dict__
87 | 
88 |     def __ne__(self, other):
89 |         """Returns true if both objects are not equal"""
90 |         return not self == other
91 | 


--------------------------------------------------------------------------------
/models/request_contact_button.py:
--------------------------------------------------------------------------------
 1 | # coding: utf-8
 2 | 
 3 | """
 4 |     TamTam Bot API
 5 | 
 6 |     # About Bot API allows bots to interact with TamTam. Methods are called by sending HTTPS requests to [botapi.tamtam.chat](https://botapi.tamtam.chat) domain. Bots are third-party applications that use TamTam features. A bot can legitimately take part in a conversation. It can be achieved through HTTP requests to the TamTam Bot API.  ## Features TamTam bots of the current version are able to: - Communicate with users and respond to requests - Recommend users complete actions via programmed buttons - Request personal data from users (name, short reference, phone number) We'll keep working on expanding bot capabilities in the future.  ## Examples Bots can be used for the following purposes: - Providing support, answering frequently asked questions - Sending typical information - Voting - Likes/dislikes - Following external links - Forwarding a user to a chat/channel  ## @PrimeBot [PrimeBot](https://tt.me/primebot) is the main bot in TamTam, all bots creator. Use PrimeBot to create and edit your bots. Feel free to contact us for any questions, [@support](https://tt.me/support) or [team@tamtam.chat](mailto:team@tamtam.chat).  ## HTTP verbs `GET` — getting resources, parameters are transmitted via URL  `POST` — creation of resources (for example, sending new messages)  `PUT` — editing resources  `DELETE` — deleting resources  `PATCH` — patching resources  ## HTTP response codes `200` — successful operation  `400` — invalid request  `401` — authentication error  `404` — resource not found  `405` — method is not allowed  `429` — the number of requests is exceeded  `503` — service unavailable  ## Resources format For content requests (PUT and POST) and responses, the API uses the JSON format. All strings are UTF-8 encoded. Date/time fields are represented as the number of milliseconds that have elapsed since 00:00 January 1, 1970 in the long format. To get it, you can simply multiply the UNIX timestamp by 1000. All date/time fields have a UTC timezone. ## Error responses In case of an error, the API returns a response with the corresponding HTTP code and JSON with the following fields:  `code` - the string with the error key  `message` - a string describing the error 
For example: ```bash > http https://botapi.tamtam.chat/chats?access_token={EXAMPLE_TOKEN} HTTP / 1.1 403 Forbidden Cache-Control: no-cache Connection: Keep-Alive Content-Length: 57 Content-Type: application / json; charset = utf-8 Set-Cookie: web_ui_lang = ru; Path = /; Domain = .tamtam.chat; Expires = 2019-03-24T11: 45: 36.500Z { \"code\": \"verify.token\", \"message\": \"Invalid access_token\" } ``` ## Receiving notifications TamTam Bot API supports 2 options of receiving notifications on new events for bots: - Push notifications via WebHook. To receive data via WebHook, you'll have to [add subscription](https://dev.tamtam.chat/#operation/subscribe); - Notifications upon request via [long polling](#operation/getUpdates) API. All data can be received via long polling **by default** after creating the bot. Both methods **cannot** be used simultaneously. Refer to the response schema of [/updates](https://dev.tamtam.chat/#operation/getUpdates) method to check all available types of updates. ### Webhook There is some notes about how we handle webhook subscription: 1. Sometimes webhook notification cannot be delivered in case when bot server or network is down. In such case we well retry delivery in a short period of time (from 30 to 60 seconds) and will do this until get `200 OK` status code from your server, but not longer than **8 hours** (*may change over time*) since update happened. We also consider any non `200`-response from server as failed delivery. 2. To protect your bot from unexpected high load we send **no more than 100** notifications per second by default. If you want increase this limit, contact us at [@support](https://tt.me/support). It should be from one of the following subnets: ``` 185.16.150.0/30 185.16.150.84/30 185.16.150.152/30 185.16.150.192/30 ``` ## Message buttons You can program buttons for users answering a bot. TamTam supports the following types of buttons: `callback` — sends a notification with payload to a bot (via WebHook or long polling) `link` — makes a user to follow a link `request_contact` — requests the user permission to access contact information (phone number, short link, email) `request_geo_location` — asks user to provide current geo location `chat` — creates chat associated with message To start create buttons [send message](#operation/sendMessage) with `InlineKeyboardAttachment`: ```json { \"text\": \"It is message with inline keyboard\", \"attachments\": [ { \"type\": \"inline_keyboard\", \"payload\": { \"buttons\": [ [ { \"type\": \"callback\", \"text\": \"Press me!\", \"payload\": \"button1 pressed\" } ], [ { \"type\": \"chat\", \"text\": \"Discuss\", \"chat_title\": \"Message discussion\" } ] ] } } ] } ``` ### Chat button Chat button is a button that starts chat assosiated with the current message. It will be **private** chat with a link, bot will be added as administrator by default. Chat will be created as soon as the first user taps on button. Bot will receive `message_chat_created` update. Bot can set title and description of new chat by setting `chat_title` and `chat_description` properties. Whereas keyboard can contain several `chat`-buttons there is `uuid` property to distinct them between each other. In case you do not pass `uuid` we will generate it. If you edit message, pass `uuid` so we know that this button starts the same chat as before. Chat button also can contain `start_payload` that will be sent to bot as part of `message_chat_created` update. ## Deep linking TamTam supports deep linking mechanism for bots. It allows passing additional payload to the bot on startup. Deep link can contain any data encoded into string up to **128** characters long. Longer strings will be omitted and **not** passed to the bot. Each bot has start link that looks like: ``` https://tt.me/%BOT_USERNAME%/start/%PAYLOAD% ``` As soon as user clicks on such link we open dialog with bot and send this payload to bot as part of `bot_started` update: ```json { \"update_type\": \"bot_started\", \"timestamp\": 1573226679188, \"chat_id\": 1234567890, \"user\": { \"user_id\": 1234567890, \"name\": \"Boris\", \"username\": \"borisd84\" }, \"payload\": \"any data meaningful to bot\" } ``` Deep linking mechanism is supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Constructors Constructor is a bot that can create a message for user: add buttons, attach some media, insert text. You can enable constructor mode for your bot via [@PrimeBot](https://tt.me/primebot) sending [/constructor_mode](https://tt.me/primebot/start/constructor_mode) command. For bot developers, it looks like request-response interaction where TamTam application sends `message_construction_request` on behalf of user. Bot [responds](#operation/construct) to it with `messages` ready to go or `keyboard` in case it requires further action from user. Bot also can set up UI parts such as `hint` or `placeholder`, allow or not user's input: ![Constructor UI parts](https://dev.tamtam.chat/static/hint-079a332a51a2e9e6d415ec716389661b.png) As soon as user finishes composing a message, they can post it. Bot will receive `message_constructed_update` with posted message. Constructors are supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Text formatting Message text can be improved with basic formatting such as: **strong**, *emphasis*, ~strikethough~, underline, `code` or link. You can use either markdown-like or HTML formatting. To enable text formatting set the `format` property of [NewMessageBody](#tag/new_message_model). ### TamTam flavored Markdown To enable [Markdown](https://spec.commonmark.org/0.29/) parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `markdown`. We currently support only the following syntax: `*empasized*` or `_empasized_` for *italic* text `**strong**` or `__strong__` for __bold__ text `~~strikethough~~` for ~strikethough~ text `++underline++` for underlined text ``` `code` ``` or ` ```code``` ` for `monospaced` text `^^important^^` for highlighted text (colored in red, by default) `[Inline URL](https://dev.tamtam.chat/)` for inline URLs `[User mention](tamtam://user/%user_id%)` for user mentions without username ### HTML support To enable HTML parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `html`. Only the following HTML tags are supported. All others will be stripped: Emphasized: `` or `` Strong: `` or `` Strikethrough: `` or `` Underlined: `` or `` Link: `Docs` Monospaced text: `
` or ``  Highlighted text: ``  Text formatting is supported for iOS since version 3.1 and Android since 2.20.0.  # Versioning API models and interface may change over time. To make sure your bot will get the right info, we strongly recommend adding API version number to each request. You can add it as `v` parameter to each HTTP-request. For instance, `v=0.1.2`. To specify the data model version you are getting through WebHook subscription, use the `version` property in the request body of the [subscribe](https://dev.tamtam.chat/#operation/subscribe) request.  # Libraries We have developed the official [Java client](https://github.com/tamtam-chat/tamtam-bot-api) and [SDK](https://github.com/tamtam-chat/tamtam-bot-sdk).  Also check out unofficial libraries, created by our enthusiasts: - [Kotlin DSL client](https://github.com/Namazed/TamTamBotApiClientDsl) - [GO client](https://github.com/neonxp/tamtam) - [Node.js module](https://github.com/vershininivan/node-tamtam-botapi)  #### Python: - [Python client](https://github.com/asvbkr/openapi_client) - [tamtam.py](https://github.com/uwinx/tamtam.py) - [registriren/botapitamtam](https://github.com/registriren/botapitamtam)  # Changelog ##### Version 0.3.0 - Added methods to [pin](#operation/pinMessage)/[unpin](#operation/unpinMessage) messages in chats/channels - Added `is_bot` flag to [`User`](#tag/user_model) model  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.1..v0.3.0) for this release.  ##### Version 0.2.1 - [Added](#operation/getChatByLink) method to get chat by its `@link` - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR1240) `description` for users in some cases - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR2555) `user_locale` to `message_created` update in dialogs  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..v0.2.1) for this release.  ##### Version 0.2.0 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/09c95259d6c8c424f82b50eab93872e7db2ca208) new type of button to start new chat - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ea4581d83d7132663d6cc5c2c61c058a2bd46aac) Constructors API that allows bots to create message on behalf of a user - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/c5ff03175407819aceebd9c25de49eed566a0ce1) support for deep-links - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ff4cc4f93662d6c25db11fac72d9fcbf1f66cad8) ability to block users in chats - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/b965bfb0d02933e819435312e6ab184a3dfc0250) `chat_id` and `user_id` to `message_removed` update - Added meta information for video attachments - Other minor improvements and fixes. Check out complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.1.11...v0.1.10) for this version  ##### Version 0.1.10 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/a9ef3a1b8f4e1a75b55a9b80877eddc2c6f07ec4) `disable_link_preview` parameter to POST:/messages method to disable links parsing in text - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/eb99e8ab97b55fa196d9957fca34d2316a4ca8aa) `sending_file` action - [Removed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/7a5ab5f0ea1336b3460d1827a6a7b3b141e19776) several deprecated properties - `photo` upload type [renamed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/74505883e6acb306686a6d141414aeaf5131ef49) to `image`. *C* is for consistency  To see changelog for older versions visit our [GitHub](https://github.com/tamtam-chat/tamtam-bot-api-schema/releases).  # noqa: E501
 7 | 
 8 |     OpenAPI spec version: 0.5.2
 9 |     Generated by: https://openapi-generator.tech
10 | """
11 | 
12 | import pprint
13 | import re  # noqa: F401
14 | 
15 | import six
16 | 
17 | from .button import Button
18 | 
19 | 
20 | class RequestContactButton(Button):
21 |     """NOTE: This class is auto generated by OpenAPI Generator.
22 |     Ref: https://openapi-generator.tech
23 | 
24 |     Do not edit the class manually.
25 |     """
26 | 
27 |     """
28 |     Attributes:
29 |       openapi_types (dict): The key is attribute name
30 |                             and the value is attribute type.
31 |       attribute_map (dict): The key is attribute name
32 |                             and the value is json key in definition.
33 |     """
34 |     openapi_types = {
35 |         'type': 'str',
36 |         'text': 'str',
37 |     }
38 | 
39 |     attribute_map = {
40 |         'type': 'type',
41 |         'text': 'text',
42 |     }
43 | 
44 |     def __init__(self, text=None, type='request_contact'):  # noqa: E501
45 |         """RequestContactButton - a model defined in OpenAPI"""  # noqa: E501
46 |         super(RequestContactButton, self).__init__(type, text)
47 |         self.discriminator = None
48 | 
49 |     def to_dict(self):
50 |         """Returns the model properties as a dict"""
51 |         result = {}
52 | 
53 |         for attr, _ in six.iteritems(self.openapi_types):
54 |             value = getattr(self, attr)
55 |             if isinstance(value, list):
56 |                 result[attr] = list(map(
57 |                     lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
58 |                     value
59 |                 ))
60 |             elif hasattr(value, "to_dict"):
61 |                 result[attr] = value.to_dict()
62 |             elif isinstance(value, dict):
63 |                 result[attr] = dict(map(
64 |                     lambda item: (item[0], item[1].to_dict())
65 |                     if hasattr(item[1], "to_dict") else item,
66 |                     value.items()
67 |                 ))
68 |             else:
69 |                 result[attr] = value
70 | 
71 |         return result
72 | 
73 |     def to_str(self):
74 |         """Returns the string representation of the model"""
75 |         return pprint.pformat(self.to_dict())
76 | 
77 |     def __repr__(self):
78 |         """For `print` and `pprint`"""
79 |         return self.to_str()
80 | 
81 |     def __eq__(self, other):
82 |         """Returns true if both objects are equal"""
83 |         if not isinstance(other, RequestContactButton):
84 |             return False
85 | 
86 |         return self.__dict__ == other.__dict__
87 | 
88 |     def __ne__(self, other):
89 |         """Returns true if both objects are not equal"""
90 |         return not self == other
91 | 


--------------------------------------------------------------------------------
/models/sender_action.py:
--------------------------------------------------------------------------------
 1 | # coding: utf-8
 2 | 
 3 | """
 4 |     TamTam Bot API
 5 | 
 6 |     # About Bot API allows bots to interact with TamTam. Methods are called by sending HTTPS requests to [botapi.tamtam.chat](https://botapi.tamtam.chat) domain. Bots are third-party applications that use TamTam features. A bot can legitimately take part in a conversation. It can be achieved through HTTP requests to the TamTam Bot API.  ## Features TamTam bots of the current version are able to: - Communicate with users and respond to requests - Recommend users complete actions via programmed buttons - Request personal data from users (name, short reference, phone number) We'll keep working on expanding bot capabilities in the future.  ## Examples Bots can be used for the following purposes: - Providing support, answering frequently asked questions - Sending typical information - Voting - Likes/dislikes - Following external links - Forwarding a user to a chat/channel  ## @PrimeBot [PrimeBot](https://tt.me/primebot) is the main bot in TamTam, all bots creator. Use PrimeBot to create and edit your bots. Feel free to contact us for any questions, [@support](https://tt.me/support) or [team@tamtam.chat](mailto:team@tamtam.chat).  ## HTTP verbs `GET` — getting resources, parameters are transmitted via URL  `POST` — creation of resources (for example, sending new messages)  `PUT` — editing resources  `DELETE` — deleting resources  `PATCH` — patching resources  ## HTTP response codes `200` — successful operation  `400` — invalid request  `401` — authentication error  `404` — resource not found  `405` — method is not allowed  `429` — the number of requests is exceeded  `503` — service unavailable  ## Resources format For content requests (PUT and POST) and responses, the API uses the JSON format. All strings are UTF-8 encoded. Date/time fields are represented as the number of milliseconds that have elapsed since 00:00 January 1, 1970 in the long format. To get it, you can simply multiply the UNIX timestamp by 1000. All date/time fields have a UTC timezone. ## Error responses In case of an error, the API returns a response with the corresponding HTTP code and JSON with the following fields:  `code` - the string with the error key  `message` - a string describing the error 
For example: ```bash > http https://botapi.tamtam.chat/chats?access_token={EXAMPLE_TOKEN} HTTP / 1.1 403 Forbidden Cache-Control: no-cache Connection: Keep-Alive Content-Length: 57 Content-Type: application / json; charset = utf-8 Set-Cookie: web_ui_lang = ru; Path = /; Domain = .tamtam.chat; Expires = 2019-03-24T11: 45: 36.500Z { \"code\": \"verify.token\", \"message\": \"Invalid access_token\" } ``` ## Receiving notifications TamTam Bot API supports 2 options of receiving notifications on new events for bots: - Push notifications via WebHook. To receive data via WebHook, you'll have to [add subscription](https://dev.tamtam.chat/#operation/subscribe); - Notifications upon request via [long polling](#operation/getUpdates) API. All data can be received via long polling **by default** after creating the bot. Both methods **cannot** be used simultaneously. Refer to the response schema of [/updates](https://dev.tamtam.chat/#operation/getUpdates) method to check all available types of updates. ### Webhook There is some notes about how we handle webhook subscription: 1. Sometimes webhook notification cannot be delivered in case when bot server or network is down. In such case we well retry delivery in a short period of time (from 30 to 60 seconds) and will do this until get `200 OK` status code from your server, but not longer than **8 hours** (*may change over time*) since update happened. We also consider any non `200`-response from server as failed delivery. 2. To protect your bot from unexpected high load we send **no more than 100** notifications per second by default. If you want increase this limit, contact us at [@support](https://tt.me/support). It should be from one of the following subnets: ``` 185.16.150.0/30 185.16.150.84/30 185.16.150.152/30 185.16.150.192/30 ``` ## Message buttons You can program buttons for users answering a bot. TamTam supports the following types of buttons: `callback` — sends a notification with payload to a bot (via WebHook or long polling) `link` — makes a user to follow a link `request_contact` — requests the user permission to access contact information (phone number, short link, email) `request_geo_location` — asks user to provide current geo location `chat` — creates chat associated with message To start create buttons [send message](#operation/sendMessage) with `InlineKeyboardAttachment`: ```json { \"text\": \"It is message with inline keyboard\", \"attachments\": [ { \"type\": \"inline_keyboard\", \"payload\": { \"buttons\": [ [ { \"type\": \"callback\", \"text\": \"Press me!\", \"payload\": \"button1 pressed\" } ], [ { \"type\": \"chat\", \"text\": \"Discuss\", \"chat_title\": \"Message discussion\" } ] ] } } ] } ``` ### Chat button Chat button is a button that starts chat assosiated with the current message. It will be **private** chat with a link, bot will be added as administrator by default. Chat will be created as soon as the first user taps on button. Bot will receive `message_chat_created` update. Bot can set title and description of new chat by setting `chat_title` and `chat_description` properties. Whereas keyboard can contain several `chat`-buttons there is `uuid` property to distinct them between each other. In case you do not pass `uuid` we will generate it. If you edit message, pass `uuid` so we know that this button starts the same chat as before. Chat button also can contain `start_payload` that will be sent to bot as part of `message_chat_created` update. ## Deep linking TamTam supports deep linking mechanism for bots. It allows passing additional payload to the bot on startup. Deep link can contain any data encoded into string up to **128** characters long. Longer strings will be omitted and **not** passed to the bot. Each bot has start link that looks like: ``` https://tt.me/%BOT_USERNAME%/start/%PAYLOAD% ``` As soon as user clicks on such link we open dialog with bot and send this payload to bot as part of `bot_started` update: ```json { \"update_type\": \"bot_started\", \"timestamp\": 1573226679188, \"chat_id\": 1234567890, \"user\": { \"user_id\": 1234567890, \"name\": \"Boris\", \"username\": \"borisd84\" }, \"payload\": \"any data meaningful to bot\" } ``` Deep linking mechanism is supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Constructors Constructor is a bot that can create a message for user: add buttons, attach some media, insert text. You can enable constructor mode for your bot via [@PrimeBot](https://tt.me/primebot) sending [/constructor_mode](https://tt.me/primebot/start/constructor_mode) command. For bot developers, it looks like request-response interaction where TamTam application sends `message_construction_request` on behalf of user. Bot [responds](#operation/construct) to it with `messages` ready to go or `keyboard` in case it requires further action from user. Bot also can set up UI parts such as `hint` or `placeholder`, allow or not user's input: ![Constructor UI parts](https://dev.tamtam.chat/static/hint-079a332a51a2e9e6d415ec716389661b.png) As soon as user finishes composing a message, they can post it. Bot will receive `message_constructed_update` with posted message. Constructors are supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Text formatting Message text can be improved with basic formatting such as: **strong**, *emphasis*, ~strikethough~, underline, `code` or link. You can use either markdown-like or HTML formatting. To enable text formatting set the `format` property of [NewMessageBody](#tag/new_message_model). ### TamTam flavored Markdown To enable [Markdown](https://spec.commonmark.org/0.29/) parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `markdown`. We currently support only the following syntax: `*empasized*` or `_empasized_` for *italic* text `**strong**` or `__strong__` for __bold__ text `~~strikethough~~` for ~strikethough~ text `++underline++` for underlined text ``` `code` ``` or ` ```code``` ` for `monospaced` text `^^important^^` for highlighted text (colored in red, by default) `[Inline URL](https://dev.tamtam.chat/)` for inline URLs `[User mention](tamtam://user/%user_id%)` for user mentions without username ### HTML support To enable HTML parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `html`. Only the following HTML tags are supported. All others will be stripped: Emphasized: `` or `` Strong: `` or `` Strikethrough: `` or `` Underlined: `` or `` Link: `Docs` Monospaced text: `
` or ``  Highlighted text: ``  Text formatting is supported for iOS since version 3.1 and Android since 2.20.0.  # Versioning API models and interface may change over time. To make sure your bot will get the right info, we strongly recommend adding API version number to each request. You can add it as `v` parameter to each HTTP-request. For instance, `v=0.1.2`. To specify the data model version you are getting through WebHook subscription, use the `version` property in the request body of the [subscribe](https://dev.tamtam.chat/#operation/subscribe) request.  # Libraries We have developed the official [Java client](https://github.com/tamtam-chat/tamtam-bot-api) and [SDK](https://github.com/tamtam-chat/tamtam-bot-sdk).  Also check out unofficial libraries, created by our enthusiasts: - [Kotlin DSL client](https://github.com/Namazed/TamTamBotApiClientDsl) - [GO client](https://github.com/neonxp/tamtam) - [Node.js module](https://github.com/vershininivan/node-tamtam-botapi)  #### Python: - [Python client](https://github.com/asvbkr/openapi_client) - [tamtam.py](https://github.com/uwinx/tamtam.py) - [registriren/botapitamtam](https://github.com/registriren/botapitamtam)  # Changelog ##### Version 0.3.0 - Added methods to [pin](#operation/pinMessage)/[unpin](#operation/unpinMessage) messages in chats/channels - Added `is_bot` flag to [`User`](#tag/user_model) model  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.1..v0.3.0) for this release.  ##### Version 0.2.1 - [Added](#operation/getChatByLink) method to get chat by its `@link` - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR1240) `description` for users in some cases - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR2555) `user_locale` to `message_created` update in dialogs  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..v0.2.1) for this release.  ##### Version 0.2.0 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/09c95259d6c8c424f82b50eab93872e7db2ca208) new type of button to start new chat - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ea4581d83d7132663d6cc5c2c61c058a2bd46aac) Constructors API that allows bots to create message on behalf of a user - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/c5ff03175407819aceebd9c25de49eed566a0ce1) support for deep-links - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ff4cc4f93662d6c25db11fac72d9fcbf1f66cad8) ability to block users in chats - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/b965bfb0d02933e819435312e6ab184a3dfc0250) `chat_id` and `user_id` to `message_removed` update - Added meta information for video attachments - Other minor improvements and fixes. Check out complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.1.11...v0.1.10) for this version  ##### Version 0.1.10 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/a9ef3a1b8f4e1a75b55a9b80877eddc2c6f07ec4) `disable_link_preview` parameter to POST:/messages method to disable links parsing in text - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/eb99e8ab97b55fa196d9957fca34d2316a4ca8aa) `sending_file` action - [Removed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/7a5ab5f0ea1336b3460d1827a6a7b3b141e19776) several deprecated properties - `photo` upload type [renamed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/74505883e6acb306686a6d141414aeaf5131ef49) to `image`. *C* is for consistency  To see changelog for older versions visit our [GitHub](https://github.com/tamtam-chat/tamtam-bot-api-schema/releases).  # noqa: E501
 7 | 
 8 |     OpenAPI spec version: 0.5.2
 9 |     Generated by: https://openapi-generator.tech
10 | """
11 | 
12 | 
13 | import pprint
14 | import re  # noqa: F401
15 | 
16 | import six
17 | 
18 | 
19 | class SenderAction(object):
20 |     """NOTE: This class is auto generated by OpenAPI Generator.
21 |     Ref: https://openapi-generator.tech
22 | 
23 |     Do not edit the class manually.
24 |     """
25 | 
26 |     """
27 |     allowed enum values
28 |     """
29 |     TYPING_ON = "typing_on"
30 |     SENDING_PHOTO = "sending_photo"
31 |     SENDING_VIDEO = "sending_video"
32 |     SENDING_AUDIO = "sending_audio"
33 |     SENDING_FILE = "sending_file"
34 |     MARK_SEEN = "mark_seen"
35 | 
36 |     """
37 |     Attributes:
38 |       openapi_types (dict): The key is attribute name
39 |                             and the value is attribute type.
40 |       attribute_map (dict): The key is attribute name
41 |                             and the value is json key in definition.
42 |     """
43 |     openapi_types = {
44 |     }
45 | 
46 |     attribute_map = {
47 |     }
48 | 
49 |     def __init__(self):  # noqa: E501
50 |         """SenderAction - a model defined in OpenAPI"""  # noqa: E501
51 |         self.discriminator = None
52 | 
53 |     def to_dict(self):
54 |         """Returns the model properties as a dict"""
55 |         result = {}
56 | 
57 |         for attr, _ in six.iteritems(self.openapi_types):
58 |             value = getattr(self, attr)
59 |             if isinstance(value, list):
60 |                 result[attr] = list(map(
61 |                     lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
62 |                     value
63 |                 ))
64 |             elif hasattr(value, "to_dict"):
65 |                 result[attr] = value.to_dict()
66 |             elif isinstance(value, dict):
67 |                 result[attr] = dict(map(
68 |                     lambda item: (item[0], item[1].to_dict())
69 |                     if hasattr(item[1], "to_dict") else item,
70 |                     value.items()
71 |                 ))
72 |             else:
73 |                 result[attr] = value
74 | 
75 |         return result
76 | 
77 |     def to_str(self):
78 |         """Returns the string representation of the model"""
79 |         return pprint.pformat(self.to_dict())
80 | 
81 |     def __repr__(self):
82 |         """For `print` and `pprint`"""
83 |         return self.to_str()
84 | 
85 |     def __eq__(self, other):
86 |         """Returns true if both objects are equal"""
87 |         if not isinstance(other, SenderAction):
88 |             return False
89 | 
90 |         return self.__dict__ == other.__dict__
91 | 
92 |     def __ne__(self, other):
93 |         """Returns true if both objects are not equal"""
94 |         return not self == other
95 | 


--------------------------------------------------------------------------------
/models/strong_markup.py:
--------------------------------------------------------------------------------
  1 | # coding: utf-8
  2 | 
  3 | # noinspection SpellCheckingInspection
  4 | """
  5 |     TamTam Bot API
  6 | 
  7 |     # About Bot API allows bots to interact with TamTam. Methods are called by sending HTTPS requests to [botapi.tamtam.chat](https://botapi.tamtam.chat) domain. Bots are third-party applications that use TamTam features. A bot can legitimately take part in a conversation. It can be achieved through HTTP requests to the TamTam Bot API.  ## Features TamTam bots of the current version are able to: - Communicate with users and respond to requests - Recommend users complete actions via programmed buttons - Request personal data from users (name, short reference, phone number) We'll keep working on expanding bot capabilities in the future.  ## Examples Bots can be used for the following purposes: - Providing support, answering frequently asked questions - Sending typical information - Voting - Likes/dislikes - Following external links - Forwarding a user to a chat/channel  ## @PrimeBot [PrimeBot](https://tt.me/primebot) is the main bot in TamTam, all bots creator. Use PrimeBot to create and edit your bots. Feel free to contact us for any questions, [@support](https://tt.me/support) or [team@tamtam.chat](mailto:team@tamtam.chat).  ## HTTP verbs `GET` — getting resources, parameters are transmitted via URL  `POST` — creation of resources (for example, sending new messages)  `PUT` — editing resources  `DELETE` — deleting resources  `PATCH` — patching resources  ## HTTP response codes `200` — successful operation  `400` — invalid request  `401` — authentication error  `404` — resource not found  `405` — method is not allowed  `429` — the number of requests is exceeded  `503` — service unavailable  ## Resources format For content requests (PUT and POST) and responses, the API uses the JSON format. All strings are UTF-8 encoded. Date/time fields are represented as the number of milliseconds that have elapsed since 00:00 January 1, 1970 in the long format. To get it, you can simply multiply the UNIX timestamp by 1000. All date/time fields have a UTC timezone. ## Error responses In case of an error, the API returns a response with the corresponding HTTP code and JSON with the following fields:  `code` - the string with the error key  `message` - a string describing the error 
For example: ```bash > http https://botapi.tamtam.chat/chats?access_token={EXAMPLE_TOKEN} HTTP / 1.1 403 Forbidden Cache-Control: no-cache Connection: Keep-Alive Content-Length: 57 Content-Type: application / json; charset = utf-8 Set-Cookie: web_ui_lang = ru; Path = /; Domain = .tamtam.chat; Expires = 2019-03-24T11: 45: 36.500Z { \"code\": \"verify.token\", \"message\": \"Invalid access_token\" } ``` ## Receiving notifications TamTam Bot API supports 2 options of receiving notifications on new events for bots: - Push notifications via WebHook. To receive data via WebHook, you'll have to [add subscription](https://dev.tamtam.chat/#operation/subscribe); - Notifications upon request via [long polling](#operation/getUpdates) API. All data can be received via long polling **by default** after creating the bot. Both methods **cannot** be used simultaneously. Refer to the response schema of [/updates](https://dev.tamtam.chat/#operation/getUpdates) method to check all available types of updates. ### Webhook There is some notes about how we handle webhook subscription: 1. Sometimes webhook notification cannot be delivered in case when bot server or network is down. In such case we well retry delivery in a short period of time (from 30 to 60 seconds) and will do this until get `200 OK` status code from your server, but not longer than **8 hours** (*may change over time*) since update happened. We also consider any non `200`-response from server as failed delivery. 2. To protect your bot from unexpected high load we send **no more than 100** notifications per second by default. If you want increase this limit, contact us at [@support](https://tt.me/support). It should be from one of the following subnets: ``` 185.16.150.0/30 185.16.150.84/30 185.16.150.152/30 185.16.150.192/30 ``` ## Message buttons You can program buttons for users answering a bot. TamTam supports the following types of buttons: `callback` — sends a notification with payload to a bot (via WebHook or long polling) `link` — makes a user to follow a link `request_contact` — requests the user permission to access contact information (phone number, short link, email) `request_geo_location` — asks user to provide current geo location `chat` — creates chat associated with message To start create buttons [send message](#operation/sendMessage) with `InlineKeyboardAttachment`: ```json { \"text\": \"It is message with inline keyboard\", \"attachments\": [ { \"type\": \"inline_keyboard\", \"payload\": { \"buttons\": [ [ { \"type\": \"callback\", \"text\": \"Press me!\", \"payload\": \"button1 pressed\" } ], [ { \"type\": \"chat\", \"text\": \"Discuss\", \"chat_title\": \"Message discussion\" } ] ] } } ] } ``` ### Chat button Chat button is a button that starts chat assosiated with the current message. It will be **private** chat with a link, bot will be added as administrator by default. Chat will be created as soon as the first user taps on button. Bot will receive `message_chat_created` update. Bot can set title and description of new chat by setting `chat_title` and `chat_description` properties. Whereas keyboard can contain several `chat`-buttons there is `uuid` property to distinct them between each other. In case you do not pass `uuid` we will generate it. If you edit message, pass `uuid` so we know that this button starts the same chat as before. Chat button also can contain `start_payload` that will be sent to bot as part of `message_chat_created` update. ## Deep linking TamTam supports deep linking mechanism for bots. It allows passing additional payload to the bot on startup. Deep link can contain any data encoded into string up to **128** characters long. Longer strings will be omitted and **not** passed to the bot. Each bot has start link that looks like: ``` https://tt.me/%BOT_USERNAME%/start/%PAYLOAD% ``` As soon as user clicks on such link we open dialog with bot and send this payload to bot as part of `bot_started` update: ```json { \"update_type\": \"bot_started\", \"timestamp\": 1573226679188, \"chat_id\": 1234567890, \"user\": { \"user_id\": 1234567890, \"name\": \"Boris\", \"username\": \"borisd84\" }, \"payload\": \"any data meaningful to bot\" } ``` Deep linking mechanism is supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Constructors Constructor is a bot that can create a message for user: add buttons, attach some media, insert text. You can enable constructor mode for your bot via [@PrimeBot](https://tt.me/primebot) sending [/constructor_mode](https://tt.me/primebot/start/constructor_mode) command. For bot developers, it looks like request-response interaction where TamTam application sends `message_construction_request` on behalf of user. Bot [responds](#operation/construct) to it with `messages` ready to go or `keyboard` in case it requires further action from user. Bot also can set up UI parts such as `hint` or `placeholder`, allow or not user's input: ![Constructor UI parts](https://dev.tamtam.chat/static/hint-079a332a51a2e9e6d415ec716389661b.png) As soon as user finishes composing a message, they can post it. Bot will receive `message_constructed_update` with posted message. Constructors are supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Text formatting Message text can be improved with basic formatting such as: **strong**, *emphasis*, ~strikethough~, underline, `code` or link. You can use either markdown-like or HTML formatting. To enable text formatting set the `format` property of [NewMessageBody](#tag/new_message_model). ### TamTam flavored Markdown To enable [Markdown](https://spec.commonmark.org/0.29/) parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `markdown`. We currently support only the following syntax: `*empasized*` or `_empasized_` for *italic* text `**strong**` or `__strong__` for __bold__ text `~~strikethough~~` for ~strikethough~ text `++underline++` for underlined text ``` `code` ``` or ` ```code``` ` for `monospaced` text `^^important^^` for highlighted text (colored in red, by default) `[Inline URL](https://dev.tamtam.chat/)` for inline URLs `[User mention](tamtam://user/%user_id%)` for user mentions without username ### HTML support To enable HTML parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `html`. Only the following HTML tags are supported. All others will be stripped: Emphasized: `` or `` Strong: `` or `` Strikethrough: `` or `` Underlined: `` or `` Link: `Docs` Monospaced text: `
` or ``  Highlighted text: ``  Text formatting is supported for iOS since version 3.1 and Android since 2.20.0.  # Versioning API models and interface may change over time. To make sure your bot will get the right info, we strongly recommend adding API version number to each request. You can add it as `v` parameter to each HTTP-request. For instance, `v=0.1.2`. To specify the data model version you are getting through WebHook subscription, use the `version` property in the request body of the [subscribe](https://dev.tamtam.chat/#operation/subscribe) request.  # Libraries We have developed the official [Java client](https://github.com/tamtam-chat/tamtam-bot-api) and [SDK](https://github.com/tamtam-chat/tamtam-bot-sdk).  Also check out unofficial libraries, created by our enthusiasts: - [Kotlin DSL client](https://github.com/Namazed/TamTamBotApiClientDsl) - [GO client](https://github.com/neonxp/tamtam) - [Node.js module](https://github.com/vershininivan/node-tamtam-botapi)  #### Python: - [Python client](https://github.com/asvbkr/openapi_client) - [tamtam.py](https://github.com/uwinx/tamtam.py) - [registriren/botapitamtam](https://github.com/registriren/botapitamtam)  # Changelog ##### Version 0.3.0 - Added methods to [pin](#operation/pinMessage)/[unpin](#operation/unpinMessage) messages in chats/channels - Added `is_bot` flag to [`User`](#tag/user_model) model  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.1..v0.3.0) for this release.  ##### Version 0.2.1 - [Added](#operation/getChatByLink) method to get chat by its `@link` - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR1240) `description` for users in some cases - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR2555) `user_locale` to `message_created` update in dialogs  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..v0.2.1) for this release.  ##### Version 0.2.0 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/09c95259d6c8c424f82b50eab93872e7db2ca208) new type of button to start new chat - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ea4581d83d7132663d6cc5c2c61c058a2bd46aac) Constructors API that allows bots to create message on behalf of a user - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/c5ff03175407819aceebd9c25de49eed566a0ce1) support for deep-links - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ff4cc4f93662d6c25db11fac72d9fcbf1f66cad8) ability to block users in chats - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/b965bfb0d02933e819435312e6ab184a3dfc0250) `chat_id` and `user_id` to `message_removed` update - Added meta information for video attachments - Other minor improvements and fixes. Check out complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.1.11...v0.1.10) for this version  ##### Version 0.1.10 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/a9ef3a1b8f4e1a75b55a9b80877eddc2c6f07ec4) `disable_link_preview` parameter to POST:/messages method to disable links parsing in text - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/eb99e8ab97b55fa196d9957fca34d2316a4ca8aa) `sending_file` action - [Removed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/7a5ab5f0ea1336b3460d1827a6a7b3b141e19776) several deprecated properties - `photo` upload type [renamed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/74505883e6acb306686a6d141414aeaf5131ef49) to `image`. *C* is for consistency  To see changelog for older versions visit our [GitHub](https://github.com/tamtam-chat/tamtam-bot-api-schema/releases).  # noqa: E501
  8 | 
  9 |     OpenAPI spec version: 0.5.2
 10 |     Generated by: https://openapi-generator.tech
 11 | """
 12 | 
 13 | import pprint
 14 | import re  # noqa: F401
 15 | 
 16 | import six
 17 | 
 18 | from .markup_element import MarkupElement
 19 | 
 20 | from .text_format import TextFormat
 21 | 
 22 | 
 23 | # noinspection PyShadowingBuiltins
 24 | class StrongMarkup(MarkupElement):
 25 |     """NOTE: This class is auto generated by OpenAPI Generator.
 26 |     Ref: https://openapi-generator.tech
 27 | 
 28 |     Do not edit the class manually.
 29 |     """
 30 | 
 31 |     """
 32 |     Attributes:
 33 |       openapi_types (dict): The key is attribute name
 34 |                             and the value is attribute type.
 35 |       attribute_map (dict): The key is attribute name
 36 |                             and the value is json key in definition.
 37 |     """
 38 |     openapi_types = {
 39 |         'type': 'str',
 40 |         '_from': 'int',
 41 |         'length': 'int',
 42 |     }
 43 | 
 44 |     attribute_map = {
 45 |         'type': 'type',
 46 |         '_from': 'from',
 47 |         'length': 'length',
 48 |     }
 49 | 
 50 |     def __init__(self, type="strong", _from=None, length=None):  # noqa: E501
 51 |         """StrongMarkup - a model defined in OpenAPI"""  # noqa: E501
 52 |         super(StrongMarkup, self).__init__(type, _from, length)
 53 |         self.discriminator = None
 54 | 
 55 |     def markup_apply(self, text, format):
 56 |         # type: (str, TextFormat) -> str
 57 |         if format == TextFormat.HTML:
 58 |             return f'{text}'
 59 |         else:
 60 |             return f'**{text}**'
 61 | 
 62 |     def to_dict(self):
 63 |         """Returns the model properties as a dict"""
 64 |         result = {}
 65 | 
 66 |         for attr, _ in six.iteritems(self.openapi_types):
 67 |             value = getattr(self, attr)
 68 |             if isinstance(value, list):
 69 |                 result[attr] = list(map(
 70 |                     lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
 71 |                     value
 72 |                 ))
 73 |             elif hasattr(value, "to_dict"):
 74 |                 result[attr] = value.to_dict()
 75 |             elif isinstance(value, dict):
 76 |                 result[attr] = dict(map(
 77 |                     lambda item: (item[0], item[1].to_dict())
 78 |                     if hasattr(item[1], "to_dict") else item,
 79 |                     value.items()
 80 |                 ))
 81 |             else:
 82 |                 result[attr] = value
 83 | 
 84 |         return result
 85 | 
 86 |     def to_str(self):
 87 |         """Returns the string representation of the model"""
 88 |         return pprint.pformat(self.to_dict())
 89 | 
 90 |     def __repr__(self):
 91 |         """For `print` and `pprint`"""
 92 |         return self.to_str()
 93 | 
 94 |     def __eq__(self, other):
 95 |         """Returns true if both objects are equal"""
 96 |         if not isinstance(other, StrongMarkup):
 97 |             return False
 98 | 
 99 |         return self.__dict__ == other.__dict__
100 | 
101 |     def __ne__(self, other):
102 |         """Returns true if both objects are not equal"""
103 |         return not self == other
104 | 
105 |     def __hash__(self):
106 |         return super().__hash__()
107 | 


--------------------------------------------------------------------------------
/models/text_format.py:
--------------------------------------------------------------------------------
 1 | # coding: utf-8
 2 | 
 3 | """
 4 |     TamTam Bot API
 5 | 
 6 |     # About Bot API allows bots to interact with TamTam. Methods are called by sending HTTPS requests to [botapi.tamtam.chat](https://botapi.tamtam.chat) domain. Bots are third-party applications that use TamTam features. A bot can legitimately take part in a conversation. It can be achieved through HTTP requests to the TamTam Bot API.  ## Features TamTam bots of the current version are able to: - Communicate with users and respond to requests - Recommend users complete actions via programmed buttons - Request personal data from users (name, short reference, phone number) We'll keep working on expanding bot capabilities in the future.  ## Examples Bots can be used for the following purposes: - Providing support, answering frequently asked questions - Sending typical information - Voting - Likes/dislikes - Following external links - Forwarding a user to a chat/channel  ## @PrimeBot [PrimeBot](https://tt.me/primebot) is the main bot in TamTam, all bots creator. Use PrimeBot to create and edit your bots. Feel free to contact us for any questions, [@support](https://tt.me/support) or [team@tamtam.chat](mailto:team@tamtam.chat).  ## HTTP verbs `GET` — getting resources, parameters are transmitted via URL  `POST` — creation of resources (for example, sending new messages)  `PUT` — editing resources  `DELETE` — deleting resources  `PATCH` — patching resources  ## HTTP response codes `200` — successful operation  `400` — invalid request  `401` — authentication error  `404` — resource not found  `405` — method is not allowed  `429` — the number of requests is exceeded  `503` — service unavailable  ## Resources format For content requests (PUT and POST) and responses, the API uses the JSON format. All strings are UTF-8 encoded. Date/time fields are represented as the number of milliseconds that have elapsed since 00:00 January 1, 1970 in the long format. To get it, you can simply multiply the UNIX timestamp by 1000. All date/time fields have a UTC timezone. ## Error responses In case of an error, the API returns a response with the corresponding HTTP code and JSON with the following fields:  `code` - the string with the error key  `message` - a string describing the error 
For example: ```bash > http https://botapi.tamtam.chat/chats?access_token={EXAMPLE_TOKEN} HTTP / 1.1 403 Forbidden Cache-Control: no-cache Connection: Keep-Alive Content-Length: 57 Content-Type: application / json; charset = utf-8 Set-Cookie: web_ui_lang = ru; Path = /; Domain = .tamtam.chat; Expires = 2019-03-24T11: 45: 36.500Z { \"code\": \"verify.token\", \"message\": \"Invalid access_token\" } ``` ## Receiving notifications TamTam Bot API supports 2 options of receiving notifications on new events for bots: - Push notifications via WebHook. To receive data via WebHook, you'll have to [add subscription](https://dev.tamtam.chat/#operation/subscribe); - Notifications upon request via [long polling](#operation/getUpdates) API. All data can be received via long polling **by default** after creating the bot. Both methods **cannot** be used simultaneously. Refer to the response schema of [/updates](https://dev.tamtam.chat/#operation/getUpdates) method to check all available types of updates. ### Webhook There is some notes about how we handle webhook subscription: 1. Sometimes webhook notification cannot be delivered in case when bot server or network is down. In such case we well retry delivery in a short period of time (from 30 to 60 seconds) and will do this until get `200 OK` status code from your server, but not longer than **8 hours** (*may change over time*) since update happened. We also consider any non `200`-response from server as failed delivery. 2. To protect your bot from unexpected high load we send **no more than 100** notifications per second by default. If you want increase this limit, contact us at [@support](https://tt.me/support). It should be from one of the following subnets: ``` 185.16.150.0/30 185.16.150.84/30 185.16.150.152/30 185.16.150.192/30 ``` ## Message buttons You can program buttons for users answering a bot. TamTam supports the following types of buttons: `callback` — sends a notification with payload to a bot (via WebHook or long polling) `link` — makes a user to follow a link `request_contact` — requests the user permission to access contact information (phone number, short link, email) `request_geo_location` — asks user to provide current geo location `chat` — creates chat associated with message To start create buttons [send message](#operation/sendMessage) with `InlineKeyboardAttachment`: ```json { \"text\": \"It is message with inline keyboard\", \"attachments\": [ { \"type\": \"inline_keyboard\", \"payload\": { \"buttons\": [ [ { \"type\": \"callback\", \"text\": \"Press me!\", \"payload\": \"button1 pressed\" } ], [ { \"type\": \"chat\", \"text\": \"Discuss\", \"chat_title\": \"Message discussion\" } ] ] } } ] } ``` ### Chat button Chat button is a button that starts chat assosiated with the current message. It will be **private** chat with a link, bot will be added as administrator by default. Chat will be created as soon as the first user taps on button. Bot will receive `message_chat_created` update. Bot can set title and description of new chat by setting `chat_title` and `chat_description` properties. Whereas keyboard can contain several `chat`-buttons there is `uuid` property to distinct them between each other. In case you do not pass `uuid` we will generate it. If you edit message, pass `uuid` so we know that this button starts the same chat as before. Chat button also can contain `start_payload` that will be sent to bot as part of `message_chat_created` update. ## Deep linking TamTam supports deep linking mechanism for bots. It allows passing additional payload to the bot on startup. Deep link can contain any data encoded into string up to **128** characters long. Longer strings will be omitted and **not** passed to the bot. Each bot has start link that looks like: ``` https://tt.me/%BOT_USERNAME%/start/%PAYLOAD% ``` As soon as user clicks on such link we open dialog with bot and send this payload to bot as part of `bot_started` update: ```json { \"update_type\": \"bot_started\", \"timestamp\": 1573226679188, \"chat_id\": 1234567890, \"user\": { \"user_id\": 1234567890, \"name\": \"Boris\", \"username\": \"borisd84\" }, \"payload\": \"any data meaningful to bot\" } ``` Deep linking mechanism is supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Constructors Constructor is a bot that can create a message for user: add buttons, attach some media, insert text. You can enable constructor mode for your bot via [@PrimeBot](https://tt.me/primebot) sending [/constructor_mode](https://tt.me/primebot/start/constructor_mode) command. For bot developers, it looks like request-response interaction where TamTam application sends `message_construction_request` on behalf of user. Bot [responds](#operation/construct) to it with `messages` ready to go or `keyboard` in case it requires further action from user. Bot also can set up UI parts such as `hint` or `placeholder`, allow or not user's input: ![Constructor UI parts](https://dev.tamtam.chat/static/hint-079a332a51a2e9e6d415ec716389661b.png) As soon as user finishes composing a message, they can post it. Bot will receive `message_constructed_update` with posted message. Constructors are supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Text formatting Message text can be improved with basic formatting such as: **strong**, *emphasis*, ~strikethough~, underline, `code` or link. You can use either markdown-like or HTML formatting. To enable text formatting set the `format` property of [NewMessageBody](#tag/new_message_model). ### TamTam flavored Markdown To enable [Markdown](https://spec.commonmark.org/0.29/) parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `markdown`. We currently support only the following syntax: `*empasized*` or `_empasized_` for *italic* text `**strong**` or `__strong__` for __bold__ text `~~strikethough~~` for ~strikethough~ text `++underline++` for underlined text ``` `code` ``` or ` ```code``` ` for `monospaced` text `^^important^^` for highlighted text (colored in red, by default) `[Inline URL](https://dev.tamtam.chat/)` for inline URLs `[User mention](tamtam://user/%user_id%)` for user mentions without username ### HTML support To enable HTML parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `html`. Only the following HTML tags are supported. All others will be stripped: Emphasized: `` or `` Strong: `` or `` Strikethrough: `` or `` Underlined: `` or `` Link: `Docs` Monospaced text: `
` or ``  Highlighted text: ``  Text formatting is supported for iOS since version 3.1 and Android since 2.20.0.  # Versioning API models and interface may change over time. To make sure your bot will get the right info, we strongly recommend adding API version number to each request. You can add it as `v` parameter to each HTTP-request. For instance, `v=0.1.2`. To specify the data model version you are getting through WebHook subscription, use the `version` property in the request body of the [subscribe](https://dev.tamtam.chat/#operation/subscribe) request.  # Libraries We have developed the official [Java client](https://github.com/tamtam-chat/tamtam-bot-api) and [SDK](https://github.com/tamtam-chat/tamtam-bot-sdk).  Also check out unofficial libraries, created by our enthusiasts: - [Kotlin DSL client](https://github.com/Namazed/TamTamBotApiClientDsl) - [GO client](https://github.com/neonxp/tamtam) - [Node.js module](https://github.com/vershininivan/node-tamtam-botapi)  #### Python: - [Python client](https://github.com/asvbkr/openapi_client) - [tamtam.py](https://github.com/uwinx/tamtam.py) - [registriren/botapitamtam](https://github.com/registriren/botapitamtam)  # Changelog ##### Version 0.3.0 - Added methods to [pin](#operation/pinMessage)/[unpin](#operation/unpinMessage) messages in chats/channels - Added `is_bot` flag to [`User`](#tag/user_model) model  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.1..v0.3.0) for this release.  ##### Version 0.2.1 - [Added](#operation/getChatByLink) method to get chat by its `@link` - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR1240) `description` for users in some cases - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR2555) `user_locale` to `message_created` update in dialogs  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..v0.2.1) for this release.  ##### Version 0.2.0 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/09c95259d6c8c424f82b50eab93872e7db2ca208) new type of button to start new chat - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ea4581d83d7132663d6cc5c2c61c058a2bd46aac) Constructors API that allows bots to create message on behalf of a user - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/c5ff03175407819aceebd9c25de49eed566a0ce1) support for deep-links - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ff4cc4f93662d6c25db11fac72d9fcbf1f66cad8) ability to block users in chats - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/b965bfb0d02933e819435312e6ab184a3dfc0250) `chat_id` and `user_id` to `message_removed` update - Added meta information for video attachments - Other minor improvements and fixes. Check out complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.1.11...v0.1.10) for this version  ##### Version 0.1.10 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/a9ef3a1b8f4e1a75b55a9b80877eddc2c6f07ec4) `disable_link_preview` parameter to POST:/messages method to disable links parsing in text - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/eb99e8ab97b55fa196d9957fca34d2316a4ca8aa) `sending_file` action - [Removed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/7a5ab5f0ea1336b3460d1827a6a7b3b141e19776) several deprecated properties - `photo` upload type [renamed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/74505883e6acb306686a6d141414aeaf5131ef49) to `image`. *C* is for consistency  To see changelog for older versions visit our [GitHub](https://github.com/tamtam-chat/tamtam-bot-api-schema/releases).  # noqa: E501
 7 | 
 8 |     OpenAPI spec version: 0.5.2
 9 |     Generated by: https://openapi-generator.tech
10 | """
11 | 
12 | 
13 | import pprint
14 | import re  # noqa: F401
15 | 
16 | import six
17 | 
18 | 
19 | class TextFormat(object):
20 |     """NOTE: This class is auto generated by OpenAPI Generator.
21 |     Ref: https://openapi-generator.tech
22 | 
23 |     Do not edit the class manually.
24 |     """
25 | 
26 |     """
27 |     allowed enum values
28 |     """
29 |     MARKDOWN = "markdown"
30 |     HTML = "html"
31 | 
32 |     """
33 |     Attributes:
34 |       openapi_types (dict): The key is attribute name
35 |                             and the value is attribute type.
36 |       attribute_map (dict): The key is attribute name
37 |                             and the value is json key in definition.
38 |     """
39 |     openapi_types = {
40 |     }
41 | 
42 |     attribute_map = {
43 |     }
44 | 
45 |     def __init__(self):  # noqa: E501
46 |         """TextFormat - a model defined in OpenAPI"""  # noqa: E501
47 |         self.discriminator = None
48 | 
49 |     def to_dict(self):
50 |         """Returns the model properties as a dict"""
51 |         result = {}
52 | 
53 |         for attr, _ in six.iteritems(self.openapi_types):
54 |             value = getattr(self, attr)
55 |             if isinstance(value, list):
56 |                 result[attr] = list(map(
57 |                     lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
58 |                     value
59 |                 ))
60 |             elif hasattr(value, "to_dict"):
61 |                 result[attr] = value.to_dict()
62 |             elif isinstance(value, dict):
63 |                 result[attr] = dict(map(
64 |                     lambda item: (item[0], item[1].to_dict())
65 |                     if hasattr(item[1], "to_dict") else item,
66 |                     value.items()
67 |                 ))
68 |             else:
69 |                 result[attr] = value
70 | 
71 |         return result
72 | 
73 |     def to_str(self):
74 |         """Returns the string representation of the model"""
75 |         return pprint.pformat(self.to_dict())
76 | 
77 |     def __repr__(self):
78 |         """For `print` and `pprint`"""
79 |         return self.to_str()
80 | 
81 |     def __eq__(self, other):
82 |         """Returns true if both objects are equal"""
83 |         if not isinstance(other, TextFormat):
84 |             return False
85 | 
86 |         return self.__dict__ == other.__dict__
87 | 
88 |     def __ne__(self, other):
89 |         """Returns true if both objects are not equal"""
90 |         return not self == other
91 | 


--------------------------------------------------------------------------------
/models/underline_markup.py:
--------------------------------------------------------------------------------
  1 | # coding: utf-8
  2 | 
  3 | # noinspection SpellCheckingInspection
  4 | """
  5 |     TamTam Bot API
  6 | 
  7 |     # About Bot API allows bots to interact with TamTam. Methods are called by sending HTTPS requests to [botapi.tamtam.chat](https://botapi.tamtam.chat) domain. Bots are third-party applications that use TamTam features. A bot can legitimately take part in a conversation. It can be achieved through HTTP requests to the TamTam Bot API.  ## Features TamTam bots of the current version are able to: - Communicate with users and respond to requests - Recommend users complete actions via programmed buttons - Request personal data from users (name, short reference, phone number) We'll keep working on expanding bot capabilities in the future.  ## Examples Bots can be used for the following purposes: - Providing support, answering frequently asked questions - Sending typical information - Voting - Likes/dislikes - Following external links - Forwarding a user to a chat/channel  ## @PrimeBot [PrimeBot](https://tt.me/primebot) is the main bot in TamTam, all bots creator. Use PrimeBot to create and edit your bots. Feel free to contact us for any questions, [@support](https://tt.me/support) or [team@tamtam.chat](mailto:team@tamtam.chat).  ## HTTP verbs `GET` — getting resources, parameters are transmitted via URL  `POST` — creation of resources (for example, sending new messages)  `PUT` — editing resources  `DELETE` — deleting resources  `PATCH` — patching resources  ## HTTP response codes `200` — successful operation  `400` — invalid request  `401` — authentication error  `404` — resource not found  `405` — method is not allowed  `429` — the number of requests is exceeded  `503` — service unavailable  ## Resources format For content requests (PUT and POST) and responses, the API uses the JSON format. All strings are UTF-8 encoded. Date/time fields are represented as the number of milliseconds that have elapsed since 00:00 January 1, 1970 in the long format. To get it, you can simply multiply the UNIX timestamp by 1000. All date/time fields have a UTC timezone. ## Error responses In case of an error, the API returns a response with the corresponding HTTP code and JSON with the following fields:  `code` - the string with the error key  `message` - a string describing the error 
For example: ```bash > http https://botapi.tamtam.chat/chats?access_token={EXAMPLE_TOKEN} HTTP / 1.1 403 Forbidden Cache-Control: no-cache Connection: Keep-Alive Content-Length: 57 Content-Type: application / json; charset = utf-8 Set-Cookie: web_ui_lang = ru; Path = /; Domain = .tamtam.chat; Expires = 2019-03-24T11: 45: 36.500Z { \"code\": \"verify.token\", \"message\": \"Invalid access_token\" } ``` ## Receiving notifications TamTam Bot API supports 2 options of receiving notifications on new events for bots: - Push notifications via WebHook. To receive data via WebHook, you'll have to [add subscription](https://dev.tamtam.chat/#operation/subscribe); - Notifications upon request via [long polling](#operation/getUpdates) API. All data can be received via long polling **by default** after creating the bot. Both methods **cannot** be used simultaneously. Refer to the response schema of [/updates](https://dev.tamtam.chat/#operation/getUpdates) method to check all available types of updates. ### Webhook There is some notes about how we handle webhook subscription: 1. Sometimes webhook notification cannot be delivered in case when bot server or network is down. In such case we well retry delivery in a short period of time (from 30 to 60 seconds) and will do this until get `200 OK` status code from your server, but not longer than **8 hours** (*may change over time*) since update happened. We also consider any non `200`-response from server as failed delivery. 2. To protect your bot from unexpected high load we send **no more than 100** notifications per second by default. If you want increase this limit, contact us at [@support](https://tt.me/support). It should be from one of the following subnets: ``` 185.16.150.0/30 185.16.150.84/30 185.16.150.152/30 185.16.150.192/30 ``` ## Message buttons You can program buttons for users answering a bot. TamTam supports the following types of buttons: `callback` — sends a notification with payload to a bot (via WebHook or long polling) `link` — makes a user to follow a link `request_contact` — requests the user permission to access contact information (phone number, short link, email) `request_geo_location` — asks user to provide current geo location `chat` — creates chat associated with message To start create buttons [send message](#operation/sendMessage) with `InlineKeyboardAttachment`: ```json { \"text\": \"It is message with inline keyboard\", \"attachments\": [ { \"type\": \"inline_keyboard\", \"payload\": { \"buttons\": [ [ { \"type\": \"callback\", \"text\": \"Press me!\", \"payload\": \"button1 pressed\" } ], [ { \"type\": \"chat\", \"text\": \"Discuss\", \"chat_title\": \"Message discussion\" } ] ] } } ] } ``` ### Chat button Chat button is a button that starts chat assosiated with the current message. It will be **private** chat with a link, bot will be added as administrator by default. Chat will be created as soon as the first user taps on button. Bot will receive `message_chat_created` update. Bot can set title and description of new chat by setting `chat_title` and `chat_description` properties. Whereas keyboard can contain several `chat`-buttons there is `uuid` property to distinct them between each other. In case you do not pass `uuid` we will generate it. If you edit message, pass `uuid` so we know that this button starts the same chat as before. Chat button also can contain `start_payload` that will be sent to bot as part of `message_chat_created` update. ## Deep linking TamTam supports deep linking mechanism for bots. It allows passing additional payload to the bot on startup. Deep link can contain any data encoded into string up to **128** characters long. Longer strings will be omitted and **not** passed to the bot. Each bot has start link that looks like: ``` https://tt.me/%BOT_USERNAME%/start/%PAYLOAD% ``` As soon as user clicks on such link we open dialog with bot and send this payload to bot as part of `bot_started` update: ```json { \"update_type\": \"bot_started\", \"timestamp\": 1573226679188, \"chat_id\": 1234567890, \"user\": { \"user_id\": 1234567890, \"name\": \"Boris\", \"username\": \"borisd84\" }, \"payload\": \"any data meaningful to bot\" } ``` Deep linking mechanism is supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Constructors Constructor is a bot that can create a message for user: add buttons, attach some media, insert text. You can enable constructor mode for your bot via [@PrimeBot](https://tt.me/primebot) sending [/constructor_mode](https://tt.me/primebot/start/constructor_mode) command. For bot developers, it looks like request-response interaction where TamTam application sends `message_construction_request` on behalf of user. Bot [responds](#operation/construct) to it with `messages` ready to go or `keyboard` in case it requires further action from user. Bot also can set up UI parts such as `hint` or `placeholder`, allow or not user's input: ![Constructor UI parts](https://dev.tamtam.chat/static/hint-079a332a51a2e9e6d415ec716389661b.png) As soon as user finishes composing a message, they can post it. Bot will receive `message_constructed_update` with posted message. Constructors are supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Text formatting Message text can be improved with basic formatting such as: **strong**, *emphasis*, ~strikethough~, underline, `code` or link. You can use either markdown-like or HTML formatting. To enable text formatting set the `format` property of [NewMessageBody](#tag/new_message_model). ### TamTam flavored Markdown To enable [Markdown](https://spec.commonmark.org/0.29/) parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `markdown`. We currently support only the following syntax: `*empasized*` or `_empasized_` for *italic* text `**strong**` or `__strong__` for __bold__ text `~~strikethough~~` for ~strikethough~ text `++underline++` for underlined text ``` `code` ``` or ` ```code``` ` for `monospaced` text `^^important^^` for highlighted text (colored in red, by default) `[Inline URL](https://dev.tamtam.chat/)` for inline URLs `[User mention](tamtam://user/%user_id%)` for user mentions without username ### HTML support To enable HTML parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `html`. Only the following HTML tags are supported. All others will be stripped: Emphasized: `` or `` Strong: `` or `` Strikethrough: `` or `` Underlined: `` or `` Link: `Docs` Monospaced text: `
` or ``  Highlighted text: ``  Text formatting is supported for iOS since version 3.1 and Android since 2.20.0.  # Versioning API models and interface may change over time. To make sure your bot will get the right info, we strongly recommend adding API version number to each request. You can add it as `v` parameter to each HTTP-request. For instance, `v=0.1.2`. To specify the data model version you are getting through WebHook subscription, use the `version` property in the request body of the [subscribe](https://dev.tamtam.chat/#operation/subscribe) request.  # Libraries We have developed the official [Java client](https://github.com/tamtam-chat/tamtam-bot-api) and [SDK](https://github.com/tamtam-chat/tamtam-bot-sdk).  Also check out unofficial libraries, created by our enthusiasts: - [Kotlin DSL client](https://github.com/Namazed/TamTamBotApiClientDsl) - [GO client](https://github.com/neonxp/tamtam) - [Node.js module](https://github.com/vershininivan/node-tamtam-botapi)  #### Python: - [Python client](https://github.com/asvbkr/openapi_client) - [tamtam.py](https://github.com/uwinx/tamtam.py) - [registriren/botapitamtam](https://github.com/registriren/botapitamtam)  # Changelog ##### Version 0.3.0 - Added methods to [pin](#operation/pinMessage)/[unpin](#operation/unpinMessage) messages in chats/channels - Added `is_bot` flag to [`User`](#tag/user_model) model  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.1..v0.3.0) for this release.  ##### Version 0.2.1 - [Added](#operation/getChatByLink) method to get chat by its `@link` - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR1240) `description` for users in some cases - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR2555) `user_locale` to `message_created` update in dialogs  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..v0.2.1) for this release.  ##### Version 0.2.0 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/09c95259d6c8c424f82b50eab93872e7db2ca208) new type of button to start new chat - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ea4581d83d7132663d6cc5c2c61c058a2bd46aac) Constructors API that allows bots to create message on behalf of a user - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/c5ff03175407819aceebd9c25de49eed566a0ce1) support for deep-links - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ff4cc4f93662d6c25db11fac72d9fcbf1f66cad8) ability to block users in chats - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/b965bfb0d02933e819435312e6ab184a3dfc0250) `chat_id` and `user_id` to `message_removed` update - Added meta information for video attachments - Other minor improvements and fixes. Check out complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.1.11...v0.1.10) for this version  ##### Version 0.1.10 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/a9ef3a1b8f4e1a75b55a9b80877eddc2c6f07ec4) `disable_link_preview` parameter to POST:/messages method to disable links parsing in text - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/eb99e8ab97b55fa196d9957fca34d2316a4ca8aa) `sending_file` action - [Removed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/7a5ab5f0ea1336b3460d1827a6a7b3b141e19776) several deprecated properties - `photo` upload type [renamed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/74505883e6acb306686a6d141414aeaf5131ef49) to `image`. *C* is for consistency  To see changelog for older versions visit our [GitHub](https://github.com/tamtam-chat/tamtam-bot-api-schema/releases).  # noqa: E501
  8 | 
  9 |     OpenAPI spec version: 0.5.2
 10 |     Generated by: https://openapi-generator.tech
 11 | """
 12 | 
 13 | import pprint
 14 | import re  # noqa: F401
 15 | 
 16 | import six
 17 | 
 18 | from .markup_element import MarkupElement
 19 | 
 20 | from .text_format import TextFormat
 21 | 
 22 | 
 23 | # noinspection PyShadowingBuiltins
 24 | class UnderlineMarkup(MarkupElement):
 25 |     """NOTE: This class is auto generated by OpenAPI Generator.
 26 |     Ref: https://openapi-generator.tech
 27 | 
 28 |     Do not edit the class manually.
 29 |     """
 30 | 
 31 |     """
 32 |     Attributes:
 33 |       openapi_types (dict): The key is attribute name
 34 |                             and the value is attribute type.
 35 |       attribute_map (dict): The key is attribute name
 36 |                             and the value is json key in definition.
 37 |     """
 38 |     openapi_types = {
 39 |         'type': 'str',
 40 |         '_from': 'int',
 41 |         'length': 'int',
 42 |     }
 43 | 
 44 |     attribute_map = {
 45 |         'type': 'type',
 46 |         '_from': 'from',
 47 |         'length': 'length',
 48 |     }
 49 | 
 50 |     def __init__(self, type="underline", _from=None, length=None):  # noqa: E501
 51 |         """UnderlineMarkup - a model defined in OpenAPI"""  # noqa: E501
 52 |         super(UnderlineMarkup, self).__init__(type, _from, length)
 53 |         self.discriminator = None
 54 | 
 55 |     def markup_apply(self, text, format):
 56 |         # type: (str, TextFormat) -> str
 57 |         if format == TextFormat.HTML:
 58 |             return f'{text}'
 59 |         else:
 60 |             return f'++{text}++'
 61 | 
 62 |     def to_dict(self):
 63 |         """Returns the model properties as a dict"""
 64 |         result = {}
 65 | 
 66 |         for attr, _ in six.iteritems(self.openapi_types):
 67 |             value = getattr(self, attr)
 68 |             if isinstance(value, list):
 69 |                 result[attr] = list(map(
 70 |                     lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
 71 |                     value
 72 |                 ))
 73 |             elif hasattr(value, "to_dict"):
 74 |                 result[attr] = value.to_dict()
 75 |             elif isinstance(value, dict):
 76 |                 result[attr] = dict(map(
 77 |                     lambda item: (item[0], item[1].to_dict())
 78 |                     if hasattr(item[1], "to_dict") else item,
 79 |                     value.items()
 80 |                 ))
 81 |             else:
 82 |                 result[attr] = value
 83 | 
 84 |         return result
 85 | 
 86 |     def to_str(self):
 87 |         """Returns the string representation of the model"""
 88 |         return pprint.pformat(self.to_dict())
 89 | 
 90 |     def __repr__(self):
 91 |         """For `print` and `pprint`"""
 92 |         return self.to_str()
 93 | 
 94 |     def __eq__(self, other):
 95 |         """Returns true if both objects are equal"""
 96 |         if not isinstance(other, UnderlineMarkup):
 97 |             return False
 98 | 
 99 |         return self.__dict__ == other.__dict__
100 | 
101 |     def __ne__(self, other):
102 |         """Returns true if both objects are not equal"""
103 |         return not self == other
104 | 
105 |     def __hash__(self):
106 |         return super().__hash__()
107 | 


--------------------------------------------------------------------------------
/models/upload_type.py:
--------------------------------------------------------------------------------
 1 | # coding: utf-8
 2 | 
 3 | """
 4 |     TamTam Bot API
 5 | 
 6 |     # About Bot API allows bots to interact with TamTam. Methods are called by sending HTTPS requests to [botapi.tamtam.chat](https://botapi.tamtam.chat) domain. Bots are third-party applications that use TamTam features. A bot can legitimately take part in a conversation. It can be achieved through HTTP requests to the TamTam Bot API.  ## Features TamTam bots of the current version are able to: - Communicate with users and respond to requests - Recommend users complete actions via programmed buttons - Request personal data from users (name, short reference, phone number) We'll keep working on expanding bot capabilities in the future.  ## Examples Bots can be used for the following purposes: - Providing support, answering frequently asked questions - Sending typical information - Voting - Likes/dislikes - Following external links - Forwarding a user to a chat/channel  ## @PrimeBot [PrimeBot](https://tt.me/primebot) is the main bot in TamTam, all bots creator. Use PrimeBot to create and edit your bots. Feel free to contact us for any questions, [@support](https://tt.me/support) or [team@tamtam.chat](mailto:team@tamtam.chat).  ## HTTP verbs `GET` — getting resources, parameters are transmitted via URL  `POST` — creation of resources (for example, sending new messages)  `PUT` — editing resources  `DELETE` — deleting resources  `PATCH` — patching resources  ## HTTP response codes `200` — successful operation  `400` — invalid request  `401` — authentication error  `404` — resource not found  `405` — method is not allowed  `429` — the number of requests is exceeded  `503` — service unavailable  ## Resources format For content requests (PUT and POST) and responses, the API uses the JSON format. All strings are UTF-8 encoded. Date/time fields are represented as the number of milliseconds that have elapsed since 00:00 January 1, 1970 in the long format. To get it, you can simply multiply the UNIX timestamp by 1000. All date/time fields have a UTC timezone. ## Error responses In case of an error, the API returns a response with the corresponding HTTP code and JSON with the following fields:  `code` - the string with the error key  `message` - a string describing the error 
For example: ```bash > http https://botapi.tamtam.chat/chats?access_token={EXAMPLE_TOKEN} HTTP / 1.1 403 Forbidden Cache-Control: no-cache Connection: Keep-Alive Content-Length: 57 Content-Type: application / json; charset = utf-8 Set-Cookie: web_ui_lang = ru; Path = /; Domain = .tamtam.chat; Expires = 2019-03-24T11: 45: 36.500Z { \"code\": \"verify.token\", \"message\": \"Invalid access_token\" } ``` ## Receiving notifications TamTam Bot API supports 2 options of receiving notifications on new events for bots: - Push notifications via WebHook. To receive data via WebHook, you'll have to [add subscription](https://dev.tamtam.chat/#operation/subscribe); - Notifications upon request via [long polling](#operation/getUpdates) API. All data can be received via long polling **by default** after creating the bot. Both methods **cannot** be used simultaneously. Refer to the response schema of [/updates](https://dev.tamtam.chat/#operation/getUpdates) method to check all available types of updates. ### Webhook There is some notes about how we handle webhook subscription: 1. Sometimes webhook notification cannot be delivered in case when bot server or network is down. In such case we well retry delivery in a short period of time (from 30 to 60 seconds) and will do this until get `200 OK` status code from your server, but not longer than **8 hours** (*may change over time*) since update happened. We also consider any non `200`-response from server as failed delivery. 2. To protect your bot from unexpected high load we send **no more than 100** notifications per second by default. If you want increase this limit, contact us at [@support](https://tt.me/support). It should be from one of the following subnets: ``` 185.16.150.0/30 185.16.150.84/30 185.16.150.152/30 185.16.150.192/30 ``` ## Message buttons You can program buttons for users answering a bot. TamTam supports the following types of buttons: `callback` — sends a notification with payload to a bot (via WebHook or long polling) `link` — makes a user to follow a link `request_contact` — requests the user permission to access contact information (phone number, short link, email) `request_geo_location` — asks user to provide current geo location `chat` — creates chat associated with message To start create buttons [send message](#operation/sendMessage) with `InlineKeyboardAttachment`: ```json { \"text\": \"It is message with inline keyboard\", \"attachments\": [ { \"type\": \"inline_keyboard\", \"payload\": { \"buttons\": [ [ { \"type\": \"callback\", \"text\": \"Press me!\", \"payload\": \"button1 pressed\" } ], [ { \"type\": \"chat\", \"text\": \"Discuss\", \"chat_title\": \"Message discussion\" } ] ] } } ] } ``` ### Chat button Chat button is a button that starts chat assosiated with the current message. It will be **private** chat with a link, bot will be added as administrator by default. Chat will be created as soon as the first user taps on button. Bot will receive `message_chat_created` update. Bot can set title and description of new chat by setting `chat_title` and `chat_description` properties. Whereas keyboard can contain several `chat`-buttons there is `uuid` property to distinct them between each other. In case you do not pass `uuid` we will generate it. If you edit message, pass `uuid` so we know that this button starts the same chat as before. Chat button also can contain `start_payload` that will be sent to bot as part of `message_chat_created` update. ## Deep linking TamTam supports deep linking mechanism for bots. It allows passing additional payload to the bot on startup. Deep link can contain any data encoded into string up to **128** characters long. Longer strings will be omitted and **not** passed to the bot. Each bot has start link that looks like: ``` https://tt.me/%BOT_USERNAME%/start/%PAYLOAD% ``` As soon as user clicks on such link we open dialog with bot and send this payload to bot as part of `bot_started` update: ```json { \"update_type\": \"bot_started\", \"timestamp\": 1573226679188, \"chat_id\": 1234567890, \"user\": { \"user_id\": 1234567890, \"name\": \"Boris\", \"username\": \"borisd84\" }, \"payload\": \"any data meaningful to bot\" } ``` Deep linking mechanism is supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Constructors Constructor is a bot that can create a message for user: add buttons, attach some media, insert text. You can enable constructor mode for your bot via [@PrimeBot](https://tt.me/primebot) sending [/constructor_mode](https://tt.me/primebot/start/constructor_mode) command. For bot developers, it looks like request-response interaction where TamTam application sends `message_construction_request` on behalf of user. Bot [responds](#operation/construct) to it with `messages` ready to go or `keyboard` in case it requires further action from user. Bot also can set up UI parts such as `hint` or `placeholder`, allow or not user's input: ![Constructor UI parts](https://dev.tamtam.chat/static/hint-079a332a51a2e9e6d415ec716389661b.png) As soon as user finishes composing a message, they can post it. Bot will receive `message_constructed_update` with posted message. Constructors are supported for iOS version 2.7.0 and Android 2.9.0 and higher. ## Text formatting Message text can be improved with basic formatting such as: **strong**, *emphasis*, ~strikethough~, underline, `code` or link. You can use either markdown-like or HTML formatting. To enable text formatting set the `format` property of [NewMessageBody](#tag/new_message_model). ### TamTam flavored Markdown To enable [Markdown](https://spec.commonmark.org/0.29/) parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `markdown`. We currently support only the following syntax: `*empasized*` or `_empasized_` for *italic* text `**strong**` or `__strong__` for __bold__ text `~~strikethough~~` for ~strikethough~ text `++underline++` for underlined text ``` `code` ``` or ` ```code``` ` for `monospaced` text `^^important^^` for highlighted text (colored in red, by default) `[Inline URL](https://dev.tamtam.chat/)` for inline URLs `[User mention](tamtam://user/%user_id%)` for user mentions without username ### HTML support To enable HTML parsing, set the `format` property of [NewMessageBody](#tag/new_message_model) to `html`. Only the following HTML tags are supported. All others will be stripped: Emphasized: `` or `` Strong: `` or `` Strikethrough: `` or `` Underlined: `` or `` Link: `Docs` Monospaced text: `
` or ``  Highlighted text: ``  Text formatting is supported for iOS since version 3.1 and Android since 2.20.0.  # Versioning API models and interface may change over time. To make sure your bot will get the right info, we strongly recommend adding API version number to each request. You can add it as `v` parameter to each HTTP-request. For instance, `v=0.1.2`. To specify the data model version you are getting through WebHook subscription, use the `version` property in the request body of the [subscribe](https://dev.tamtam.chat/#operation/subscribe) request.  # Libraries We have developed the official [Java client](https://github.com/tamtam-chat/tamtam-bot-api) and [SDK](https://github.com/tamtam-chat/tamtam-bot-sdk).  Also check out unofficial libraries, created by our enthusiasts: - [Kotlin DSL client](https://github.com/Namazed/TamTamBotApiClientDsl) - [GO client](https://github.com/neonxp/tamtam) - [Node.js module](https://github.com/vershininivan/node-tamtam-botapi)  #### Python: - [Python client](https://github.com/asvbkr/openapi_client) - [tamtam.py](https://github.com/uwinx/tamtam.py) - [registriren/botapitamtam](https://github.com/registriren/botapitamtam)  # Changelog ##### Version 0.3.0 - Added methods to [pin](#operation/pinMessage)/[unpin](#operation/unpinMessage) messages in chats/channels - Added `is_bot` flag to [`User`](#tag/user_model) model  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.1..v0.3.0) for this release.  ##### Version 0.2.1 - [Added](#operation/getChatByLink) method to get chat by its `@link` - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR1240) `description` for users in some cases - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..HEAD#diff-7e9de78f42fb0d2ae80878b90c87300aR2555) `user_locale` to `message_created` update in dialogs  Check out the complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.2.0..v0.2.1) for this release.  ##### Version 0.2.0 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/09c95259d6c8c424f82b50eab93872e7db2ca208) new type of button to start new chat - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ea4581d83d7132663d6cc5c2c61c058a2bd46aac) Constructors API that allows bots to create message on behalf of a user - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/c5ff03175407819aceebd9c25de49eed566a0ce1) support for deep-links - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/ff4cc4f93662d6c25db11fac72d9fcbf1f66cad8) ability to block users in chats - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/b965bfb0d02933e819435312e6ab184a3dfc0250) `chat_id` and `user_id` to `message_removed` update - Added meta information for video attachments - Other minor improvements and fixes. Check out complete [diff](https://github.com/tamtam-chat/tamtam-bot-api-schema/compare/v0.1.11...v0.1.10) for this version  ##### Version 0.1.10 - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/a9ef3a1b8f4e1a75b55a9b80877eddc2c6f07ec4) `disable_link_preview` parameter to POST:/messages method to disable links parsing in text - [Added](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/eb99e8ab97b55fa196d9957fca34d2316a4ca8aa) `sending_file` action - [Removed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/7a5ab5f0ea1336b3460d1827a6a7b3b141e19776) several deprecated properties - `photo` upload type [renamed](https://github.com/tamtam-chat/tamtam-bot-api-schema/commit/74505883e6acb306686a6d141414aeaf5131ef49) to `image`. *C* is for consistency  To see changelog for older versions visit our [GitHub](https://github.com/tamtam-chat/tamtam-bot-api-schema/releases).  # noqa: E501
 7 | 
 8 |     OpenAPI spec version: 0.5.2
 9 |     Generated by: https://openapi-generator.tech
10 | """
11 | 
12 | import pprint
13 | import re  # noqa: F401
14 | 
15 | import six
16 | 
17 | 
18 | class UploadType(object):
19 |     """NOTE: This class is auto generated by OpenAPI Generator.
20 |     Ref: https://openapi-generator.tech
21 | 
22 |     Do not edit the class manually.
23 |     """
24 | 
25 |     """
26 |     allowed enum values
27 |     """
28 |     IMAGE = "image"
29 |     PHOTO = "image"  # Left for compatibility
30 |     VIDEO = "video"
31 |     AUDIO = "audio"
32 |     FILE = "file"
33 | 
34 |     """
35 |     Attributes:
36 |       openapi_types (dict): The key is attribute name
37 |                             and the value is attribute type.
38 |       attribute_map (dict): The key is attribute name
39 |                             and the value is json key in definition.
40 |     """
41 |     openapi_types = {
42 |     }
43 | 
44 |     attribute_map = {
45 |     }
46 | 
47 |     def __init__(self):  # noqa: E501
48 |         """UploadType - a model defined in OpenAPI"""  # noqa: E501
49 |         self.discriminator = None
50 | 
51 |     def to_dict(self):
52 |         """Returns the model properties as a dict"""
53 |         result = {}
54 | 
55 |         for attr, _ in six.iteritems(self.openapi_types):
56 |             value = getattr(self, attr)
57 |             if isinstance(value, list):
58 |                 result[attr] = list(map(
59 |                     lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
60 |                     value
61 |                 ))
62 |             elif hasattr(value, "to_dict"):
63 |                 result[attr] = value.to_dict()
64 |             elif isinstance(value, dict):
65 |                 result[attr] = dict(map(
66 |                     lambda item: (item[0], item[1].to_dict())
67 |                     if hasattr(item[1], "to_dict") else item,
68 |                     value.items()
69 |                 ))
70 |             else:
71 |                 result[attr] = value
72 | 
73 |         return result
74 | 
75 |     def to_str(self):
76 |         """Returns the string representation of the model"""
77 |         return pprint.pformat(self.to_dict())
78 | 
79 |     def __repr__(self):
80 |         """For `print` and `pprint`"""
81 |         return self.to_str()
82 | 
83 |     def __eq__(self, other):
84 |         """Returns true if both objects are equal"""
85 |         if not isinstance(other, UploadType):
86 |             return False
87 | 
88 |         return self.__dict__ == other.__dict__
89 | 
90 |     def __ne__(self, other):
91 |         """Returns true if both objects are not equal"""
92 |         return not self == other
93 | 


--------------------------------------------------------------------------------
/utl.py:
--------------------------------------------------------------------------------
 1 | # -*- coding: UTF-8 -*-
 2 | class OacUtils:
 3 | 
 4 |     @staticmethod
 5 |     def escape(s, quote=True):
 6 |         """
 7 |         Replace special characters "&", "<" and ">" to HTML-safe sequences.
 8 |         If the optional flag quote is true (the default), the quotation mark
 9 |         characters, both double quote (") and single quote (') characters are also
10 |         translated.
11 |         """
12 |         if s:
13 |             s = s.replace("&", "&")  # Must be done first!
14 |             s = s.replace("<", "<")
15 |             s = s.replace(">", ">")
16 |             if quote:
17 |                 s = s.replace('"', """)
18 |                 s = s.replace('\'', "'")
19 |         return s
20 | 


--------------------------------------------------------------------------------