pachca-sdk 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.
- pachca_sdk-1.0.0/PKG-INFO +141 -0
- pachca_sdk-1.0.0/README.md +124 -0
- pachca_sdk-1.0.0/pachca/__init__.py +8 -0
- pachca_sdk-1.0.0/pachca/api/__init__.py +1 -0
- pachca_sdk-1.0.0/pachca/api/bots/__init__.py +1 -0
- pachca_sdk-1.0.0/pachca/api/bots/bot_operations_delete_webhook_event.py +222 -0
- pachca_sdk-1.0.0/pachca/api/bots/bot_operations_get_webhook_events.py +273 -0
- pachca_sdk-1.0.0/pachca/api/bots/bot_operations_update_bot.py +265 -0
- pachca_sdk-1.0.0/pachca/api/chats/__init__.py +1 -0
- pachca_sdk-1.0.0/pachca/api/chats/chat_operations_archive_chat.py +210 -0
- pachca_sdk-1.0.0/pachca/api/chats/chat_operations_create_chat.py +237 -0
- pachca_sdk-1.0.0/pachca/api/chats/chat_operations_get_chat.py +210 -0
- pachca_sdk-1.0.0/pachca/api/chats/chat_operations_list_chats.py +322 -0
- pachca_sdk-1.0.0/pachca/api/chats/chat_operations_unarchive_chat.py +210 -0
- pachca_sdk-1.0.0/pachca/api/chats/chat_operations_update_chat.py +249 -0
- pachca_sdk-1.0.0/pachca/api/common/__init__.py +1 -0
- pachca_sdk-1.0.0/pachca/api/common/common_operations_list_properties.py +251 -0
- pachca_sdk-1.0.0/pachca/api/common/direct_upload_operations_upload_file.py +165 -0
- pachca_sdk-1.0.0/pachca/api/common/export_operations_download_export.py +243 -0
- pachca_sdk-1.0.0/pachca/api/common/export_operations_request_export.py +242 -0
- pachca_sdk-1.0.0/pachca/api/common/upload_operations_get_upload_params.py +181 -0
- pachca_sdk-1.0.0/pachca/api/group_tags/__init__.py +1 -0
- pachca_sdk-1.0.0/pachca/api/group_tags/group_tag_operations_create_tag.py +225 -0
- pachca_sdk-1.0.0/pachca/api/group_tags/group_tag_operations_delete_tag.py +218 -0
- pachca_sdk-1.0.0/pachca/api/group_tags/group_tag_operations_get_tag.py +210 -0
- pachca_sdk-1.0.0/pachca/api/group_tags/group_tag_operations_get_tag_users.py +253 -0
- pachca_sdk-1.0.0/pachca/api/group_tags/group_tag_operations_list_tags.py +257 -0
- pachca_sdk-1.0.0/pachca/api/group_tags/group_tag_operations_update_tag.py +257 -0
- pachca_sdk-1.0.0/pachca/api/link_previews/__init__.py +1 -0
- pachca_sdk-1.0.0/pachca/api/link_previews/link_preview_operations_create_link_previews.py +305 -0
- pachca_sdk-1.0.0/pachca/api/members/__init__.py +1 -0
- pachca_sdk-1.0.0/pachca/api/members/chat_member_operations_add_members.py +237 -0
- pachca_sdk-1.0.0/pachca/api/members/chat_member_operations_add_tags.py +237 -0
- pachca_sdk-1.0.0/pachca/api/members/chat_member_operations_leave_chat.py +216 -0
- pachca_sdk-1.0.0/pachca/api/members/chat_member_operations_list_members.py +293 -0
- pachca_sdk-1.0.0/pachca/api/members/chat_member_operations_remove_member.py +227 -0
- pachca_sdk-1.0.0/pachca/api/members/chat_member_operations_remove_tag.py +223 -0
- pachca_sdk-1.0.0/pachca/api/members/chat_member_operations_update_member_role.py +270 -0
- pachca_sdk-1.0.0/pachca/api/messages/__init__.py +1 -0
- pachca_sdk-1.0.0/pachca/api/messages/chat_message_operations_list_chat_messages.py +295 -0
- pachca_sdk-1.0.0/pachca/api/messages/message_operations_create_message.py +257 -0
- pachca_sdk-1.0.0/pachca/api/messages/message_operations_delete_message.py +230 -0
- pachca_sdk-1.0.0/pachca/api/messages/message_operations_get_message.py +210 -0
- pachca_sdk-1.0.0/pachca/api/messages/message_operations_pin_message.py +217 -0
- pachca_sdk-1.0.0/pachca/api/messages/message_operations_unpin_message.py +210 -0
- pachca_sdk-1.0.0/pachca/api/messages/message_operations_update_message.py +249 -0
- pachca_sdk-1.0.0/pachca/api/profile/__init__.py +1 -0
- pachca_sdk-1.0.0/pachca/api/profile/profile_operations_delete_status.py +173 -0
- pachca_sdk-1.0.0/pachca/api/profile/profile_operations_get_profile.py +173 -0
- pachca_sdk-1.0.0/pachca/api/profile/profile_operations_get_status.py +173 -0
- pachca_sdk-1.0.0/pachca/api/profile/profile_operations_update_status.py +217 -0
- pachca_sdk-1.0.0/pachca/api/reactions/__init__.py +1 -0
- pachca_sdk-1.0.0/pachca/api/reactions/reaction_operations_add_reaction.py +281 -0
- pachca_sdk-1.0.0/pachca/api/reactions/reaction_operations_list_reactions.py +253 -0
- pachca_sdk-1.0.0/pachca/api/reactions/reaction_operations_remove_reaction.py +273 -0
- pachca_sdk-1.0.0/pachca/api/read_member/__init__.py +1 -0
- pachca_sdk-1.0.0/pachca/api/read_member/read_member_operations_list_read_members.py +253 -0
- pachca_sdk-1.0.0/pachca/api/security/__init__.py +1 -0
- pachca_sdk-1.0.0/pachca/api/security/security_operations_get_audit_events.py +350 -0
- pachca_sdk-1.0.0/pachca/api/tasks/__init__.py +1 -0
- pachca_sdk-1.0.0/pachca/api/tasks/task_operations_create_task.py +273 -0
- pachca_sdk-1.0.0/pachca/api/tasks/task_operations_delete_task.py +210 -0
- pachca_sdk-1.0.0/pachca/api/tasks/task_operations_get_task.py +210 -0
- pachca_sdk-1.0.0/pachca/api/tasks/task_operations_list_tasks.py +226 -0
- pachca_sdk-1.0.0/pachca/api/tasks/task_operations_update_task.py +249 -0
- pachca_sdk-1.0.0/pachca/api/thread/__init__.py +1 -0
- pachca_sdk-1.0.0/pachca/api/thread/thread_operations_create_thread.py +214 -0
- pachca_sdk-1.0.0/pachca/api/thread/thread_operations_get_thread.py +210 -0
- pachca_sdk-1.0.0/pachca/api/users/__init__.py +1 -0
- pachca_sdk-1.0.0/pachca/api/users/user_operations_create_user.py +241 -0
- pachca_sdk-1.0.0/pachca/api/users/user_operations_delete_user.py +218 -0
- pachca_sdk-1.0.0/pachca/api/users/user_operations_get_user.py +210 -0
- pachca_sdk-1.0.0/pachca/api/users/user_operations_list_users.py +248 -0
- pachca_sdk-1.0.0/pachca/api/users/user_operations_update_user.py +265 -0
- pachca_sdk-1.0.0/pachca/api/views/__init__.py +1 -0
- pachca_sdk-1.0.0/pachca/api/views/form_operations_open_view.py +236 -0
- pachca_sdk-1.0.0/pachca/client.py +271 -0
- pachca_sdk-1.0.0/pachca/errors.py +14 -0
- pachca_sdk-1.0.0/pachca/models/__init__.py +323 -0
- pachca_sdk-1.0.0/pachca/models/add_members_request.py +91 -0
- pachca_sdk-1.0.0/pachca/models/add_tags_request.py +81 -0
- pachca_sdk-1.0.0/pachca/models/api_error.py +95 -0
- pachca_sdk-1.0.0/pachca/models/api_error_item.py +128 -0
- pachca_sdk-1.0.0/pachca/models/audit_event.py +164 -0
- pachca_sdk-1.0.0/pachca/models/audit_event_details.py +69 -0
- pachca_sdk-1.0.0/pachca/models/bearer_auth.py +92 -0
- pachca_sdk-1.0.0/pachca/models/bearer_auth_scheme.py +7 -0
- pachca_sdk-1.0.0/pachca/models/bearer_auth_type.py +7 -0
- pachca_sdk-1.0.0/pachca/models/bot_operations_get_webhook_events_response_200.py +118 -0
- pachca_sdk-1.0.0/pachca/models/bot_operations_update_bot_response_200.py +85 -0
- pachca_sdk-1.0.0/pachca/models/bot_response.py +93 -0
- pachca_sdk-1.0.0/pachca/models/bot_response_webhook.py +77 -0
- pachca_sdk-1.0.0/pachca/models/bot_update_request.py +85 -0
- pachca_sdk-1.0.0/pachca/models/bot_update_request_bot.py +85 -0
- pachca_sdk-1.0.0/pachca/models/bot_update_request_bot_webhook.py +77 -0
- pachca_sdk-1.0.0/pachca/models/button.py +96 -0
- pachca_sdk-1.0.0/pachca/models/button_webhook_payload.py +142 -0
- pachca_sdk-1.0.0/pachca/models/button_webhook_payload_event.py +7 -0
- pachca_sdk-1.0.0/pachca/models/button_webhook_payload_type.py +7 -0
- pachca_sdk-1.0.0/pachca/models/chat.py +174 -0
- pachca_sdk-1.0.0/pachca/models/chat_availability.py +8 -0
- pachca_sdk-1.0.0/pachca/models/chat_create_request.py +85 -0
- pachca_sdk-1.0.0/pachca/models/chat_create_request_chat.py +125 -0
- pachca_sdk-1.0.0/pachca/models/chat_member_operations_list_members_response_200.py +118 -0
- pachca_sdk-1.0.0/pachca/models/chat_member_role.py +9 -0
- pachca_sdk-1.0.0/pachca/models/chat_member_role_filter.py +11 -0
- pachca_sdk-1.0.0/pachca/models/chat_member_webhook_payload.py +157 -0
- pachca_sdk-1.0.0/pachca/models/chat_member_webhook_payload_type.py +7 -0
- pachca_sdk-1.0.0/pachca/models/chat_message_operations_list_chat_messages_response_200.py +118 -0
- pachca_sdk-1.0.0/pachca/models/chat_operations_create_chat_response_201.py +85 -0
- pachca_sdk-1.0.0/pachca/models/chat_operations_get_chat_response_200.py +85 -0
- pachca_sdk-1.0.0/pachca/models/chat_operations_list_chats_response_200.py +118 -0
- pachca_sdk-1.0.0/pachca/models/chat_operations_update_chat_response_200.py +85 -0
- pachca_sdk-1.0.0/pachca/models/chat_update_request.py +85 -0
- pachca_sdk-1.0.0/pachca/models/chat_update_request_chat.py +88 -0
- pachca_sdk-1.0.0/pachca/models/common_operations_list_properties_response_200.py +95 -0
- pachca_sdk-1.0.0/pachca/models/company_member_webhook_payload.py +127 -0
- pachca_sdk-1.0.0/pachca/models/company_member_webhook_payload_type.py +7 -0
- pachca_sdk-1.0.0/pachca/models/custom_property.py +105 -0
- pachca_sdk-1.0.0/pachca/models/custom_property_data_type.py +10 -0
- pachca_sdk-1.0.0/pachca/models/custom_property_definition.py +97 -0
- pachca_sdk-1.0.0/pachca/models/empty_response.py +66 -0
- pachca_sdk-1.0.0/pachca/models/export_request.py +129 -0
- pachca_sdk-1.0.0/pachca/models/file.py +161 -0
- pachca_sdk-1.0.0/pachca/models/file_type.py +8 -0
- pachca_sdk-1.0.0/pachca/models/file_upload_request.py +205 -0
- pachca_sdk-1.0.0/pachca/models/forwarding.py +155 -0
- pachca_sdk-1.0.0/pachca/models/group_tag.py +93 -0
- pachca_sdk-1.0.0/pachca/models/group_tag_operations_create_tag_response_201.py +85 -0
- pachca_sdk-1.0.0/pachca/models/group_tag_operations_get_tag_response_200.py +85 -0
- pachca_sdk-1.0.0/pachca/models/group_tag_operations_get_tag_users_response_200.py +118 -0
- pachca_sdk-1.0.0/pachca/models/group_tag_operations_list_tags_response_200.py +118 -0
- pachca_sdk-1.0.0/pachca/models/group_tag_operations_update_tag_response_200.py +85 -0
- pachca_sdk-1.0.0/pachca/models/group_tag_request.py +85 -0
- pachca_sdk-1.0.0/pachca/models/group_tag_request_group_tag.py +76 -0
- pachca_sdk-1.0.0/pachca/models/invite_status.py +8 -0
- pachca_sdk-1.0.0/pachca/models/link_preview.py +120 -0
- pachca_sdk-1.0.0/pachca/models/link_preview_image.py +94 -0
- pachca_sdk-1.0.0/pachca/models/link_previews_request.py +86 -0
- pachca_sdk-1.0.0/pachca/models/link_previews_request_link_previews.py +83 -0
- pachca_sdk-1.0.0/pachca/models/member_event_type.py +8 -0
- pachca_sdk-1.0.0/pachca/models/message.py +278 -0
- pachca_sdk-1.0.0/pachca/models/message_create_request.py +85 -0
- pachca_sdk-1.0.0/pachca/models/message_create_request_message.py +229 -0
- pachca_sdk-1.0.0/pachca/models/message_create_request_message_files_item.py +127 -0
- pachca_sdk-1.0.0/pachca/models/message_create_request_message_files_item_file_type.py +8 -0
- pachca_sdk-1.0.0/pachca/models/message_entity_type.py +9 -0
- pachca_sdk-1.0.0/pachca/models/message_operations_create_message_response_201.py +85 -0
- pachca_sdk-1.0.0/pachca/models/message_operations_get_message_response_200.py +85 -0
- pachca_sdk-1.0.0/pachca/models/message_operations_update_message_response_200.py +85 -0
- pachca_sdk-1.0.0/pachca/models/message_update_request.py +85 -0
- pachca_sdk-1.0.0/pachca/models/message_update_request_message.py +171 -0
- pachca_sdk-1.0.0/pachca/models/message_update_request_message_files_item.py +125 -0
- pachca_sdk-1.0.0/pachca/models/message_webhook_payload.py +221 -0
- pachca_sdk-1.0.0/pachca/models/message_webhook_payload_type.py +7 -0
- pachca_sdk-1.0.0/pachca/models/o_auth_error.py +85 -0
- pachca_sdk-1.0.0/pachca/models/open_view_request.py +128 -0
- pachca_sdk-1.0.0/pachca/models/open_view_request_type.py +7 -0
- pachca_sdk-1.0.0/pachca/models/open_view_request_view.py +284 -0
- pachca_sdk-1.0.0/pachca/models/pagination_meta.py +94 -0
- pachca_sdk-1.0.0/pachca/models/pagination_meta_paginate.py +79 -0
- pachca_sdk-1.0.0/pachca/models/profile_operations_get_profile_response_200.py +85 -0
- pachca_sdk-1.0.0/pachca/models/profile_operations_get_status_response_200.py +85 -0
- pachca_sdk-1.0.0/pachca/models/profile_operations_update_status_response_200.py +85 -0
- pachca_sdk-1.0.0/pachca/models/reaction.py +110 -0
- pachca_sdk-1.0.0/pachca/models/reaction_event_type.py +8 -0
- pachca_sdk-1.0.0/pachca/models/reaction_operations_list_reactions_response_200.py +118 -0
- pachca_sdk-1.0.0/pachca/models/reaction_request.py +87 -0
- pachca_sdk-1.0.0/pachca/models/reaction_webhook_payload.py +148 -0
- pachca_sdk-1.0.0/pachca/models/reaction_webhook_payload_type.py +7 -0
- pachca_sdk-1.0.0/pachca/models/read_member_operations_list_read_members_response_200.py +105 -0
- pachca_sdk-1.0.0/pachca/models/search_entity_type.py +8 -0
- pachca_sdk-1.0.0/pachca/models/security_operations_get_audit_events_response_200.py +118 -0
- pachca_sdk-1.0.0/pachca/models/sort_order.py +8 -0
- pachca_sdk-1.0.0/pachca/models/status_update_request.py +85 -0
- pachca_sdk-1.0.0/pachca/models/status_update_request_status.py +107 -0
- pachca_sdk-1.0.0/pachca/models/task.py +214 -0
- pachca_sdk-1.0.0/pachca/models/task_create_request.py +85 -0
- pachca_sdk-1.0.0/pachca/models/task_create_request_task.py +178 -0
- pachca_sdk-1.0.0/pachca/models/task_create_request_task_custom_properties_item.py +84 -0
- pachca_sdk-1.0.0/pachca/models/task_kind.py +11 -0
- pachca_sdk-1.0.0/pachca/models/task_operations_create_task_response_201.py +85 -0
- pachca_sdk-1.0.0/pachca/models/task_operations_get_task_response_200.py +85 -0
- pachca_sdk-1.0.0/pachca/models/task_operations_list_tasks_response_200.py +118 -0
- pachca_sdk-1.0.0/pachca/models/task_operations_update_task_response_200.py +85 -0
- pachca_sdk-1.0.0/pachca/models/task_status.py +8 -0
- pachca_sdk-1.0.0/pachca/models/task_update_request.py +85 -0
- pachca_sdk-1.0.0/pachca/models/task_update_request_task.py +228 -0
- pachca_sdk-1.0.0/pachca/models/task_update_request_task_custom_properties_item.py +84 -0
- pachca_sdk-1.0.0/pachca/models/task_update_request_task_status.py +8 -0
- pachca_sdk-1.0.0/pachca/models/thread.py +118 -0
- pachca_sdk-1.0.0/pachca/models/thread_operations_create_thread_response_201.py +85 -0
- pachca_sdk-1.0.0/pachca/models/thread_operations_get_thread_response_200.py +85 -0
- pachca_sdk-1.0.0/pachca/models/update_member_role_request.py +81 -0
- pachca_sdk-1.0.0/pachca/models/upload_params.py +148 -0
- pachca_sdk-1.0.0/pachca/models/user.py +281 -0
- pachca_sdk-1.0.0/pachca/models/user_create_request.py +97 -0
- pachca_sdk-1.0.0/pachca/models/user_create_request_user.py +206 -0
- pachca_sdk-1.0.0/pachca/models/user_create_request_user_custom_properties_item.py +84 -0
- pachca_sdk-1.0.0/pachca/models/user_event_type.py +12 -0
- pachca_sdk-1.0.0/pachca/models/user_operations_create_user_response_201.py +85 -0
- pachca_sdk-1.0.0/pachca/models/user_operations_get_user_response_200.py +85 -0
- pachca_sdk-1.0.0/pachca/models/user_operations_list_users_response_200.py +118 -0
- pachca_sdk-1.0.0/pachca/models/user_operations_update_user_response_200.py +85 -0
- pachca_sdk-1.0.0/pachca/models/user_role.py +9 -0
- pachca_sdk-1.0.0/pachca/models/user_status.py +117 -0
- pachca_sdk-1.0.0/pachca/models/user_update_request.py +85 -0
- pachca_sdk-1.0.0/pachca/models/user_update_request_user.py +208 -0
- pachca_sdk-1.0.0/pachca/models/user_update_request_user_custom_properties_item.py +84 -0
- pachca_sdk-1.0.0/pachca/models/user_update_request_user_role.py +9 -0
- pachca_sdk-1.0.0/pachca/models/validation_error_code.py +41 -0
- pachca_sdk-1.0.0/pachca/models/view_block.py +127 -0
- pachca_sdk-1.0.0/pachca/models/view_block_checkbox.py +148 -0
- pachca_sdk-1.0.0/pachca/models/view_block_checkbox_type.py +7 -0
- pachca_sdk-1.0.0/pachca/models/view_block_date.py +126 -0
- pachca_sdk-1.0.0/pachca/models/view_block_date_type.py +7 -0
- pachca_sdk-1.0.0/pachca/models/view_block_divider.py +81 -0
- pachca_sdk-1.0.0/pachca/models/view_block_divider_type.py +7 -0
- pachca_sdk-1.0.0/pachca/models/view_block_file_input.py +145 -0
- pachca_sdk-1.0.0/pachca/models/view_block_file_input_type.py +7 -0
- pachca_sdk-1.0.0/pachca/models/view_block_header.py +89 -0
- pachca_sdk-1.0.0/pachca/models/view_block_header_type.py +7 -0
- pachca_sdk-1.0.0/pachca/models/view_block_input.py +166 -0
- pachca_sdk-1.0.0/pachca/models/view_block_input_type.py +7 -0
- pachca_sdk-1.0.0/pachca/models/view_block_markdown.py +90 -0
- pachca_sdk-1.0.0/pachca/models/view_block_markdown_type.py +7 -0
- pachca_sdk-1.0.0/pachca/models/view_block_option.py +115 -0
- pachca_sdk-1.0.0/pachca/models/view_block_plain_text.py +90 -0
- pachca_sdk-1.0.0/pachca/models/view_block_plain_text_type.py +7 -0
- pachca_sdk-1.0.0/pachca/models/view_block_radio.py +149 -0
- pachca_sdk-1.0.0/pachca/models/view_block_radio_type.py +7 -0
- pachca_sdk-1.0.0/pachca/models/view_block_select.py +148 -0
- pachca_sdk-1.0.0/pachca/models/view_block_select_type.py +7 -0
- pachca_sdk-1.0.0/pachca/models/view_block_time.py +127 -0
- pachca_sdk-1.0.0/pachca/models/view_block_time_type.py +7 -0
- pachca_sdk-1.0.0/pachca/models/webhook_event.py +186 -0
- pachca_sdk-1.0.0/pachca/models/webhook_event_type.py +9 -0
- pachca_sdk-1.0.0/pachca/models/webhook_message_thread.py +85 -0
- pachca_sdk-1.0.0/pachca/py.typed +1 -0
- pachca_sdk-1.0.0/pachca/types.py +53 -0
- pachca_sdk-1.0.0/pyproject.toml +26 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pachca-sdk
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A client library for accessing Pachca API
|
|
5
|
+
Requires-Python: >=3.10,<4.0
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
12
|
+
Requires-Dist: attrs (>=22.2.0)
|
|
13
|
+
Requires-Dist: httpx (>=0.23.0,<0.29.0)
|
|
14
|
+
Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# pachca
|
|
18
|
+
A client library for accessing Pachca API
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
First, create a client:
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from pachca import Client
|
|
25
|
+
|
|
26
|
+
client = Client(base_url="https://api.example.com")
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
If the endpoints you're going to hit require authentication, use `AuthenticatedClient` instead:
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from pachca import AuthenticatedClient
|
|
33
|
+
|
|
34
|
+
client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSecretToken")
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Now call your endpoint and use your models:
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from pachca.models import MyDataModel
|
|
41
|
+
from pachca.api.my_tag import get_my_data_model
|
|
42
|
+
from pachca.types import Response
|
|
43
|
+
|
|
44
|
+
with client as client:
|
|
45
|
+
my_data: MyDataModel = get_my_data_model.sync(client=client)
|
|
46
|
+
# or if you need more info (e.g. status_code)
|
|
47
|
+
response: Response[MyDataModel] = get_my_data_model.sync_detailed(client=client)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Or do the same thing with an async version:
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from pachca.models import MyDataModel
|
|
54
|
+
from pachca.api.my_tag import get_my_data_model
|
|
55
|
+
from pachca.types import Response
|
|
56
|
+
|
|
57
|
+
async with client as client:
|
|
58
|
+
my_data: MyDataModel = await get_my_data_model.asyncio(client=client)
|
|
59
|
+
response: Response[MyDataModel] = await get_my_data_model.asyncio_detailed(client=client)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
By default, when you're calling an HTTPS API it will attempt to verify that SSL is working correctly. Using certificate verification is highly recommended most of the time, but sometimes you may need to authenticate to a server (especially an internal server) using a custom certificate bundle.
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
client = AuthenticatedClient(
|
|
66
|
+
base_url="https://internal_api.example.com",
|
|
67
|
+
token="SuperSecretToken",
|
|
68
|
+
verify_ssl="/path/to/certificate_bundle.pem",
|
|
69
|
+
)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
You can also disable certificate validation altogether, but beware that **this is a security risk**.
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
client = AuthenticatedClient(
|
|
76
|
+
base_url="https://internal_api.example.com",
|
|
77
|
+
token="SuperSecretToken",
|
|
78
|
+
verify_ssl=False
|
|
79
|
+
)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Things to know:
|
|
83
|
+
1. Every path/method combo becomes a Python module with four functions:
|
|
84
|
+
1. `sync`: Blocking request that returns parsed data (if successful) or `None`
|
|
85
|
+
1. `sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful.
|
|
86
|
+
1. `asyncio`: Like `sync` but async instead of blocking
|
|
87
|
+
1. `asyncio_detailed`: Like `sync_detailed` but async instead of blocking
|
|
88
|
+
|
|
89
|
+
1. All path/query params, and bodies become method arguments.
|
|
90
|
+
1. If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)
|
|
91
|
+
1. Any endpoint which did not have a tag will be in `pachca.api.default`
|
|
92
|
+
|
|
93
|
+
## Advanced customizations
|
|
94
|
+
|
|
95
|
+
There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case):
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from pachca import Client
|
|
99
|
+
|
|
100
|
+
def log_request(request):
|
|
101
|
+
print(f"Request event hook: {request.method} {request.url} - Waiting for response")
|
|
102
|
+
|
|
103
|
+
def log_response(response):
|
|
104
|
+
request = response.request
|
|
105
|
+
print(f"Response event hook: {request.method} {request.url} - Status {response.status_code}")
|
|
106
|
+
|
|
107
|
+
client = Client(
|
|
108
|
+
base_url="https://api.example.com",
|
|
109
|
+
httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}},
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client()
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url):
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
import httpx
|
|
119
|
+
from pachca import Client
|
|
120
|
+
|
|
121
|
+
client = Client(
|
|
122
|
+
base_url="https://api.example.com",
|
|
123
|
+
)
|
|
124
|
+
# Note that base_url needs to be re-set, as would any shared cookies, headers, etc.
|
|
125
|
+
client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030"))
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Building / publishing this package
|
|
129
|
+
This project uses [Poetry](https://python-poetry.org/) to manage dependencies and packaging. Here are the basics:
|
|
130
|
+
1. Update the metadata in pyproject.toml (e.g. authors, version)
|
|
131
|
+
1. If you're using a private repository, configure it with Poetry
|
|
132
|
+
1. `poetry config repositories.<your-repository-name> <url-to-your-repository>`
|
|
133
|
+
1. `poetry config http-basic.<your-repository-name> <username> <password>`
|
|
134
|
+
1. Publish the client with `poetry publish --build -r <your-repository-name>` or, if for public PyPI, just `poetry publish --build`
|
|
135
|
+
|
|
136
|
+
If you want to install this client into another project without publishing it (e.g. for development) then:
|
|
137
|
+
1. If that project **is using Poetry**, you can simply do `poetry add <path-to-this-client>` from that project
|
|
138
|
+
1. If that project is not using Poetry:
|
|
139
|
+
1. Build a wheel with `poetry build -f wheel`
|
|
140
|
+
1. Install that wheel from the other project `pip install <path-to-wheel>`
|
|
141
|
+
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# pachca
|
|
2
|
+
A client library for accessing Pachca API
|
|
3
|
+
|
|
4
|
+
## Usage
|
|
5
|
+
First, create a client:
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from pachca import Client
|
|
9
|
+
|
|
10
|
+
client = Client(base_url="https://api.example.com")
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
If the endpoints you're going to hit require authentication, use `AuthenticatedClient` instead:
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from pachca import AuthenticatedClient
|
|
17
|
+
|
|
18
|
+
client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSecretToken")
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Now call your endpoint and use your models:
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from pachca.models import MyDataModel
|
|
25
|
+
from pachca.api.my_tag import get_my_data_model
|
|
26
|
+
from pachca.types import Response
|
|
27
|
+
|
|
28
|
+
with client as client:
|
|
29
|
+
my_data: MyDataModel = get_my_data_model.sync(client=client)
|
|
30
|
+
# or if you need more info (e.g. status_code)
|
|
31
|
+
response: Response[MyDataModel] = get_my_data_model.sync_detailed(client=client)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Or do the same thing with an async version:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from pachca.models import MyDataModel
|
|
38
|
+
from pachca.api.my_tag import get_my_data_model
|
|
39
|
+
from pachca.types import Response
|
|
40
|
+
|
|
41
|
+
async with client as client:
|
|
42
|
+
my_data: MyDataModel = await get_my_data_model.asyncio(client=client)
|
|
43
|
+
response: Response[MyDataModel] = await get_my_data_model.asyncio_detailed(client=client)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
By default, when you're calling an HTTPS API it will attempt to verify that SSL is working correctly. Using certificate verification is highly recommended most of the time, but sometimes you may need to authenticate to a server (especially an internal server) using a custom certificate bundle.
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
client = AuthenticatedClient(
|
|
50
|
+
base_url="https://internal_api.example.com",
|
|
51
|
+
token="SuperSecretToken",
|
|
52
|
+
verify_ssl="/path/to/certificate_bundle.pem",
|
|
53
|
+
)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
You can also disable certificate validation altogether, but beware that **this is a security risk**.
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
client = AuthenticatedClient(
|
|
60
|
+
base_url="https://internal_api.example.com",
|
|
61
|
+
token="SuperSecretToken",
|
|
62
|
+
verify_ssl=False
|
|
63
|
+
)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Things to know:
|
|
67
|
+
1. Every path/method combo becomes a Python module with four functions:
|
|
68
|
+
1. `sync`: Blocking request that returns parsed data (if successful) or `None`
|
|
69
|
+
1. `sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful.
|
|
70
|
+
1. `asyncio`: Like `sync` but async instead of blocking
|
|
71
|
+
1. `asyncio_detailed`: Like `sync_detailed` but async instead of blocking
|
|
72
|
+
|
|
73
|
+
1. All path/query params, and bodies become method arguments.
|
|
74
|
+
1. If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)
|
|
75
|
+
1. Any endpoint which did not have a tag will be in `pachca.api.default`
|
|
76
|
+
|
|
77
|
+
## Advanced customizations
|
|
78
|
+
|
|
79
|
+
There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case):
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from pachca import Client
|
|
83
|
+
|
|
84
|
+
def log_request(request):
|
|
85
|
+
print(f"Request event hook: {request.method} {request.url} - Waiting for response")
|
|
86
|
+
|
|
87
|
+
def log_response(response):
|
|
88
|
+
request = response.request
|
|
89
|
+
print(f"Response event hook: {request.method} {request.url} - Status {response.status_code}")
|
|
90
|
+
|
|
91
|
+
client = Client(
|
|
92
|
+
base_url="https://api.example.com",
|
|
93
|
+
httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}},
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client()
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url):
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
import httpx
|
|
103
|
+
from pachca import Client
|
|
104
|
+
|
|
105
|
+
client = Client(
|
|
106
|
+
base_url="https://api.example.com",
|
|
107
|
+
)
|
|
108
|
+
# Note that base_url needs to be re-set, as would any shared cookies, headers, etc.
|
|
109
|
+
client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030"))
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Building / publishing this package
|
|
113
|
+
This project uses [Poetry](https://python-poetry.org/) to manage dependencies and packaging. Here are the basics:
|
|
114
|
+
1. Update the metadata in pyproject.toml (e.g. authors, version)
|
|
115
|
+
1. If you're using a private repository, configure it with Poetry
|
|
116
|
+
1. `poetry config repositories.<your-repository-name> <url-to-your-repository>`
|
|
117
|
+
1. `poetry config http-basic.<your-repository-name> <username> <password>`
|
|
118
|
+
1. Publish the client with `poetry publish --build -r <your-repository-name>` or, if for public PyPI, just `poetry publish --build`
|
|
119
|
+
|
|
120
|
+
If you want to install this client into another project without publishing it (e.g. for development) then:
|
|
121
|
+
1. If that project **is using Poetry**, you can simply do `poetry add <path-to-this-client>` from that project
|
|
122
|
+
1. If that project is not using Poetry:
|
|
123
|
+
1. Build a wheel with `poetry build -f wheel`
|
|
124
|
+
1. Install that wheel from the other project `pip install <path-to-wheel>`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
""" Contains methods for accessing the API """
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
""" Contains endpoint functions for accessing the API """
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...types import Response, UNSET
|
|
9
|
+
from ... import errors
|
|
10
|
+
|
|
11
|
+
from ...models.api_error import ApiError
|
|
12
|
+
from ...models.empty_response import EmptyResponse
|
|
13
|
+
from ...models.o_auth_error import OAuthError
|
|
14
|
+
from typing import cast
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _get_kwargs(
|
|
19
|
+
id: str,
|
|
20
|
+
|
|
21
|
+
) -> dict[str, Any]:
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
_kwargs: dict[str, Any] = {
|
|
29
|
+
"method": "delete",
|
|
30
|
+
"url": "/webhooks/events/{id}".format(id=quote(str(id), safe=""),),
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
return _kwargs
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> ApiError | EmptyResponse | OAuthError | None:
|
|
39
|
+
if response.status_code == 204:
|
|
40
|
+
response_204 = EmptyResponse.from_dict(response.json())
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
return response_204
|
|
45
|
+
|
|
46
|
+
if response.status_code == 401:
|
|
47
|
+
response_401 = OAuthError.from_dict(response.json())
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
return response_401
|
|
52
|
+
|
|
53
|
+
if response.status_code == 403:
|
|
54
|
+
response_403 = OAuthError.from_dict(response.json())
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
return response_403
|
|
59
|
+
|
|
60
|
+
if response.status_code == 404:
|
|
61
|
+
response_404 = ApiError.from_dict(response.json())
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
return response_404
|
|
66
|
+
|
|
67
|
+
if client.raise_on_unexpected_status:
|
|
68
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
69
|
+
else:
|
|
70
|
+
return None
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[ApiError | EmptyResponse | OAuthError]:
|
|
74
|
+
return Response(
|
|
75
|
+
status_code=HTTPStatus(response.status_code),
|
|
76
|
+
content=response.content,
|
|
77
|
+
headers=response.headers,
|
|
78
|
+
parsed=_parse_response(client=client, response=response),
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def sync_detailed(
|
|
83
|
+
id: str,
|
|
84
|
+
*,
|
|
85
|
+
client: AuthenticatedClient | Client,
|
|
86
|
+
|
|
87
|
+
) -> Response[ApiError | EmptyResponse | OAuthError]:
|
|
88
|
+
""" Удаление события
|
|
89
|
+
|
|
90
|
+
Данный метод доступен для работы только с `access_token` бота
|
|
91
|
+
|
|
92
|
+
Метод для удаления события из истории событий бота.
|
|
93
|
+
|
|
94
|
+
Для удаления события вам необходимо знать `access_token` бота, которому принадлежит событие, и `id`
|
|
95
|
+
события.
|
|
96
|
+
|
|
97
|
+
Args:
|
|
98
|
+
id (str):
|
|
99
|
+
|
|
100
|
+
Raises:
|
|
101
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
102
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
103
|
+
|
|
104
|
+
Returns:
|
|
105
|
+
Response[ApiError | EmptyResponse | OAuthError]
|
|
106
|
+
"""
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
kwargs = _get_kwargs(
|
|
110
|
+
id=id,
|
|
111
|
+
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
response = client.get_httpx_client().request(
|
|
115
|
+
**kwargs,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
return _build_response(client=client, response=response)
|
|
119
|
+
|
|
120
|
+
def sync(
|
|
121
|
+
id: str,
|
|
122
|
+
*,
|
|
123
|
+
client: AuthenticatedClient | Client,
|
|
124
|
+
|
|
125
|
+
) -> ApiError | EmptyResponse | OAuthError | None:
|
|
126
|
+
""" Удаление события
|
|
127
|
+
|
|
128
|
+
Данный метод доступен для работы только с `access_token` бота
|
|
129
|
+
|
|
130
|
+
Метод для удаления события из истории событий бота.
|
|
131
|
+
|
|
132
|
+
Для удаления события вам необходимо знать `access_token` бота, которому принадлежит событие, и `id`
|
|
133
|
+
события.
|
|
134
|
+
|
|
135
|
+
Args:
|
|
136
|
+
id (str):
|
|
137
|
+
|
|
138
|
+
Raises:
|
|
139
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
140
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
ApiError | EmptyResponse | OAuthError
|
|
144
|
+
"""
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
return sync_detailed(
|
|
148
|
+
id=id,
|
|
149
|
+
client=client,
|
|
150
|
+
|
|
151
|
+
).parsed
|
|
152
|
+
|
|
153
|
+
async def asyncio_detailed(
|
|
154
|
+
id: str,
|
|
155
|
+
*,
|
|
156
|
+
client: AuthenticatedClient | Client,
|
|
157
|
+
|
|
158
|
+
) -> Response[ApiError | EmptyResponse | OAuthError]:
|
|
159
|
+
""" Удаление события
|
|
160
|
+
|
|
161
|
+
Данный метод доступен для работы только с `access_token` бота
|
|
162
|
+
|
|
163
|
+
Метод для удаления события из истории событий бота.
|
|
164
|
+
|
|
165
|
+
Для удаления события вам необходимо знать `access_token` бота, которому принадлежит событие, и `id`
|
|
166
|
+
события.
|
|
167
|
+
|
|
168
|
+
Args:
|
|
169
|
+
id (str):
|
|
170
|
+
|
|
171
|
+
Raises:
|
|
172
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
173
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
174
|
+
|
|
175
|
+
Returns:
|
|
176
|
+
Response[ApiError | EmptyResponse | OAuthError]
|
|
177
|
+
"""
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
kwargs = _get_kwargs(
|
|
181
|
+
id=id,
|
|
182
|
+
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
response = await client.get_async_httpx_client().request(
|
|
186
|
+
**kwargs
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
return _build_response(client=client, response=response)
|
|
190
|
+
|
|
191
|
+
async def asyncio(
|
|
192
|
+
id: str,
|
|
193
|
+
*,
|
|
194
|
+
client: AuthenticatedClient | Client,
|
|
195
|
+
|
|
196
|
+
) -> ApiError | EmptyResponse | OAuthError | None:
|
|
197
|
+
""" Удаление события
|
|
198
|
+
|
|
199
|
+
Данный метод доступен для работы только с `access_token` бота
|
|
200
|
+
|
|
201
|
+
Метод для удаления события из истории событий бота.
|
|
202
|
+
|
|
203
|
+
Для удаления события вам необходимо знать `access_token` бота, которому принадлежит событие, и `id`
|
|
204
|
+
события.
|
|
205
|
+
|
|
206
|
+
Args:
|
|
207
|
+
id (str):
|
|
208
|
+
|
|
209
|
+
Raises:
|
|
210
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
211
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
212
|
+
|
|
213
|
+
Returns:
|
|
214
|
+
ApiError | EmptyResponse | OAuthError
|
|
215
|
+
"""
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
return (await asyncio_detailed(
|
|
219
|
+
id=id,
|
|
220
|
+
client=client,
|
|
221
|
+
|
|
222
|
+
)).parsed
|