blujay 1.0.0__py3-none-any.whl
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.
- blujay/__init__.py +1198 -0
- blujay/_default_clients.py +30 -0
- blujay/_errors.py +105 -0
- blujay/_version.py +2 -0
- blujay/attachments/__init__.py +40 -0
- blujay/attachments/client.py +374 -0
- blujay/attachments/raw_client.py +1058 -0
- blujay/attachments/types/__init__.py +38 -0
- blujay/attachments/types/attachment_create_response.py +30 -0
- blujay/attachments/types/attachment_get_response.py +30 -0
- blujay/calls/__init__.py +4 -0
- blujay/calls/client.py +113 -0
- blujay/calls/raw_client.py +263 -0
- blujay/capability/__init__.py +36 -0
- blujay/capability/client.py +152 -0
- blujay/capability/raw_client.py +302 -0
- blujay/capability/types/__init__.py +34 -0
- blujay/capability/types/capability_evaluate_service_response.py +30 -0
- blujay/chats/__init__.py +72 -0
- blujay/chats/client.py +848 -0
- blujay/chats/messages/__init__.py +40 -0
- blujay/chats/messages/client.py +336 -0
- blujay/chats/messages/raw_client.py +652 -0
- blujay/chats/messages/types/__init__.py +38 -0
- blujay/chats/messages/types/chat_message_list_response.py +30 -0
- blujay/chats/messages/types/chat_message_send_response.py +30 -0
- blujay/chats/participants/__init__.py +42 -0
- blujay/chats/participants/client.py +355 -0
- blujay/chats/participants/raw_client.py +817 -0
- blujay/chats/participants/types/__init__.py +40 -0
- blujay/chats/participants/types/chat_participant_add_response.py +30 -0
- blujay/chats/participants/types/chat_participant_list_response.py +30 -0
- blujay/chats/participants/types/chat_participant_remove_response.py +30 -0
- blujay/chats/raw_client.py +1913 -0
- blujay/chats/types/__init__.py +44 -0
- blujay/chats/types/chat_create_response.py +30 -0
- blujay/chats/types/chat_get_response.py +30 -0
- blujay/chats/types/chat_leave_response.py +30 -0
- blujay/chats/types/chat_list_response.py +30 -0
- blujay/chats/types/chat_update_response.py +30 -0
- blujay/chats/typing/__init__.py +4 -0
- blujay/chats/typing/client.py +186 -0
- blujay/chats/typing/raw_client.py +453 -0
- blujay/client.py +426 -0
- blujay/contacts/__init__.py +87 -0
- blujay/contacts/client.py +1336 -0
- blujay/contacts/notes/__init__.py +40 -0
- blujay/contacts/notes/client.py +248 -0
- blujay/contacts/notes/raw_client.py +549 -0
- blujay/contacts/notes/types/__init__.py +38 -0
- blujay/contacts/notes/types/contact_note_create_response.py +30 -0
- blujay/contacts/notes/types/contact_note_list_response.py +30 -0
- blujay/contacts/raw_client.py +3005 -0
- blujay/contacts/types/__init__.py +74 -0
- blujay/contacts/types/contact_add_tag_response.py +30 -0
- blujay/contacts/types/contact_assign_response.py +30 -0
- blujay/contacts/types/contact_create_response.py +30 -0
- blujay/contacts/types/contact_get_response.py +30 -0
- blujay/contacts/types/contact_list_response.py +30 -0
- blujay/contacts/types/contact_mark_completed_response.py +30 -0
- blujay/contacts/types/contact_opt_out_address_response.py +30 -0
- blujay/contacts/types/contact_opt_out_response.py +30 -0
- blujay/contacts/types/contact_remove_opt_out_response.py +30 -0
- blujay/contacts/types/contact_search_response.py +30 -0
- blujay/contacts/types/contact_stage.py +5 -0
- blujay/contacts/types/contact_update_response.py +30 -0
- blujay/contacts/types/contact_upsert_response.py +30 -0
- blujay/core/__init__.py +139 -0
- blujay/core/api_error.py +62 -0
- blujay/core/client_wrapper.py +146 -0
- blujay/core/datetime_utils.py +70 -0
- blujay/core/file.py +67 -0
- blujay/core/force_multipart.py +18 -0
- blujay/core/http_client.py +1021 -0
- blujay/core/http_response.py +63 -0
- blujay/core/http_sse/__init__.py +42 -0
- blujay/core/http_sse/_api.py +455 -0
- blujay/core/http_sse/_decoders.py +74 -0
- blujay/core/http_sse/_exceptions.py +7 -0
- blujay/core/http_sse/_models.py +17 -0
- blujay/core/jsonable_encoder.py +145 -0
- blujay/core/logging.py +107 -0
- blujay/core/pagination.py +167 -0
- blujay/core/parse_error.py +36 -0
- blujay/core/pydantic_utilities.py +540 -0
- blujay/core/query_encoder.py +58 -0
- blujay/core/remove_none_from_dict.py +11 -0
- blujay/core/request_options.py +41 -0
- blujay/core/serialization.py +349 -0
- blujay/core/unchecked_base_model.py +505 -0
- blujay/environment.py +7 -0
- blujay/errors/__init__.py +71 -0
- blujay/errors/bad_gateway_error.py +11 -0
- blujay/errors/bad_request_error.py +11 -0
- blujay/errors/conflict_error.py +11 -0
- blujay/errors/content_too_large_error.py +11 -0
- blujay/errors/forbidden_error.py +11 -0
- blujay/errors/internal_server_error.py +11 -0
- blujay/errors/not_found_error.py +11 -0
- blujay/errors/service_unavailable_error.py +11 -0
- blujay/errors/too_many_requests_error.py +11 -0
- blujay/errors/unauthorized_error.py +11 -0
- blujay/errors/unprocessable_entity_error.py +11 -0
- blujay/errors/unsupported_media_type_error.py +11 -0
- blujay/me/__init__.py +34 -0
- blujay/me/client.py +100 -0
- blujay/me/raw_client.py +192 -0
- blujay/me/types/__init__.py +34 -0
- blujay/me/types/me_get_response.py +30 -0
- blujay/messages/__init__.py +69 -0
- blujay/messages/client.py +647 -0
- blujay/messages/raw_client.py +1406 -0
- blujay/messages/reactions/__init__.py +40 -0
- blujay/messages/reactions/client.py +315 -0
- blujay/messages/reactions/raw_client.py +741 -0
- blujay/messages/reactions/types/__init__.py +38 -0
- blujay/messages/reactions/types/message_reaction_add_response.py +30 -0
- blujay/messages/reactions/types/message_reaction_remove_response.py +30 -0
- blujay/messages/types/__init__.py +56 -0
- blujay/messages/types/message_edit_response.py +30 -0
- blujay/messages/types/message_get_response.py +30 -0
- blujay/messages/types/message_include.py +5 -0
- blujay/messages/types/message_list_response.py +30 -0
- blujay/messages/types/message_list_thread_order.py +5 -0
- blujay/messages/types/message_list_thread_response.py +30 -0
- blujay/messages/types/message_unsend_response.py +30 -0
- blujay/phone_numbers/__init__.py +54 -0
- blujay/phone_numbers/client.py +203 -0
- blujay/phone_numbers/contact_card/__init__.py +46 -0
- blujay/phone_numbers/contact_card/client.py +402 -0
- blujay/phone_numbers/contact_card/raw_client.py +1065 -0
- blujay/phone_numbers/contact_card/types/__init__.py +44 -0
- blujay/phone_numbers/contact_card/types/phone_number_contact_card_delete_response.py +30 -0
- blujay/phone_numbers/contact_card/types/phone_number_contact_card_get_response.py +30 -0
- blujay/phone_numbers/contact_card/types/phone_number_contact_card_set_response.py +30 -0
- blujay/phone_numbers/raw_client.py +396 -0
- blujay/phone_numbers/types/__init__.py +38 -0
- blujay/phone_numbers/types/phone_number_get_response.py +30 -0
- blujay/phone_numbers/types/phone_number_list_response.py +30 -0
- blujay/py.typed +0 -0
- blujay/requests/__init__.py +97 -0
- blujay/requests/audio_part.py +18 -0
- blujay/requests/bubble_effect.py +10 -0
- blujay/requests/chat_icon_input.py +11 -0
- blujay/requests/link_part.py +13 -0
- blujay/requests/media_part.py +18 -0
- blujay/requests/message_effect.py +8 -0
- blujay/requests/message_input.py +33 -0
- blujay/requests/message_part.py +11 -0
- blujay/requests/message_reply_to.py +26 -0
- blujay/requests/screen_effect.py +10 -0
- blujay/requests/text_decoration.py +19 -0
- blujay/requests/text_part.py +16 -0
- blujay/requests/vcard_email_input.py +9 -0
- blujay/requests/vcard_part.py +14 -0
- blujay/requests/vcard_phone_input.py +13 -0
- blujay/requests/webhook_phone_number_filter.py +21 -0
- blujay/requests/workflow_metadata.py +10 -0
- blujay/requests/workflow_metadata_value.py +5 -0
- blujay/team_members/__init__.py +36 -0
- blujay/team_members/client.py +104 -0
- blujay/team_members/raw_client.py +196 -0
- blujay/team_members/types/__init__.py +34 -0
- blujay/team_members/types/team_member_list_assignable_response.py +30 -0
- blujay/types/__init__.py +896 -0
- blujay/types/accepted_chat_leave.py +27 -0
- blujay/types/accepted_chat_leave_operation.py +5 -0
- blujay/types/accepted_chat_leave_status.py +5 -0
- blujay/types/accepted_chat_metadata_mutation.py +39 -0
- blujay/types/accepted_chat_metadata_mutation_operation.py +7 -0
- blujay/types/accepted_chat_metadata_mutation_status.py +5 -0
- blujay/types/accepted_group_participant_mutation.py +33 -0
- blujay/types/accepted_group_participant_mutation_operation.py +7 -0
- blujay/types/accepted_group_participant_mutation_participant.py +24 -0
- blujay/types/accepted_group_participant_mutation_participant_status.py +5 -0
- blujay/types/accepted_group_participant_mutation_participant_type.py +5 -0
- blujay/types/accepted_group_participant_mutation_status.py +7 -0
- blujay/types/accepted_message.py +23 -0
- blujay/types/accepted_message_reaction.py +35 -0
- blujay/types/accepted_message_reaction_operation.py +5 -0
- blujay/types/accepted_message_reaction_reaction.py +27 -0
- blujay/types/accepted_message_reaction_status.py +5 -0
- blujay/types/api_key_credential.py +24 -0
- blujay/types/api_key_credential_status.py +5 -0
- blujay/types/api_key_credential_type.py +5 -0
- blujay/types/api_key_summary.py +22 -0
- blujay/types/api_key_summary_status.py +5 -0
- blujay/types/assignable_team_member_list.py +21 -0
- blujay/types/assigned_team_member.py +23 -0
- blujay/types/attachment.py +30 -0
- blujay/types/attachment_id.py +3 -0
- blujay/types/attachment_status.py +5 -0
- blujay/types/attachment_upload.py +35 -0
- blujay/types/attachment_upload_upload_headers.py +31 -0
- blujay/types/audio_output_part.py +34 -0
- blujay/types/audio_output_part_type.py +5 -0
- blujay/types/audio_part.py +31 -0
- blujay/types/audio_part_type.py +5 -0
- blujay/types/bubble_effect.py +23 -0
- blujay/types/bubble_effect_name.py +5 -0
- blujay/types/bubble_effect_type.py +5 -0
- blujay/types/call_ended_webhook_data.py +87 -0
- blujay/types/call_ended_webhook_data_direction.py +5 -0
- blujay/types/call_ended_webhook_data_outcome.py +7 -0
- blujay/types/call_ended_webhook_data_type.py +5 -0
- blujay/types/call_ended_webhook_event.py +47 -0
- blujay/types/call_ended_webhook_event_api_version.py +5 -0
- blujay/types/call_id.py +3 -0
- blujay/types/call_recording_ready_webhook_data.py +94 -0
- blujay/types/call_recording_ready_webhook_data_direction.py +5 -0
- blujay/types/call_recording_ready_webhook_data_outcome.py +7 -0
- blujay/types/call_recording_ready_webhook_data_recording.py +30 -0
- blujay/types/call_recording_ready_webhook_data_recording_kind.py +5 -0
- blujay/types/call_recording_ready_webhook_data_summary.py +26 -0
- blujay/types/call_recording_ready_webhook_data_summary_status.py +5 -0
- blujay/types/call_recording_ready_webhook_data_transcript.py +26 -0
- blujay/types/call_recording_ready_webhook_data_transcript_status.py +5 -0
- blujay/types/call_recording_ready_webhook_data_type.py +5 -0
- blujay/types/call_recording_ready_webhook_event.py +47 -0
- blujay/types/call_recording_ready_webhook_event_api_version.py +5 -0
- blujay/types/capability_service_result.py +42 -0
- blujay/types/capability_service_result_service.py +5 -0
- blujay/types/capability_service_result_source.py +5 -0
- blujay/types/chat.py +66 -0
- blujay/types/chat_icon.py +28 -0
- blujay/types/chat_icon_input.py +24 -0
- blujay/types/chat_id.py +3 -0
- blujay/types/chat_list.py +24 -0
- blujay/types/chat_participant.py +8 -0
- blujay/types/chat_service.py +5 -0
- blujay/types/chat_type.py +5 -0
- blujay/types/contact.py +66 -0
- blujay/types/contact_assignment_action_result.py +66 -0
- blujay/types/contact_card_profile.py +52 -0
- blujay/types/contact_card_profile_photo.py +26 -0
- blujay/types/contact_card_profile_photo_content_type.py +5 -0
- blujay/types/contact_card_profile_status.py +5 -0
- blujay/types/contact_id.py +3 -0
- blujay/types/contact_list.py +24 -0
- blujay/types/contact_note.py +39 -0
- blujay/types/contact_note_list.py +24 -0
- blujay/types/contact_note_source.py +5 -0
- blujay/types/contact_search_result.py +21 -0
- blujay/types/contact_stage_action_result.py +66 -0
- blujay/types/contact_suppression.py +27 -0
- blujay/types/contact_suppression_address_type.py +5 -0
- blujay/types/contact_tag_action_result.py +66 -0
- blujay/types/direct_chat_participant.py +37 -0
- blujay/types/direct_chat_participant_type.py +5 -0
- blujay/types/error_envelope.py +35 -0
- blujay/types/error_envelope_status.py +5 -0
- blujay/types/error_object.py +64 -0
- blujay/types/event_id.py +3 -0
- blujay/types/generic_webhook_event.py +46 -0
- blujay/types/generic_webhook_event_api_version.py +5 -0
- blujay/types/group_name_webhook_data.py +26 -0
- blujay/types/group_name_webhook_event.py +47 -0
- blujay/types/group_name_webhook_event_api_version.py +5 -0
- blujay/types/group_participant.py +39 -0
- blujay/types/group_participant_list.py +21 -0
- blujay/types/group_participant_status.py +5 -0
- blujay/types/group_participant_type.py +5 -0
- blujay/types/group_participant_webhook_data.py +27 -0
- blujay/types/group_participant_webhook_event.py +47 -0
- blujay/types/group_participant_webhook_event_api_version.py +5 -0
- blujay/types/group_phone_number.py +46 -0
- blujay/types/group_sendability_reason.py +7 -0
- blujay/types/group_webhook_participant.py +30 -0
- blujay/types/group_webhook_participant_status.py +5 -0
- blujay/types/group_webhook_participant_type.py +5 -0
- blujay/types/link_part.py +26 -0
- blujay/types/link_part_type.py +5 -0
- blujay/types/me.py +29 -0
- blujay/types/media_output_part.py +30 -0
- blujay/types/media_output_part_type.py +5 -0
- blujay/types/media_part.py +31 -0
- blujay/types/media_part_type.py +5 -0
- blujay/types/member_id.py +3 -0
- blujay/types/message.py +159 -0
- blujay/types/message_actionable_failure_code.py +14 -0
- blujay/types/message_degradation.py +25 -0
- blujay/types/message_degradation_code.py +7 -0
- blujay/types/message_direction.py +5 -0
- blujay/types/message_edit_history_entry.py +22 -0
- blujay/types/message_edited_webhook_data.py +64 -0
- blujay/types/message_edited_webhook_event.py +47 -0
- blujay/types/message_edited_webhook_event_api_version.py +5 -0
- blujay/types/message_effect.py +8 -0
- blujay/types/message_failure.py +26 -0
- blujay/types/message_failure_code.py +18 -0
- blujay/types/message_id.py +3 -0
- blujay/types/message_input.py +44 -0
- blujay/types/message_input_preferred_service.py +5 -0
- blujay/types/message_lifecycle_webhook_data.py +88 -0
- blujay/types/message_lifecycle_webhook_data_direction.py +5 -0
- blujay/types/message_lifecycle_webhook_data_requested_service.py +5 -0
- blujay/types/message_lifecycle_webhook_data_service.py +5 -0
- blujay/types/message_lifecycle_webhook_data_status.py +7 -0
- blujay/types/message_lifecycle_webhook_event.py +47 -0
- blujay/types/message_lifecycle_webhook_event_api_version.py +5 -0
- blujay/types/message_list.py +24 -0
- blujay/types/message_output_part.py +10 -0
- blujay/types/message_part.py +11 -0
- blujay/types/message_preferred_service.py +5 -0
- blujay/types/message_reaction.py +46 -0
- blujay/types/message_received_webhook_data.py +95 -0
- blujay/types/message_received_webhook_data_direction.py +5 -0
- blujay/types/message_received_webhook_data_requested_service.py +5 -0
- blujay/types/message_received_webhook_data_service.py +5 -0
- blujay/types/message_received_webhook_data_status.py +5 -0
- blujay/types/message_received_webhook_event.py +47 -0
- blujay/types/message_received_webhook_event_api_version.py +5 -0
- blujay/types/message_reply_to.py +39 -0
- blujay/types/message_reply_to_info.py +34 -0
- blujay/types/message_sender.py +36 -0
- blujay/types/message_sender_type.py +5 -0
- blujay/types/message_service.py +5 -0
- blujay/types/message_status.py +7 -0
- blujay/types/message_team_member_id.py +10 -0
- blujay/types/message_unsent_scope.py +5 -0
- blujay/types/message_unsent_webhook_data.py +64 -0
- blujay/types/message_unsent_webhook_data_unsent_scope.py +5 -0
- blujay/types/message_unsent_webhook_event.py +47 -0
- blujay/types/message_unsent_webhook_event_api_version.py +5 -0
- blujay/types/message_webhook_recipient.py +32 -0
- blujay/types/message_webhook_recipient_type.py +5 -0
- blujay/types/new_message.py +68 -0
- blujay/types/new_message_delivery_status.py +5 -0
- blujay/types/new_message_direction.py +5 -0
- blujay/types/new_message_preferred_service.py +5 -0
- blujay/types/new_message_service.py +5 -0
- blujay/types/phone_number.py +79 -0
- blujay/types/phone_number_access_type.py +5 -0
- blujay/types/phone_number_assigned_webhook_data.py +29 -0
- blujay/types/phone_number_assigned_webhook_event.py +47 -0
- blujay/types/phone_number_assigned_webhook_event_api_version.py +5 -0
- blujay/types/phone_number_capabilities.py +26 -0
- blujay/types/phone_number_capabilities_messaging.py +23 -0
- blujay/types/phone_number_capabilities_voice.py +25 -0
- blujay/types/phone_number_health.py +29 -0
- blujay/types/phone_number_health_status.py +5 -0
- blujay/types/phone_number_id.py +3 -0
- blujay/types/phone_number_limits.py +34 -0
- blujay/types/phone_number_limits_daily.py +27 -0
- blujay/types/phone_number_limits_new_contacts.py +28 -0
- blujay/types/phone_number_line_type.py +5 -0
- blujay/types/phone_number_list.py +21 -0
- blujay/types/phone_number_outbound_policy.py +31 -0
- blujay/types/phone_number_queue.py +26 -0
- blujay/types/phone_number_released_webhook_data.py +29 -0
- blujay/types/phone_number_released_webhook_event.py +47 -0
- blujay/types/phone_number_released_webhook_event_api_version.py +5 -0
- blujay/types/phone_number_send_status.py +33 -0
- blujay/types/phone_number_send_status_reason_code.py +7 -0
- blujay/types/phone_number_status.py +5 -0
- blujay/types/reaction_emoji.py +6 -0
- blujay/types/reaction_kind.py +7 -0
- blujay/types/reaction_reactor.py +8 -0
- blujay/types/reaction_reactor_address.py +22 -0
- blujay/types/reaction_reactor_address_type.py +5 -0
- blujay/types/reaction_reactor_phone_number_id.py +23 -0
- blujay/types/reaction_reactor_phone_number_id_type.py +5 -0
- blujay/types/reaction_sticker.py +32 -0
- blujay/types/reaction_type.py +7 -0
- blujay/types/reaction_webhook_data.py +36 -0
- blujay/types/reaction_webhook_data_reaction.py +37 -0
- blujay/types/reaction_webhook_event.py +47 -0
- blujay/types/reaction_webhook_event_api_version.py +5 -0
- blujay/types/screen_effect.py +23 -0
- blujay/types/screen_effect_name.py +20 -0
- blujay/types/screen_effect_type.py +5 -0
- blujay/types/success_envelope.py +34 -0
- blujay/types/team_member.py +23 -0
- blujay/types/text_decoration.py +30 -0
- blujay/types/text_decoration_style.py +5 -0
- blujay/types/text_part.py +27 -0
- blujay/types/text_part_type.py +5 -0
- blujay/types/trace_id.py +3 -0
- blujay/types/typing_webhook_data.py +39 -0
- blujay/types/typing_webhook_event.py +47 -0
- blujay/types/typing_webhook_event_api_version.py +5 -0
- blujay/types/typing_webhook_participant.py +28 -0
- blujay/types/typing_webhook_participant_type.py +5 -0
- blujay/types/vcard.py +38 -0
- blujay/types/vcard_email.py +22 -0
- blujay/types/vcard_email_input.py +22 -0
- blujay/types/vcard_email_input_type.py +5 -0
- blujay/types/vcard_email_type.py +5 -0
- blujay/types/vcard_fields.py +39 -0
- blujay/types/vcard_id.py +3 -0
- blujay/types/vcard_list.py +24 -0
- blujay/types/vcard_part.py +27 -0
- blujay/types/vcard_part_type.py +5 -0
- blujay/types/vcard_phone.py +26 -0
- blujay/types/vcard_phone_input.py +26 -0
- blujay/types/vcard_phone_input_type.py +5 -0
- blujay/types/vcard_phone_type.py +5 -0
- blujay/types/webhook_delivery_attempt.py +54 -0
- blujay/types/webhook_delivery_attempt_delivery_mode.py +5 -0
- blujay/types/webhook_delivery_attempt_error_code.py +26 -0
- blujay/types/webhook_delivery_attempt_list.py +24 -0
- blujay/types/webhook_delivery_attempt_status.py +5 -0
- blujay/types/webhook_envelope.py +51 -0
- blujay/types/webhook_envelope_api_version.py +5 -0
- blujay/types/webhook_event.py +620 -0
- blujay/types/webhook_event_type.py +31 -0
- blujay/types/webhook_payload_version.py +7 -0
- blujay/types/webhook_phone_number_filter.py +50 -0
- blujay/types/webhook_phone_number_filter_all.py +18 -0
- blujay/types/webhook_phone_number_filter_selected.py +20 -0
- blujay/types/webhook_replay_accepted.py +25 -0
- blujay/types/webhook_replay_accepted_status.py +5 -0
- blujay/types/webhook_subscribable_event_type.py +31 -0
- blujay/types/webhook_subscription.py +38 -0
- blujay/types/webhook_subscription_id.py +3 -0
- blujay/types/webhook_subscription_list.py +24 -0
- blujay/types/webhook_subscription_status.py +5 -0
- blujay/types/webhook_subscription_with_secret.py +43 -0
- blujay/types/workflow.py +22 -0
- blujay/types/workflow_id.py +3 -0
- blujay/types/workflow_list.py +21 -0
- blujay/types/workflow_metadata.py +10 -0
- blujay/types/workflow_metadata_value.py +5 -0
- blujay/types/workflow_run_summary.py +24 -0
- blujay/types/workflow_trigger.py +32 -0
- blujay/types/workspace_id.py +3 -0
- blujay/vcards/__init__.py +44 -0
- blujay/vcards/client.py +578 -0
- blujay/vcards/raw_client.py +1191 -0
- blujay/vcards/types/__init__.py +42 -0
- blujay/vcards/types/vcard_create_response.py +30 -0
- blujay/vcards/types/vcard_get_response.py +30 -0
- blujay/vcards/types/vcard_list_response.py +30 -0
- blujay/vcards/types/vcard_update_response.py +30 -0
- blujay/webhook_subscriptions/__init__.py +55 -0
- blujay/webhook_subscriptions/client.py +804 -0
- blujay/webhook_subscriptions/raw_client.py +1723 -0
- blujay/webhook_subscriptions/types/__init__.py +53 -0
- blujay/webhook_subscriptions/types/webhook_subscription_create_response.py +30 -0
- blujay/webhook_subscriptions/types/webhook_subscription_get_response.py +30 -0
- blujay/webhook_subscriptions/types/webhook_subscription_list_deliveries_response.py +30 -0
- blujay/webhook_subscriptions/types/webhook_subscription_list_response.py +30 -0
- blujay/webhook_subscriptions/types/webhook_subscription_replay_event_response.py +30 -0
- blujay/webhook_subscriptions/types/webhook_subscription_update_response.py +30 -0
- blujay/webhooks.py +124 -0
- blujay/workflows/__init__.py +40 -0
- blujay/workflows/client.py +235 -0
- blujay/workflows/raw_client.py +510 -0
- blujay/workflows/types/__init__.py +38 -0
- blujay/workflows/types/workflow_enroll_response.py +30 -0
- blujay/workflows/types/workflow_list_response.py +30 -0
- blujay-1.0.0.dist-info/METADATA +274 -0
- blujay-1.0.0.dist-info/RECORD +455 -0
- blujay-1.0.0.dist-info/WHEEL +4 -0
- blujay-1.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
SDK_DEFAULT_TIMEOUT = 60
|
|
8
|
+
|
|
9
|
+
try:
|
|
10
|
+
import httpx_aiohttp # type: ignore[import-not-found]
|
|
11
|
+
except ImportError:
|
|
12
|
+
|
|
13
|
+
class DefaultAioHttpClient(httpx.AsyncClient): # type: ignore
|
|
14
|
+
def __init__(self, **kwargs: typing.Any) -> None:
|
|
15
|
+
raise RuntimeError("To use the aiohttp client, install the aiohttp extra: pip install blujay[aiohttp]")
|
|
16
|
+
|
|
17
|
+
else:
|
|
18
|
+
|
|
19
|
+
class DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore
|
|
20
|
+
def __init__(self, **kwargs: typing.Any) -> None:
|
|
21
|
+
kwargs.setdefault("timeout", SDK_DEFAULT_TIMEOUT)
|
|
22
|
+
kwargs.setdefault("follow_redirects", True)
|
|
23
|
+
super().__init__(**kwargs)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class DefaultAsyncHttpxClient(httpx.AsyncClient):
|
|
27
|
+
def __init__(self, **kwargs: typing.Any) -> None:
|
|
28
|
+
kwargs.setdefault("timeout", SDK_DEFAULT_TIMEOUT)
|
|
29
|
+
kwargs.setdefault("follow_redirects", True)
|
|
30
|
+
super().__init__(**kwargs)
|
blujay/_errors.py
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Hand-written (not generated): how BlujayError reads and prints an API error.
|
|
2
|
+
#
|
|
3
|
+
# Every Blujay error response has the same envelope:
|
|
4
|
+
# {"status": "error", "error": {"code", "message", "retryable", "retry_after"?}, "trace_id"}
|
|
5
|
+
# The message is one line, for example:
|
|
6
|
+
# 401 UNAUTHORIZED: Authentication failed (trace_id trc_8f2a1c0e4b7d)
|
|
7
|
+
import email.utils
|
|
8
|
+
import json
|
|
9
|
+
import re
|
|
10
|
+
import time
|
|
11
|
+
import typing
|
|
12
|
+
|
|
13
|
+
_RETRYABLE_STATUSES = {408, 429, 500, 502, 503, 504}
|
|
14
|
+
_MAX_SNIPPET = 160
|
|
15
|
+
_TITLE = re.compile(r"<title[^>]*>([^<]*)</title>", re.IGNORECASE)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _field(value: typing.Any, name: str) -> typing.Any:
|
|
19
|
+
"""Read a field from a parsed model (the typed errors) or a dict (any other status)."""
|
|
20
|
+
if isinstance(value, dict):
|
|
21
|
+
return value.get(name)
|
|
22
|
+
return getattr(value, name, None)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def read_error_body(body: typing.Any) -> typing.Dict[str, typing.Any]:
|
|
26
|
+
"""The fields of a Blujay error envelope; each is None when the body isn't one."""
|
|
27
|
+
if body is None or isinstance(body, (str, bytes)):
|
|
28
|
+
return {"code": None, "message": None, "doc_url": None, "retryable": None, "retry_after": None, "trace_id": None}
|
|
29
|
+
error = _field(body, "error")
|
|
30
|
+
code = _field(error, "code") if error is not None else None
|
|
31
|
+
message = _field(error, "message") if error is not None else None
|
|
32
|
+
doc_url = _field(error, "doc_url") if error is not None else None
|
|
33
|
+
retryable = _field(error, "retryable") if error is not None else None
|
|
34
|
+
retry_after = _field(error, "retry_after") if error is not None else None
|
|
35
|
+
trace_id = _field(body, "trace_id")
|
|
36
|
+
return {
|
|
37
|
+
"code": code if isinstance(code, str) else None,
|
|
38
|
+
"message": message if isinstance(message, str) else None,
|
|
39
|
+
"doc_url": doc_url if isinstance(doc_url, str) else None,
|
|
40
|
+
"retryable": retryable if isinstance(retryable, bool) else None,
|
|
41
|
+
"retry_after": retry_after if isinstance(retry_after, int) and not isinstance(retry_after, bool) and retry_after > 0 else None,
|
|
42
|
+
"trace_id": trace_id if isinstance(trace_id, str) else None,
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def header(headers: typing.Optional[typing.Mapping[str, str]], name: str) -> typing.Optional[str]:
|
|
47
|
+
for key, value in (headers or {}).items():
|
|
48
|
+
if key.lower() == name:
|
|
49
|
+
return value
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def parse_retry_after(value: typing.Optional[str], now: typing.Optional[float] = None) -> typing.Optional[int]:
|
|
54
|
+
"""Seconds from a Retry-After header (a number of seconds or an HTTP date)."""
|
|
55
|
+
if value is None or not value.strip():
|
|
56
|
+
return None
|
|
57
|
+
if value.strip().isdigit():
|
|
58
|
+
seconds = int(value.strip())
|
|
59
|
+
return seconds if seconds > 0 else None
|
|
60
|
+
parsed = email.utils.parsedate_tz(value)
|
|
61
|
+
if parsed is None:
|
|
62
|
+
return None
|
|
63
|
+
seconds = int(email.utils.mktime_tz(parsed) - (time.time() if now is None else now) + 0.999)
|
|
64
|
+
return seconds if seconds > 0 else None
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def is_retryable_status(status_code: typing.Optional[int]) -> bool:
|
|
68
|
+
return status_code in _RETRYABLE_STATUSES
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def _snippet(text: str) -> str:
|
|
72
|
+
if text.lstrip().startswith("<"):
|
|
73
|
+
match = _TITLE.search(text)
|
|
74
|
+
title = match.group(1).strip() if match else ""
|
|
75
|
+
return f'HTML page "{title}"' if title else "HTML page instead of JSON"
|
|
76
|
+
one_line = " ".join(text.split())
|
|
77
|
+
return one_line[:_MAX_SNIPPET] + "…" if len(one_line) > _MAX_SNIPPET else one_line
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def format_error_message(*, status_code: typing.Optional[int], body: typing.Any) -> str:
|
|
81
|
+
"""One line that says what went wrong.
|
|
82
|
+
|
|
83
|
+
With an API error response: ``<status> <CODE>: <message> (trace_id <id>)``. Without one, the
|
|
84
|
+
status and a short piece of the body, or the message alone when there was no response (a
|
|
85
|
+
missing API key, for example).
|
|
86
|
+
"""
|
|
87
|
+
fields = read_error_body(body)
|
|
88
|
+
if fields["code"] is not None or fields["message"] is not None:
|
|
89
|
+
head = " ".join(str(part) for part in (status_code, fields["code"]) if part is not None)
|
|
90
|
+
text = fields["message"] or "Request failed"
|
|
91
|
+
trace = f" (trace_id {fields['trace_id']})" if fields["trace_id"] else ""
|
|
92
|
+
return f"{head + ': ' if head else ''}{text}{trace}"
|
|
93
|
+
if isinstance(body, bytes):
|
|
94
|
+
body = body.decode("utf-8", "replace")
|
|
95
|
+
detail: typing.Optional[str] = None
|
|
96
|
+
if isinstance(body, str) and body.strip():
|
|
97
|
+
detail = _snippet(body)
|
|
98
|
+
elif body is not None and not isinstance(body, str):
|
|
99
|
+
try:
|
|
100
|
+
detail = _snippet(json.dumps(body, default=str))
|
|
101
|
+
except (TypeError, ValueError):
|
|
102
|
+
detail = _snippet(str(body))
|
|
103
|
+
if status_code is not None:
|
|
104
|
+
return f"{status_code}: {detail or 'The response had no body'}"
|
|
105
|
+
return detail or "Request failed"
|
blujay/_version.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
import typing
|
|
6
|
+
from importlib import import_module
|
|
7
|
+
|
|
8
|
+
if typing.TYPE_CHECKING:
|
|
9
|
+
from .types import AttachmentCreateResponse, AttachmentGetResponse
|
|
10
|
+
_dynamic_imports: typing.Dict[str, str] = {
|
|
11
|
+
"AttachmentCreateResponse": ".types",
|
|
12
|
+
"AttachmentGetResponse": ".types",
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
|
17
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
18
|
+
if module_name is None:
|
|
19
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
|
20
|
+
try:
|
|
21
|
+
module = import_module(module_name, __package__)
|
|
22
|
+
if module_name == f".{attr_name}":
|
|
23
|
+
return module
|
|
24
|
+
else:
|
|
25
|
+
return getattr(module, attr_name)
|
|
26
|
+
except ImportError as e:
|
|
27
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
|
28
|
+
except AttributeError as e:
|
|
29
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def __dir__():
|
|
33
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
34
|
+
return sorted(lazy_attrs)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
__all__ = [
|
|
38
|
+
"AttachmentCreateResponse",
|
|
39
|
+
"AttachmentGetResponse",
|
|
40
|
+
]
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
|
+
from ..core.request_options import RequestOptions
|
|
7
|
+
from ..types.attachment_id import AttachmentId
|
|
8
|
+
from .raw_client import AsyncRawAttachmentsClient, RawAttachmentsClient
|
|
9
|
+
from .types.attachment_create_response import AttachmentCreateResponse
|
|
10
|
+
from .types.attachment_get_response import AttachmentGetResponse
|
|
11
|
+
|
|
12
|
+
# this is used as the default value for optional parameters
|
|
13
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class AttachmentsClient:
|
|
17
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
18
|
+
self._raw_client = RawAttachmentsClient(client_wrapper=client_wrapper)
|
|
19
|
+
|
|
20
|
+
@property
|
|
21
|
+
def with_raw_response(self) -> RawAttachmentsClient:
|
|
22
|
+
"""
|
|
23
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
24
|
+
|
|
25
|
+
Returns
|
|
26
|
+
-------
|
|
27
|
+
RawAttachmentsClient
|
|
28
|
+
"""
|
|
29
|
+
return self._raw_client
|
|
30
|
+
|
|
31
|
+
def create(
|
|
32
|
+
self,
|
|
33
|
+
*,
|
|
34
|
+
filename: str,
|
|
35
|
+
content_type: str,
|
|
36
|
+
size_bytes: int,
|
|
37
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
38
|
+
) -> AttachmentCreateResponse:
|
|
39
|
+
"""
|
|
40
|
+
Starts an upload for a file you can reuse in messages. The response gives you an `upload_url` and `upload_headers`.
|
|
41
|
+
|
|
42
|
+
1. `PUT` the file's raw bytes to `upload_url` with exactly the `upload_headers` returned. Don't use multipart form data. The URL expires after 15 minutes.
|
|
43
|
+
2. Send the `attachment_id` in a `media` message part, or call `GET /v1/attachments/{attachment_id}` to check it.
|
|
44
|
+
|
|
45
|
+
There's no separate "complete" call. Blujay checks the bytes the first time you read the attachment or send it, so the size and type must match what you declared. Files can be up to 100 MiB.
|
|
46
|
+
|
|
47
|
+
Attachment endpoints share a limit of 60 requests per minute per API key.
|
|
48
|
+
|
|
49
|
+
Parameters
|
|
50
|
+
----------
|
|
51
|
+
filename : str
|
|
52
|
+
The file name, without any folder path.
|
|
53
|
+
|
|
54
|
+
content_type : str
|
|
55
|
+
Lowercase MIME type without parameters, for example `image/jpeg`.
|
|
56
|
+
|
|
57
|
+
size_bytes : int
|
|
58
|
+
|
|
59
|
+
request_options : typing.Optional[RequestOptions]
|
|
60
|
+
Request-specific configuration.
|
|
61
|
+
|
|
62
|
+
Returns
|
|
63
|
+
-------
|
|
64
|
+
AttachmentCreateResponse
|
|
65
|
+
The upload URL and headers for the new attachment.
|
|
66
|
+
|
|
67
|
+
Examples
|
|
68
|
+
--------
|
|
69
|
+
from blujay import Blujay
|
|
70
|
+
|
|
71
|
+
client = Blujay(
|
|
72
|
+
api_key="YOUR_API_KEY",
|
|
73
|
+
)
|
|
74
|
+
client.attachments.create(
|
|
75
|
+
filename="photo.jpg",
|
|
76
|
+
content_type="image/jpeg",
|
|
77
|
+
size_bytes=428731,
|
|
78
|
+
)
|
|
79
|
+
"""
|
|
80
|
+
_response = self._raw_client.create(
|
|
81
|
+
filename=filename, content_type=content_type, size_bytes=size_bytes, request_options=request_options
|
|
82
|
+
)
|
|
83
|
+
return _response.data
|
|
84
|
+
|
|
85
|
+
def get(
|
|
86
|
+
self, attachment_id: AttachmentId, *, request_options: typing.Optional[RequestOptions] = None
|
|
87
|
+
) -> AttachmentGetResponse:
|
|
88
|
+
"""
|
|
89
|
+
Returns an attachment's details. The first read after an upload checks the uploaded bytes. Until the upload finishes you get `409 ATTACHMENT_NOT_READY`; if the bytes don't match what you declared you get `422 ATTACHMENT_UPLOAD_INVALID`.
|
|
90
|
+
|
|
91
|
+
Parameters
|
|
92
|
+
----------
|
|
93
|
+
attachment_id : AttachmentId
|
|
94
|
+
|
|
95
|
+
request_options : typing.Optional[RequestOptions]
|
|
96
|
+
Request-specific configuration.
|
|
97
|
+
|
|
98
|
+
Returns
|
|
99
|
+
-------
|
|
100
|
+
AttachmentGetResponse
|
|
101
|
+
The attachment.
|
|
102
|
+
|
|
103
|
+
Examples
|
|
104
|
+
--------
|
|
105
|
+
from blujay import Blujay
|
|
106
|
+
|
|
107
|
+
client = Blujay(
|
|
108
|
+
api_key="YOUR_API_KEY",
|
|
109
|
+
)
|
|
110
|
+
client.attachments.get(
|
|
111
|
+
attachment_id="att_abc123",
|
|
112
|
+
)
|
|
113
|
+
"""
|
|
114
|
+
_response = self._raw_client.get(attachment_id, request_options=request_options)
|
|
115
|
+
return _response.data
|
|
116
|
+
|
|
117
|
+
def delete(self, attachment_id: AttachmentId, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
118
|
+
"""
|
|
119
|
+
Stops the attachment from being sent or downloaded again, effective immediately. Messages that already include it keep their reference to it.
|
|
120
|
+
|
|
121
|
+
Parameters
|
|
122
|
+
----------
|
|
123
|
+
attachment_id : AttachmentId
|
|
124
|
+
|
|
125
|
+
request_options : typing.Optional[RequestOptions]
|
|
126
|
+
Request-specific configuration.
|
|
127
|
+
|
|
128
|
+
Returns
|
|
129
|
+
-------
|
|
130
|
+
None
|
|
131
|
+
|
|
132
|
+
Examples
|
|
133
|
+
--------
|
|
134
|
+
from blujay import Blujay
|
|
135
|
+
|
|
136
|
+
client = Blujay(
|
|
137
|
+
api_key="YOUR_API_KEY",
|
|
138
|
+
)
|
|
139
|
+
client.attachments.delete(
|
|
140
|
+
attachment_id="att_abc123",
|
|
141
|
+
)
|
|
142
|
+
"""
|
|
143
|
+
_response = self._raw_client.delete(attachment_id, request_options=request_options)
|
|
144
|
+
return _response.data
|
|
145
|
+
|
|
146
|
+
def download(
|
|
147
|
+
self, attachment_id: AttachmentId, *, request_options: typing.Optional[RequestOptions] = None
|
|
148
|
+
) -> typing.Iterator[bytes]:
|
|
149
|
+
"""
|
|
150
|
+
Returns the attachment's file. Authenticate the same way as any other API call. Message parts link here through `download_url`.
|
|
151
|
+
|
|
152
|
+
Parameters
|
|
153
|
+
----------
|
|
154
|
+
attachment_id : AttachmentId
|
|
155
|
+
|
|
156
|
+
request_options : typing.Optional[RequestOptions]
|
|
157
|
+
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
158
|
+
|
|
159
|
+
Returns
|
|
160
|
+
-------
|
|
161
|
+
typing.Iterator[bytes]
|
|
162
|
+
The file.
|
|
163
|
+
|
|
164
|
+
Examples
|
|
165
|
+
--------
|
|
166
|
+
from blujay import Blujay
|
|
167
|
+
|
|
168
|
+
client = Blujay(
|
|
169
|
+
api_key="YOUR_API_KEY",
|
|
170
|
+
)
|
|
171
|
+
client.attachments.download(
|
|
172
|
+
attachment_id="att_abc123",
|
|
173
|
+
)
|
|
174
|
+
"""
|
|
175
|
+
with self._raw_client.download(attachment_id, request_options=request_options) as r:
|
|
176
|
+
yield from r.data
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
class AsyncAttachmentsClient:
|
|
180
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
181
|
+
self._raw_client = AsyncRawAttachmentsClient(client_wrapper=client_wrapper)
|
|
182
|
+
|
|
183
|
+
@property
|
|
184
|
+
def with_raw_response(self) -> AsyncRawAttachmentsClient:
|
|
185
|
+
"""
|
|
186
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
187
|
+
|
|
188
|
+
Returns
|
|
189
|
+
-------
|
|
190
|
+
AsyncRawAttachmentsClient
|
|
191
|
+
"""
|
|
192
|
+
return self._raw_client
|
|
193
|
+
|
|
194
|
+
async def create(
|
|
195
|
+
self,
|
|
196
|
+
*,
|
|
197
|
+
filename: str,
|
|
198
|
+
content_type: str,
|
|
199
|
+
size_bytes: int,
|
|
200
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
201
|
+
) -> AttachmentCreateResponse:
|
|
202
|
+
"""
|
|
203
|
+
Starts an upload for a file you can reuse in messages. The response gives you an `upload_url` and `upload_headers`.
|
|
204
|
+
|
|
205
|
+
1. `PUT` the file's raw bytes to `upload_url` with exactly the `upload_headers` returned. Don't use multipart form data. The URL expires after 15 minutes.
|
|
206
|
+
2. Send the `attachment_id` in a `media` message part, or call `GET /v1/attachments/{attachment_id}` to check it.
|
|
207
|
+
|
|
208
|
+
There's no separate "complete" call. Blujay checks the bytes the first time you read the attachment or send it, so the size and type must match what you declared. Files can be up to 100 MiB.
|
|
209
|
+
|
|
210
|
+
Attachment endpoints share a limit of 60 requests per minute per API key.
|
|
211
|
+
|
|
212
|
+
Parameters
|
|
213
|
+
----------
|
|
214
|
+
filename : str
|
|
215
|
+
The file name, without any folder path.
|
|
216
|
+
|
|
217
|
+
content_type : str
|
|
218
|
+
Lowercase MIME type without parameters, for example `image/jpeg`.
|
|
219
|
+
|
|
220
|
+
size_bytes : int
|
|
221
|
+
|
|
222
|
+
request_options : typing.Optional[RequestOptions]
|
|
223
|
+
Request-specific configuration.
|
|
224
|
+
|
|
225
|
+
Returns
|
|
226
|
+
-------
|
|
227
|
+
AttachmentCreateResponse
|
|
228
|
+
The upload URL and headers for the new attachment.
|
|
229
|
+
|
|
230
|
+
Examples
|
|
231
|
+
--------
|
|
232
|
+
import asyncio
|
|
233
|
+
|
|
234
|
+
from blujay import AsyncBlujay
|
|
235
|
+
|
|
236
|
+
client = AsyncBlujay(
|
|
237
|
+
api_key="YOUR_API_KEY",
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
async def main() -> None:
|
|
242
|
+
await client.attachments.create(
|
|
243
|
+
filename="photo.jpg",
|
|
244
|
+
content_type="image/jpeg",
|
|
245
|
+
size_bytes=428731,
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
asyncio.run(main())
|
|
250
|
+
"""
|
|
251
|
+
_response = await self._raw_client.create(
|
|
252
|
+
filename=filename, content_type=content_type, size_bytes=size_bytes, request_options=request_options
|
|
253
|
+
)
|
|
254
|
+
return _response.data
|
|
255
|
+
|
|
256
|
+
async def get(
|
|
257
|
+
self, attachment_id: AttachmentId, *, request_options: typing.Optional[RequestOptions] = None
|
|
258
|
+
) -> AttachmentGetResponse:
|
|
259
|
+
"""
|
|
260
|
+
Returns an attachment's details. The first read after an upload checks the uploaded bytes. Until the upload finishes you get `409 ATTACHMENT_NOT_READY`; if the bytes don't match what you declared you get `422 ATTACHMENT_UPLOAD_INVALID`.
|
|
261
|
+
|
|
262
|
+
Parameters
|
|
263
|
+
----------
|
|
264
|
+
attachment_id : AttachmentId
|
|
265
|
+
|
|
266
|
+
request_options : typing.Optional[RequestOptions]
|
|
267
|
+
Request-specific configuration.
|
|
268
|
+
|
|
269
|
+
Returns
|
|
270
|
+
-------
|
|
271
|
+
AttachmentGetResponse
|
|
272
|
+
The attachment.
|
|
273
|
+
|
|
274
|
+
Examples
|
|
275
|
+
--------
|
|
276
|
+
import asyncio
|
|
277
|
+
|
|
278
|
+
from blujay import AsyncBlujay
|
|
279
|
+
|
|
280
|
+
client = AsyncBlujay(
|
|
281
|
+
api_key="YOUR_API_KEY",
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
async def main() -> None:
|
|
286
|
+
await client.attachments.get(
|
|
287
|
+
attachment_id="att_abc123",
|
|
288
|
+
)
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
asyncio.run(main())
|
|
292
|
+
"""
|
|
293
|
+
_response = await self._raw_client.get(attachment_id, request_options=request_options)
|
|
294
|
+
return _response.data
|
|
295
|
+
|
|
296
|
+
async def delete(
|
|
297
|
+
self, attachment_id: AttachmentId, *, request_options: typing.Optional[RequestOptions] = None
|
|
298
|
+
) -> None:
|
|
299
|
+
"""
|
|
300
|
+
Stops the attachment from being sent or downloaded again, effective immediately. Messages that already include it keep their reference to it.
|
|
301
|
+
|
|
302
|
+
Parameters
|
|
303
|
+
----------
|
|
304
|
+
attachment_id : AttachmentId
|
|
305
|
+
|
|
306
|
+
request_options : typing.Optional[RequestOptions]
|
|
307
|
+
Request-specific configuration.
|
|
308
|
+
|
|
309
|
+
Returns
|
|
310
|
+
-------
|
|
311
|
+
None
|
|
312
|
+
|
|
313
|
+
Examples
|
|
314
|
+
--------
|
|
315
|
+
import asyncio
|
|
316
|
+
|
|
317
|
+
from blujay import AsyncBlujay
|
|
318
|
+
|
|
319
|
+
client = AsyncBlujay(
|
|
320
|
+
api_key="YOUR_API_KEY",
|
|
321
|
+
)
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
async def main() -> None:
|
|
325
|
+
await client.attachments.delete(
|
|
326
|
+
attachment_id="att_abc123",
|
|
327
|
+
)
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
asyncio.run(main())
|
|
331
|
+
"""
|
|
332
|
+
_response = await self._raw_client.delete(attachment_id, request_options=request_options)
|
|
333
|
+
return _response.data
|
|
334
|
+
|
|
335
|
+
async def download(
|
|
336
|
+
self, attachment_id: AttachmentId, *, request_options: typing.Optional[RequestOptions] = None
|
|
337
|
+
) -> typing.AsyncIterator[bytes]:
|
|
338
|
+
"""
|
|
339
|
+
Returns the attachment's file. Authenticate the same way as any other API call. Message parts link here through `download_url`.
|
|
340
|
+
|
|
341
|
+
Parameters
|
|
342
|
+
----------
|
|
343
|
+
attachment_id : AttachmentId
|
|
344
|
+
|
|
345
|
+
request_options : typing.Optional[RequestOptions]
|
|
346
|
+
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
347
|
+
|
|
348
|
+
Returns
|
|
349
|
+
-------
|
|
350
|
+
typing.AsyncIterator[bytes]
|
|
351
|
+
The file.
|
|
352
|
+
|
|
353
|
+
Examples
|
|
354
|
+
--------
|
|
355
|
+
import asyncio
|
|
356
|
+
|
|
357
|
+
from blujay import AsyncBlujay
|
|
358
|
+
|
|
359
|
+
client = AsyncBlujay(
|
|
360
|
+
api_key="YOUR_API_KEY",
|
|
361
|
+
)
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
async def main() -> None:
|
|
365
|
+
await client.attachments.download(
|
|
366
|
+
attachment_id="att_abc123",
|
|
367
|
+
)
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
asyncio.run(main())
|
|
371
|
+
"""
|
|
372
|
+
async with self._raw_client.download(attachment_id, request_options=request_options) as r:
|
|
373
|
+
async for _chunk in r.data:
|
|
374
|
+
yield _chunk
|