botix 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. botix-1.0.0/LICENSE +21 -0
  2. botix-1.0.0/PKG-INFO +187 -0
  3. botix-1.0.0/README.md +152 -0
  4. botix-1.0.0/botix/__init__.py +98 -0
  5. botix-1.0.0/botix/api/__init__.py +11 -0
  6. botix-1.0.0/botix/api/channels_api.py +279 -0
  7. botix-1.0.0/botix/api/chats_api.py +663 -0
  8. botix-1.0.0/botix/api/contacts_api.py +2043 -0
  9. botix-1.0.0/botix/api/messages_api.py +708 -0
  10. botix-1.0.0/botix/api/scenarios_api.py +594 -0
  11. botix-1.0.0/botix/api/system_api.py +291 -0
  12. botix-1.0.0/botix/api/webhooks_api.py +1369 -0
  13. botix-1.0.0/botix/api_client.py +805 -0
  14. botix-1.0.0/botix/api_response.py +21 -0
  15. botix-1.0.0/botix/client.py +360 -0
  16. botix-1.0.0/botix/configuration.py +611 -0
  17. botix-1.0.0/botix/exceptions.py +219 -0
  18. botix-1.0.0/botix/idempotency.py +56 -0
  19. botix-1.0.0/botix/models/__init__.py +58 -0
  20. botix-1.0.0/botix/models/channel.py +103 -0
  21. botix-1.0.0/botix/models/channels_list200_response.py +105 -0
  22. botix-1.0.0/botix/models/channels_list200_response_meta.py +89 -0
  23. botix-1.0.0/botix/models/chat.py +133 -0
  24. botix-1.0.0/botix/models/chats_list200_response.py +105 -0
  25. botix-1.0.0/botix/models/contact.py +236 -0
  26. botix-1.0.0/botix/models/contact_writable.py +128 -0
  27. botix-1.0.0/botix/models/contacts_add_tag200_response.py +95 -0
  28. botix-1.0.0/botix/models/contacts_add_tag200_response_data.py +89 -0
  29. botix-1.0.0/botix/models/contacts_add_tag_request.py +89 -0
  30. botix-1.0.0/botix/models/contacts_list200_response.py +105 -0
  31. botix-1.0.0/botix/models/contacts_remove_tag200_response.py +95 -0
  32. botix-1.0.0/botix/models/error.py +95 -0
  33. botix-1.0.0/botix/models/error_error.py +103 -0
  34. botix-1.0.0/botix/models/me_response.py +95 -0
  35. botix-1.0.0/botix/models/me_response_data.py +107 -0
  36. botix-1.0.0/botix/models/me_response_data_limits.py +95 -0
  37. botix-1.0.0/botix/models/me_response_data_rate_limit.py +94 -0
  38. botix-1.0.0/botix/models/message.py +154 -0
  39. botix-1.0.0/botix/models/messages_list200_response.py +105 -0
  40. botix-1.0.0/botix/models/messages_send200_response.py +95 -0
  41. botix-1.0.0/botix/models/messages_send200_response_data.py +99 -0
  42. botix-1.0.0/botix/models/messages_send_request.py +103 -0
  43. botix-1.0.0/botix/models/messages_send_request_attachments_inner.py +93 -0
  44. botix-1.0.0/botix/models/scenario.py +125 -0
  45. botix-1.0.0/botix/models/scenarios_list200_response.py +105 -0
  46. botix-1.0.0/botix/models/scenarios_run200_response.py +95 -0
  47. botix-1.0.0/botix/models/scenarios_run200_response_data.py +104 -0
  48. botix-1.0.0/botix/models/scenarios_run_request.py +95 -0
  49. botix-1.0.0/botix/models/success_contact.py +95 -0
  50. botix-1.0.0/botix/models/success_with_meta.py +102 -0
  51. botix-1.0.0/botix/models/success_with_meta_meta.py +93 -0
  52. botix-1.0.0/botix/models/webhook.py +122 -0
  53. botix-1.0.0/botix/models/webhook_event.py +48 -0
  54. botix-1.0.0/botix/models/webhooks_create201_response.py +95 -0
  55. botix-1.0.0/botix/models/webhooks_create201_response_data.py +95 -0
  56. botix-1.0.0/botix/models/webhooks_create_request.py +92 -0
  57. botix-1.0.0/botix/models/webhooks_list200_response.py +99 -0
  58. botix-1.0.0/botix/models/webhooks_test200_response.py +95 -0
  59. botix-1.0.0/botix/models/webhooks_test200_response_data.py +113 -0
  60. botix-1.0.0/botix/models/webhooks_update_request.py +104 -0
  61. botix-1.0.0/botix/py.typed +0 -0
  62. botix-1.0.0/botix/rest.py +264 -0
  63. botix-1.0.0/botix/webhook.py +39 -0
  64. botix-1.0.0/botix.egg-info/PKG-INFO +187 -0
  65. botix-1.0.0/botix.egg-info/SOURCES.txt +71 -0
  66. botix-1.0.0/botix.egg-info/dependency_links.txt +1 -0
  67. botix-1.0.0/botix.egg-info/requires.txt +8 -0
  68. botix-1.0.0/botix.egg-info/top_level.txt +1 -0
  69. botix-1.0.0/pyproject.toml +58 -0
  70. botix-1.0.0/setup.cfg +4 -0
  71. botix-1.0.0/tests/test_client.py +61 -0
  72. botix-1.0.0/tests/test_idempotency.py +79 -0
  73. botix-1.0.0/tests/test_webhook.py +71 -0
botix-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 BOTIX (IE Shpagin V.V.)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
botix-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,187 @@
1
+ Metadata-Version: 2.4
2
+ Name: botix
3
+ Version: 1.0.0
4
+ Summary: Официальный Python SDK для публичного API BOTIX
5
+ Author-email: BOTIX <info@botix.pro>
6
+ License: MIT
7
+ Project-URL: Homepage, https://botix.pro
8
+ Project-URL: Documentation, https://developers.botix.pro
9
+ Project-URL: Repository, https://github.com/BOTIX-pro/sdk-python
10
+ Project-URL: Issues, https://github.com/BOTIX-pro/sdk-python/issues
11
+ Project-URL: Changelog, https://github.com/BOTIX-pro/sdk-python/blob/main/CHANGELOG.md
12
+ Keywords: botix,chatbot,api,sdk,telegram,whatsapp,vk,messenger
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Communications :: Chat
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: urllib3<3.0.0,>=2.1.0
28
+ Requires-Dist: python-dateutil>=2.8.2
29
+ Requires-Dist: pydantic>=2.11
30
+ Requires-Dist: typing-extensions>=4.7.1
31
+ Provides-Extra: test
32
+ Requires-Dist: pytest>=7.2; extra == "test"
33
+ Requires-Dist: pytest-cov>=4.0; extra == "test"
34
+ Dynamic: license-file
35
+
36
+ # BOTIX SDK для Python
37
+
38
+ Официальная клиентская библиотека для публичного API BOTIX — платформы визуального конструктора чат-ботов и AI-ассистентов.
39
+
40
+ [![PyPI version](https://img.shields.io/pypi/v/botix.svg)](https://pypi.org/project/botix/)
41
+ [![Python versions](https://img.shields.io/pypi/pyversions/botix.svg)](https://pypi.org/project/botix/)
42
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
43
+ [![CI](https://github.com/BOTIX-pro/sdk-python/actions/workflows/test.yml/badge.svg)](https://github.com/BOTIX-pro/sdk-python/actions/workflows/test.yml)
44
+
45
+ ## Что это
46
+
47
+ BOTIX — облачная SaaS-платформа визуального конструктора чат-ботов: Telegram, WhatsApp, ВКонтакте, виджет на сайте. SDK даёт типизированный доступ к публичному REST API BOTIX из Python-приложений: контакты, сообщения, сценарии, чаты, webhooks.
48
+
49
+ ## Установка
50
+
51
+ ```bash
52
+ pip install botix
53
+ ```
54
+
55
+ Минимальная версия Python — 3.9.
56
+
57
+ ## Первый запрос
58
+
59
+ Получите API-ключ в кабинете BOTIX: «Настройки → API-ключи → Создать ключ». Ключ показывается один раз — сохраните его.
60
+
61
+ ```python
62
+ import botix
63
+
64
+ client = botix.Client("btx_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
65
+
66
+ me = client.me()
67
+ print(me.data.project_id, me.data.scopes, me.data.plan_key)
68
+ ```
69
+
70
+ Возвращается контекст текущего ключа: ID проекта, разрешённые scopes, тариф клиента и остаток rate-limit.
71
+
72
+ ## Отправка сообщения
73
+
74
+ ```python
75
+ response = client.messages.send(
76
+ contact_id=42,
77
+ content="Привет! Это сообщение из BOTIX SDK.",
78
+ channel="telegram", # опционально — иначе берётся last_channel контакта
79
+ )
80
+ print(response.data.id, response.data.status)
81
+ if response.replayed:
82
+ print("Сервер вернул кешированный ответ по совпадению Idempotency-Key")
83
+ ```
84
+
85
+ SDK автоматически генерирует `Idempotency-Key` (UUID v4) для защиты от случайных дублей при сетевых сбоях. Чтобы отключить: `botix.Client(api_key, auto_idempotency=False)`. Свой ключ — `client.messages.send(..., idempotency_key="my-uuid")`.
86
+
87
+ ## Webhooks: проверка подписи
88
+
89
+ BOTIX подписывает каждое входящее webhook-сообщение HMAC-SHA256 над сырым телом запроса. Секрет вы получили один раз при создании подписки через `client.webhooks.create(...)`.
90
+
91
+ ```python
92
+ from flask import Flask, request, abort
93
+ import botix
94
+
95
+ app = Flask(__name__)
96
+ WEBHOOK_SECRET = "ваш_секрет_подписки"
97
+
98
+ @app.route("/botix-webhook", methods=["POST"])
99
+ def botix_webhook():
100
+ raw_body = request.get_data() # ВАЖНО: сырое тело, не request.json
101
+ signature = request.headers.get("X-Botix-Signature", "")
102
+
103
+ if not botix.verify_webhook(raw_body, signature, WEBHOOK_SECRET):
104
+ abort(401, "Invalid signature")
105
+
106
+ event = request.json
107
+ print(event["event"], event["data"])
108
+ return "", 200
109
+ ```
110
+
111
+ ## Работа с ошибками
112
+
113
+ SDK кидает `botix.ApiException` на любой не-2xx ответ. Код ошибки BOTIX лежит в теле ответа.
114
+
115
+ ```python
116
+ import botix
117
+ import json
118
+
119
+ client = botix.Client("btx_live_...")
120
+
121
+ try:
122
+ contact = client.contacts.get(99999)
123
+ except botix.ApiException as e:
124
+ body = json.loads(e.body) if e.body else {}
125
+ code = body.get("error", {}).get("code")
126
+ print(f"HTTP {e.status} / {code}: {body.get('error', {}).get('message')}")
127
+ ```
128
+
129
+ Возможные коды (полный список — в [документации API](https://developers.botix.pro)):
130
+
131
+ | Код | HTTP | Когда |
132
+ |---|---|---|
133
+ | `MISSING_API_KEY` | 401 | Нет заголовка Authorization |
134
+ | `INVALID_API_KEY` | 401 | Ключ не существует или подделан |
135
+ | `KEY_REVOKED` | 401 | Ключ отозван |
136
+ | `INSUFFICIENT_SCOPE` | 403 | У ключа нет нужного scope |
137
+ | `API_NOT_AVAILABLE_ON_PLAN` | 403 | Тариф клиента не включает API |
138
+ | `TRIAL_READ_ONLY` | 403 | Триал — мутирующие методы запрещены |
139
+ | `RATE_LIMIT_EXCEEDED` | 429 | Превышен per-minute или per-day лимит |
140
+ | `NO_CHANNEL_AVAILABLE` | 422 | Не удалось определить канал отправки |
141
+ | `CHANNEL_NOT_SUPPORTED_YET` | 422 | Канал ещё не подключён к API |
142
+ | `CONTACT_NOT_REACHABLE` | 422 | У контакта нет chat_id/phone для канала |
143
+ | `DELIVERY_FAILED` | 502 | Канал отверг отправку |
144
+
145
+ ## Доступные ресурсы
146
+
147
+ ```python
148
+ client.me() # GET /me
149
+ client.contacts.list(page=1, per_page=50, ...) # GET /contacts
150
+ client.contacts.get(id) # GET /contacts/{id}
151
+ client.contacts.create(**fields) # POST /contacts
152
+ client.contacts.update(id, **fields) # PUT /contacts/{id}
153
+ client.contacts.delete(id) # DELETE /contacts/{id}
154
+ client.contacts.add_tag(id, tag) # POST /contacts/{id}/tags
155
+ client.contacts.remove_tag(id, tag) # DELETE /contacts/{id}/tags/{tag}
156
+
157
+ client.messages.list(...) # GET /messages
158
+ client.messages.send(contact_id, content, ...) # POST /messages
159
+
160
+ client.scenarios.list() # GET /scenarios
161
+ client.scenarios.run(id, contact_id, ...) # POST /scenarios/{id}/run
162
+
163
+ client.chats.list(...) # GET /chats
164
+ client.chats.messages(chat_id) # GET /chats/{id}/messages
165
+
166
+ client.channels.list() # GET /channels
167
+
168
+ client.webhooks.list() # GET /webhooks
169
+ client.webhooks.create(url, events) # POST /webhooks
170
+ client.webhooks.update(id, ...) # PUT /webhooks/{id}
171
+ client.webhooks.delete(id) # DELETE /webhooks/{id}
172
+ client.webhooks.test(id) # POST /webhooks/{id}/test
173
+ ```
174
+
175
+ Примеры в [examples/](./examples).
176
+
177
+ ## Ссылки
178
+
179
+ - Полная документация API: [developers.botix.pro](https://developers.botix.pro)
180
+ - Платформа BOTIX: [botix.pro](https://botix.pro)
181
+ - Для разработчиков: [botix.pro/developers](https://botix.pro/developers)
182
+ - Issues: [github.com/BOTIX-pro/sdk-python/issues](https://github.com/BOTIX-pro/sdk-python/issues)
183
+ - PyPI: [pypi.org/project/botix](https://pypi.org/project/botix)
184
+
185
+ ## Лицензия
186
+
187
+ [MIT](./LICENSE) © 2026 BOTIX (ИП Шпагин В.В.)
botix-1.0.0/README.md ADDED
@@ -0,0 +1,152 @@
1
+ # BOTIX SDK для Python
2
+
3
+ Официальная клиентская библиотека для публичного API BOTIX — платформы визуального конструктора чат-ботов и AI-ассистентов.
4
+
5
+ [![PyPI version](https://img.shields.io/pypi/v/botix.svg)](https://pypi.org/project/botix/)
6
+ [![Python versions](https://img.shields.io/pypi/pyversions/botix.svg)](https://pypi.org/project/botix/)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+ [![CI](https://github.com/BOTIX-pro/sdk-python/actions/workflows/test.yml/badge.svg)](https://github.com/BOTIX-pro/sdk-python/actions/workflows/test.yml)
9
+
10
+ ## Что это
11
+
12
+ BOTIX — облачная SaaS-платформа визуального конструктора чат-ботов: Telegram, WhatsApp, ВКонтакте, виджет на сайте. SDK даёт типизированный доступ к публичному REST API BOTIX из Python-приложений: контакты, сообщения, сценарии, чаты, webhooks.
13
+
14
+ ## Установка
15
+
16
+ ```bash
17
+ pip install botix
18
+ ```
19
+
20
+ Минимальная версия Python — 3.9.
21
+
22
+ ## Первый запрос
23
+
24
+ Получите API-ключ в кабинете BOTIX: «Настройки → API-ключи → Создать ключ». Ключ показывается один раз — сохраните его.
25
+
26
+ ```python
27
+ import botix
28
+
29
+ client = botix.Client("btx_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
30
+
31
+ me = client.me()
32
+ print(me.data.project_id, me.data.scopes, me.data.plan_key)
33
+ ```
34
+
35
+ Возвращается контекст текущего ключа: ID проекта, разрешённые scopes, тариф клиента и остаток rate-limit.
36
+
37
+ ## Отправка сообщения
38
+
39
+ ```python
40
+ response = client.messages.send(
41
+ contact_id=42,
42
+ content="Привет! Это сообщение из BOTIX SDK.",
43
+ channel="telegram", # опционально — иначе берётся last_channel контакта
44
+ )
45
+ print(response.data.id, response.data.status)
46
+ if response.replayed:
47
+ print("Сервер вернул кешированный ответ по совпадению Idempotency-Key")
48
+ ```
49
+
50
+ SDK автоматически генерирует `Idempotency-Key` (UUID v4) для защиты от случайных дублей при сетевых сбоях. Чтобы отключить: `botix.Client(api_key, auto_idempotency=False)`. Свой ключ — `client.messages.send(..., idempotency_key="my-uuid")`.
51
+
52
+ ## Webhooks: проверка подписи
53
+
54
+ BOTIX подписывает каждое входящее webhook-сообщение HMAC-SHA256 над сырым телом запроса. Секрет вы получили один раз при создании подписки через `client.webhooks.create(...)`.
55
+
56
+ ```python
57
+ from flask import Flask, request, abort
58
+ import botix
59
+
60
+ app = Flask(__name__)
61
+ WEBHOOK_SECRET = "ваш_секрет_подписки"
62
+
63
+ @app.route("/botix-webhook", methods=["POST"])
64
+ def botix_webhook():
65
+ raw_body = request.get_data() # ВАЖНО: сырое тело, не request.json
66
+ signature = request.headers.get("X-Botix-Signature", "")
67
+
68
+ if not botix.verify_webhook(raw_body, signature, WEBHOOK_SECRET):
69
+ abort(401, "Invalid signature")
70
+
71
+ event = request.json
72
+ print(event["event"], event["data"])
73
+ return "", 200
74
+ ```
75
+
76
+ ## Работа с ошибками
77
+
78
+ SDK кидает `botix.ApiException` на любой не-2xx ответ. Код ошибки BOTIX лежит в теле ответа.
79
+
80
+ ```python
81
+ import botix
82
+ import json
83
+
84
+ client = botix.Client("btx_live_...")
85
+
86
+ try:
87
+ contact = client.contacts.get(99999)
88
+ except botix.ApiException as e:
89
+ body = json.loads(e.body) if e.body else {}
90
+ code = body.get("error", {}).get("code")
91
+ print(f"HTTP {e.status} / {code}: {body.get('error', {}).get('message')}")
92
+ ```
93
+
94
+ Возможные коды (полный список — в [документации API](https://developers.botix.pro)):
95
+
96
+ | Код | HTTP | Когда |
97
+ |---|---|---|
98
+ | `MISSING_API_KEY` | 401 | Нет заголовка Authorization |
99
+ | `INVALID_API_KEY` | 401 | Ключ не существует или подделан |
100
+ | `KEY_REVOKED` | 401 | Ключ отозван |
101
+ | `INSUFFICIENT_SCOPE` | 403 | У ключа нет нужного scope |
102
+ | `API_NOT_AVAILABLE_ON_PLAN` | 403 | Тариф клиента не включает API |
103
+ | `TRIAL_READ_ONLY` | 403 | Триал — мутирующие методы запрещены |
104
+ | `RATE_LIMIT_EXCEEDED` | 429 | Превышен per-minute или per-day лимит |
105
+ | `NO_CHANNEL_AVAILABLE` | 422 | Не удалось определить канал отправки |
106
+ | `CHANNEL_NOT_SUPPORTED_YET` | 422 | Канал ещё не подключён к API |
107
+ | `CONTACT_NOT_REACHABLE` | 422 | У контакта нет chat_id/phone для канала |
108
+ | `DELIVERY_FAILED` | 502 | Канал отверг отправку |
109
+
110
+ ## Доступные ресурсы
111
+
112
+ ```python
113
+ client.me() # GET /me
114
+ client.contacts.list(page=1, per_page=50, ...) # GET /contacts
115
+ client.contacts.get(id) # GET /contacts/{id}
116
+ client.contacts.create(**fields) # POST /contacts
117
+ client.contacts.update(id, **fields) # PUT /contacts/{id}
118
+ client.contacts.delete(id) # DELETE /contacts/{id}
119
+ client.contacts.add_tag(id, tag) # POST /contacts/{id}/tags
120
+ client.contacts.remove_tag(id, tag) # DELETE /contacts/{id}/tags/{tag}
121
+
122
+ client.messages.list(...) # GET /messages
123
+ client.messages.send(contact_id, content, ...) # POST /messages
124
+
125
+ client.scenarios.list() # GET /scenarios
126
+ client.scenarios.run(id, contact_id, ...) # POST /scenarios/{id}/run
127
+
128
+ client.chats.list(...) # GET /chats
129
+ client.chats.messages(chat_id) # GET /chats/{id}/messages
130
+
131
+ client.channels.list() # GET /channels
132
+
133
+ client.webhooks.list() # GET /webhooks
134
+ client.webhooks.create(url, events) # POST /webhooks
135
+ client.webhooks.update(id, ...) # PUT /webhooks/{id}
136
+ client.webhooks.delete(id) # DELETE /webhooks/{id}
137
+ client.webhooks.test(id) # POST /webhooks/{id}/test
138
+ ```
139
+
140
+ Примеры в [examples/](./examples).
141
+
142
+ ## Ссылки
143
+
144
+ - Полная документация API: [developers.botix.pro](https://developers.botix.pro)
145
+ - Платформа BOTIX: [botix.pro](https://botix.pro)
146
+ - Для разработчиков: [botix.pro/developers](https://botix.pro/developers)
147
+ - Issues: [github.com/BOTIX-pro/sdk-python/issues](https://github.com/BOTIX-pro/sdk-python/issues)
148
+ - PyPI: [pypi.org/project/botix](https://pypi.org/project/botix)
149
+
150
+ ## Лицензия
151
+
152
+ [MIT](./LICENSE) © 2026 BOTIX (ИП Шпагин В.В.)
@@ -0,0 +1,98 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ BOTIX SDK для Python — официальная клиентская библиотека публичного API BOTIX.
5
+
6
+ Точка входа — :class:`botix.Client`. Хелпер :func:`botix.verify_webhook`
7
+ сверяет подпись входящих webhook-сообщений.
8
+
9
+ Пример:
10
+
11
+ import botix
12
+
13
+ client = botix.Client("btx_live_...")
14
+ print(client.me())
15
+ """
16
+
17
+ __version__ = "1.0.0"
18
+
19
+ # Высокоуровневое API — то, что использует разработчик в 99% случаев.
20
+ from botix.client import Client as Client
21
+ from botix.idempotency import Response as Response
22
+ from botix.idempotency import generate_idempotency_key as generate_idempotency_key
23
+ from botix.webhook import verify_webhook as verify_webhook
24
+
25
+ # Низкоуровневые компоненты сгенерированного клиента — для опытных пользователей,
26
+ # которым нужен прямой доступ к сырому ApiClient / Configuration / типизированным
27
+ # pydantic-моделям ответов.
28
+ from botix.api.channels_api import ChannelsApi as ChannelsApi
29
+ from botix.api.chats_api import ChatsApi as ChatsApi
30
+ from botix.api.contacts_api import ContactsApi as ContactsApi
31
+ from botix.api.messages_api import MessagesApi as MessagesApi
32
+ from botix.api.scenarios_api import ScenariosApi as ScenariosApi
33
+ from botix.api.system_api import SystemApi as SystemApi
34
+ from botix.api.webhooks_api import WebhooksApi as WebhooksApi
35
+ from botix.api_client import ApiClient as ApiClient
36
+ from botix.api_response import ApiResponse as ApiResponse
37
+ from botix.configuration import Configuration as Configuration
38
+ from botix.exceptions import ApiAttributeError as ApiAttributeError
39
+ from botix.exceptions import ApiException as ApiException
40
+ from botix.exceptions import ApiKeyError as ApiKeyError
41
+ from botix.exceptions import ApiTypeError as ApiTypeError
42
+ from botix.exceptions import ApiValueError as ApiValueError
43
+ from botix.exceptions import OpenApiException as OpenApiException
44
+
45
+ # Типизированные модели данных — для type hints и сериализации.
46
+ from botix.models.channel import Channel as Channel
47
+ from botix.models.chat import Chat as Chat
48
+ from botix.models.contact import Contact as Contact
49
+ from botix.models.contact_writable import ContactWritable as ContactWritable
50
+ from botix.models.error import Error as Error
51
+ from botix.models.error_error import ErrorError as ErrorError
52
+ from botix.models.me_response import MeResponse as MeResponse
53
+ from botix.models.me_response_data import MeResponseData as MeResponseData
54
+ from botix.models.message import Message as Message
55
+ from botix.models.scenario import Scenario as Scenario
56
+ from botix.models.webhook import Webhook as Webhook
57
+ from botix.models.webhook_event import WebhookEvent as WebhookEvent
58
+
59
+ __all__ = [
60
+ "__version__",
61
+ # High-level
62
+ "Client",
63
+ "Response",
64
+ "verify_webhook",
65
+ "generate_idempotency_key",
66
+ # Low-level (advanced) — resource API classes
67
+ "ChannelsApi",
68
+ "ChatsApi",
69
+ "ContactsApi",
70
+ "MessagesApi",
71
+ "ScenariosApi",
72
+ "SystemApi",
73
+ "WebhooksApi",
74
+ # Low-level — core
75
+ "ApiClient",
76
+ "ApiResponse",
77
+ "Configuration",
78
+ # Exceptions
79
+ "ApiException",
80
+ "ApiAttributeError",
81
+ "ApiKeyError",
82
+ "ApiTypeError",
83
+ "ApiValueError",
84
+ "OpenApiException",
85
+ # Models
86
+ "Channel",
87
+ "Chat",
88
+ "Contact",
89
+ "ContactWritable",
90
+ "Error",
91
+ "ErrorError",
92
+ "MeResponse",
93
+ "MeResponseData",
94
+ "Message",
95
+ "Scenario",
96
+ "Webhook",
97
+ "WebhookEvent",
98
+ ]
@@ -0,0 +1,11 @@
1
+ # flake8: noqa
2
+
3
+ # import apis into api package
4
+ from botix.api.channels_api import ChannelsApi
5
+ from botix.api.chats_api import ChatsApi
6
+ from botix.api.contacts_api import ContactsApi
7
+ from botix.api.messages_api import MessagesApi
8
+ from botix.api.scenarios_api import ScenariosApi
9
+ from botix.api.system_api import SystemApi
10
+ from botix.api.webhooks_api import WebhooksApi
11
+