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,741 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from json.decoder import JSONDecodeError
|
|
5
|
+
|
|
6
|
+
from ...core.api_error import ApiError
|
|
7
|
+
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
+
from ...core.http_response import AsyncHttpResponse, HttpResponse
|
|
9
|
+
from ...core.jsonable_encoder import encode_path_param
|
|
10
|
+
from ...core.parse_error import ParsingError
|
|
11
|
+
from ...core.request_options import RequestOptions
|
|
12
|
+
from ...core.unchecked_base_model import construct_type
|
|
13
|
+
from ...errors.bad_gateway_error import BadGatewayError
|
|
14
|
+
from ...errors.bad_request_error import BadRequestError
|
|
15
|
+
from ...errors.conflict_error import ConflictError
|
|
16
|
+
from ...errors.forbidden_error import ForbiddenError
|
|
17
|
+
from ...errors.internal_server_error import InternalServerError
|
|
18
|
+
from ...errors.not_found_error import NotFoundError
|
|
19
|
+
from ...errors.service_unavailable_error import ServiceUnavailableError
|
|
20
|
+
from ...errors.too_many_requests_error import TooManyRequestsError
|
|
21
|
+
from ...errors.unauthorized_error import UnauthorizedError
|
|
22
|
+
from ...types.error_envelope import ErrorEnvelope
|
|
23
|
+
from ...types.message_id import MessageId
|
|
24
|
+
from ...types.reaction_emoji import ReactionEmoji
|
|
25
|
+
from ...types.reaction_type import ReactionType
|
|
26
|
+
from .types.message_reaction_add_response import MessageReactionAddResponse
|
|
27
|
+
from .types.message_reaction_remove_response import MessageReactionRemoveResponse
|
|
28
|
+
from pydantic import ValidationError
|
|
29
|
+
|
|
30
|
+
# this is used as the default value for optional parameters
|
|
31
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class RawReactionsClient:
|
|
35
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
36
|
+
self._client_wrapper = client_wrapper
|
|
37
|
+
|
|
38
|
+
def add(
|
|
39
|
+
self,
|
|
40
|
+
message_id: MessageId,
|
|
41
|
+
*,
|
|
42
|
+
type: ReactionType,
|
|
43
|
+
emoji: typing.Optional[ReactionEmoji] = OMIT,
|
|
44
|
+
part_index: typing.Optional[int] = OMIT,
|
|
45
|
+
idempotency_key: typing.Optional[str] = None,
|
|
46
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
47
|
+
) -> HttpResponse[MessageReactionAddResponse]:
|
|
48
|
+
"""
|
|
49
|
+
Adds a tapback to a message in an iMessage chat, from the Blujay phone number the chat belongs to. You can react to messages your contacts sent and to your own. The six standard reactions are `love`, `like`, `dislike`, `laugh`, `emphasize` and `question`. To react with any emoji, send `type: custom` with `emoji` set to exactly one emoji, such as `😍` or `👍🏽`. A symbol sent without its emoji style, such as `❤`, is sent and reported as iPhones send it (`❤️`). A message can carry one reaction per person on each part, so adding a different one, standard or emoji, replaces yours. Recipients on iOS 17 or earlier see an emoji reaction as the text "Reacted 😍 to …".
|
|
50
|
+
|
|
51
|
+
Stickers contacts put on your messages arrive as `sticker` reactions, but you can't send stickers (`400 VALIDATION_ERROR`).
|
|
52
|
+
|
|
53
|
+
A `202` means Blujay accepted the reaction and is sending it. Confirm it through the `reaction.added` webhook, where `reactor` is your phone number. If you already have that reaction on the message, Blujay returns `202` without sending it again. Send an `Idempotency-Key` so a retry after a lost response is safe.
|
|
54
|
+
|
|
55
|
+
iMessage only: a message sent or received as SMS or RCS returns `400 UNSUPPORTED_CHAT_OPERATION`. A reaction can't itself be reacted to (`404 NOT_FOUND`), and an unsent or failed message can't be either (`400 VALIDATION_ERROR`). A reaction notifies the other person like a message, so a chat with an opted-out contact returns `403 RECIPIENT_SUPPRESSED`, the same rule as sending a message in it.
|
|
56
|
+
|
|
57
|
+
Parameters
|
|
58
|
+
----------
|
|
59
|
+
message_id : MessageId
|
|
60
|
+
|
|
61
|
+
type : ReactionType
|
|
62
|
+
|
|
63
|
+
emoji : typing.Optional[ReactionEmoji]
|
|
64
|
+
Required with type `custom`, and not allowed with the standard types.
|
|
65
|
+
|
|
66
|
+
part_index : typing.Optional[int]
|
|
67
|
+
Which part of the message to react to, numbered the same way as `part_index` in `reaction.added`. For a text-only message, `0` is the only part.
|
|
68
|
+
|
|
69
|
+
idempotency_key : typing.Optional[str]
|
|
70
|
+
|
|
71
|
+
request_options : typing.Optional[RequestOptions]
|
|
72
|
+
Request-specific configuration.
|
|
73
|
+
|
|
74
|
+
Returns
|
|
75
|
+
-------
|
|
76
|
+
HttpResponse[MessageReactionAddResponse]
|
|
77
|
+
Blujay accepted the reaction and is sending it from the message's phone number. Confirm it through the `reaction.added` or `reaction.removed` webhook. If the reaction was already in place (or already absent), the response is the same and nothing is sent.
|
|
78
|
+
"""
|
|
79
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
80
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
81
|
+
)
|
|
82
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
83
|
+
f"v1/messages/{encode_path_param(message_id)}/reactions",
|
|
84
|
+
method="POST",
|
|
85
|
+
json={
|
|
86
|
+
"type": type,
|
|
87
|
+
"emoji": emoji,
|
|
88
|
+
"part_index": part_index,
|
|
89
|
+
},
|
|
90
|
+
headers={
|
|
91
|
+
"content-type": "application/json",
|
|
92
|
+
"Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
|
|
93
|
+
},
|
|
94
|
+
request_options=_request_options_with_retries_disabled,
|
|
95
|
+
omit=OMIT,
|
|
96
|
+
)
|
|
97
|
+
try:
|
|
98
|
+
if 200 <= _response.status_code < 300:
|
|
99
|
+
_data = typing.cast(
|
|
100
|
+
MessageReactionAddResponse,
|
|
101
|
+
construct_type(
|
|
102
|
+
type_=MessageReactionAddResponse, # type: ignore
|
|
103
|
+
object_=_response.json(),
|
|
104
|
+
),
|
|
105
|
+
)
|
|
106
|
+
return HttpResponse(response=_response, data=_data)
|
|
107
|
+
if _response.status_code == 400:
|
|
108
|
+
raise BadRequestError(
|
|
109
|
+
headers=dict(_response.headers),
|
|
110
|
+
body=typing.cast(
|
|
111
|
+
ErrorEnvelope,
|
|
112
|
+
construct_type(
|
|
113
|
+
type_=ErrorEnvelope, # type: ignore
|
|
114
|
+
object_=_response.json(),
|
|
115
|
+
),
|
|
116
|
+
),
|
|
117
|
+
)
|
|
118
|
+
if _response.status_code == 401:
|
|
119
|
+
raise UnauthorizedError(
|
|
120
|
+
headers=dict(_response.headers),
|
|
121
|
+
body=typing.cast(
|
|
122
|
+
ErrorEnvelope,
|
|
123
|
+
construct_type(
|
|
124
|
+
type_=ErrorEnvelope, # type: ignore
|
|
125
|
+
object_=_response.json(),
|
|
126
|
+
),
|
|
127
|
+
),
|
|
128
|
+
)
|
|
129
|
+
if _response.status_code == 403:
|
|
130
|
+
raise ForbiddenError(
|
|
131
|
+
headers=dict(_response.headers),
|
|
132
|
+
body=typing.cast(
|
|
133
|
+
ErrorEnvelope,
|
|
134
|
+
construct_type(
|
|
135
|
+
type_=ErrorEnvelope, # type: ignore
|
|
136
|
+
object_=_response.json(),
|
|
137
|
+
),
|
|
138
|
+
),
|
|
139
|
+
)
|
|
140
|
+
if _response.status_code == 404:
|
|
141
|
+
raise NotFoundError(
|
|
142
|
+
headers=dict(_response.headers),
|
|
143
|
+
body=typing.cast(
|
|
144
|
+
ErrorEnvelope,
|
|
145
|
+
construct_type(
|
|
146
|
+
type_=ErrorEnvelope, # type: ignore
|
|
147
|
+
object_=_response.json(),
|
|
148
|
+
),
|
|
149
|
+
),
|
|
150
|
+
)
|
|
151
|
+
if _response.status_code == 409:
|
|
152
|
+
raise ConflictError(
|
|
153
|
+
headers=dict(_response.headers),
|
|
154
|
+
body=typing.cast(
|
|
155
|
+
ErrorEnvelope,
|
|
156
|
+
construct_type(
|
|
157
|
+
type_=ErrorEnvelope, # type: ignore
|
|
158
|
+
object_=_response.json(),
|
|
159
|
+
),
|
|
160
|
+
),
|
|
161
|
+
)
|
|
162
|
+
if _response.status_code == 429:
|
|
163
|
+
raise TooManyRequestsError(
|
|
164
|
+
headers=dict(_response.headers),
|
|
165
|
+
body=typing.cast(
|
|
166
|
+
ErrorEnvelope,
|
|
167
|
+
construct_type(
|
|
168
|
+
type_=ErrorEnvelope, # type: ignore
|
|
169
|
+
object_=_response.json(),
|
|
170
|
+
),
|
|
171
|
+
),
|
|
172
|
+
)
|
|
173
|
+
if _response.status_code == 500:
|
|
174
|
+
raise InternalServerError(
|
|
175
|
+
headers=dict(_response.headers),
|
|
176
|
+
body=typing.cast(
|
|
177
|
+
ErrorEnvelope,
|
|
178
|
+
construct_type(
|
|
179
|
+
type_=ErrorEnvelope, # type: ignore
|
|
180
|
+
object_=_response.json(),
|
|
181
|
+
),
|
|
182
|
+
),
|
|
183
|
+
)
|
|
184
|
+
if _response.status_code == 502:
|
|
185
|
+
raise BadGatewayError(
|
|
186
|
+
headers=dict(_response.headers),
|
|
187
|
+
body=typing.cast(
|
|
188
|
+
ErrorEnvelope,
|
|
189
|
+
construct_type(
|
|
190
|
+
type_=ErrorEnvelope, # type: ignore
|
|
191
|
+
object_=_response.json(),
|
|
192
|
+
),
|
|
193
|
+
),
|
|
194
|
+
)
|
|
195
|
+
if _response.status_code == 503:
|
|
196
|
+
raise ServiceUnavailableError(
|
|
197
|
+
headers=dict(_response.headers),
|
|
198
|
+
body=typing.cast(
|
|
199
|
+
ErrorEnvelope,
|
|
200
|
+
construct_type(
|
|
201
|
+
type_=ErrorEnvelope, # type: ignore
|
|
202
|
+
object_=_response.json(),
|
|
203
|
+
),
|
|
204
|
+
),
|
|
205
|
+
)
|
|
206
|
+
_response_json = _response.json()
|
|
207
|
+
except JSONDecodeError:
|
|
208
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
209
|
+
except ValidationError as e:
|
|
210
|
+
raise ParsingError(
|
|
211
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
212
|
+
)
|
|
213
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
214
|
+
|
|
215
|
+
def remove(
|
|
216
|
+
self,
|
|
217
|
+
message_id: MessageId,
|
|
218
|
+
type: ReactionType,
|
|
219
|
+
*,
|
|
220
|
+
part_index: typing.Optional[int] = None,
|
|
221
|
+
emoji: typing.Optional[ReactionEmoji] = None,
|
|
222
|
+
idempotency_key: typing.Optional[str] = None,
|
|
223
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
224
|
+
) -> HttpResponse[MessageReactionRemoveResponse]:
|
|
225
|
+
"""
|
|
226
|
+
Removes a tapback your phone number put on a message, whether it was added through the API or in the Blujay app. A `202` means Blujay accepted the removal and is sending it; confirm it through the `reaction.removed` webhook.
|
|
227
|
+
|
|
228
|
+
To remove an emoji reaction, use `custom` as the type and pass the emoji: `DELETE /v1/messages/{message_id}/reactions/custom?emoji=😍` (URL-encoded). Stickers can't be removed (`400 VALIDATION_ERROR`).
|
|
229
|
+
|
|
230
|
+
If you don't have that reaction on the message, Blujay returns `202` and sends nothing. Pass `part_index` when you reacted to a part other than the first. Send an `Idempotency-Key` so a retry after a lost response is safe. The same iMessage-only rules apply as for adding a reaction.
|
|
231
|
+
|
|
232
|
+
Parameters
|
|
233
|
+
----------
|
|
234
|
+
message_id : MessageId
|
|
235
|
+
|
|
236
|
+
type : ReactionType
|
|
237
|
+
The reaction to remove.
|
|
238
|
+
|
|
239
|
+
part_index : typing.Optional[int]
|
|
240
|
+
Which part of the message the reaction is on, numbered the same way as `part_index` in `reaction.added`. Defaults to `0`.
|
|
241
|
+
|
|
242
|
+
emoji : typing.Optional[ReactionEmoji]
|
|
243
|
+
With type `custom`, the emoji to remove (exactly one emoji, URL-encoded; `❤` matches `❤️`). Required for `custom`; not allowed with the standard types.
|
|
244
|
+
|
|
245
|
+
idempotency_key : typing.Optional[str]
|
|
246
|
+
|
|
247
|
+
request_options : typing.Optional[RequestOptions]
|
|
248
|
+
Request-specific configuration.
|
|
249
|
+
|
|
250
|
+
Returns
|
|
251
|
+
-------
|
|
252
|
+
HttpResponse[MessageReactionRemoveResponse]
|
|
253
|
+
Blujay accepted the reaction and is sending it from the message's phone number. Confirm it through the `reaction.added` or `reaction.removed` webhook. If the reaction was already in place (or already absent), the response is the same and nothing is sent.
|
|
254
|
+
"""
|
|
255
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
256
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
257
|
+
)
|
|
258
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
259
|
+
f"v1/messages/{encode_path_param(message_id)}/reactions/{encode_path_param(type)}",
|
|
260
|
+
method="DELETE",
|
|
261
|
+
params={
|
|
262
|
+
"part_index": part_index,
|
|
263
|
+
"emoji": emoji,
|
|
264
|
+
},
|
|
265
|
+
headers={
|
|
266
|
+
"Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
|
|
267
|
+
},
|
|
268
|
+
request_options=_request_options_with_retries_disabled,
|
|
269
|
+
)
|
|
270
|
+
try:
|
|
271
|
+
if 200 <= _response.status_code < 300:
|
|
272
|
+
_data = typing.cast(
|
|
273
|
+
MessageReactionRemoveResponse,
|
|
274
|
+
construct_type(
|
|
275
|
+
type_=MessageReactionRemoveResponse, # type: ignore
|
|
276
|
+
object_=_response.json(),
|
|
277
|
+
),
|
|
278
|
+
)
|
|
279
|
+
return HttpResponse(response=_response, data=_data)
|
|
280
|
+
if _response.status_code == 400:
|
|
281
|
+
raise BadRequestError(
|
|
282
|
+
headers=dict(_response.headers),
|
|
283
|
+
body=typing.cast(
|
|
284
|
+
ErrorEnvelope,
|
|
285
|
+
construct_type(
|
|
286
|
+
type_=ErrorEnvelope, # type: ignore
|
|
287
|
+
object_=_response.json(),
|
|
288
|
+
),
|
|
289
|
+
),
|
|
290
|
+
)
|
|
291
|
+
if _response.status_code == 401:
|
|
292
|
+
raise UnauthorizedError(
|
|
293
|
+
headers=dict(_response.headers),
|
|
294
|
+
body=typing.cast(
|
|
295
|
+
ErrorEnvelope,
|
|
296
|
+
construct_type(
|
|
297
|
+
type_=ErrorEnvelope, # type: ignore
|
|
298
|
+
object_=_response.json(),
|
|
299
|
+
),
|
|
300
|
+
),
|
|
301
|
+
)
|
|
302
|
+
if _response.status_code == 403:
|
|
303
|
+
raise ForbiddenError(
|
|
304
|
+
headers=dict(_response.headers),
|
|
305
|
+
body=typing.cast(
|
|
306
|
+
ErrorEnvelope,
|
|
307
|
+
construct_type(
|
|
308
|
+
type_=ErrorEnvelope, # type: ignore
|
|
309
|
+
object_=_response.json(),
|
|
310
|
+
),
|
|
311
|
+
),
|
|
312
|
+
)
|
|
313
|
+
if _response.status_code == 404:
|
|
314
|
+
raise NotFoundError(
|
|
315
|
+
headers=dict(_response.headers),
|
|
316
|
+
body=typing.cast(
|
|
317
|
+
ErrorEnvelope,
|
|
318
|
+
construct_type(
|
|
319
|
+
type_=ErrorEnvelope, # type: ignore
|
|
320
|
+
object_=_response.json(),
|
|
321
|
+
),
|
|
322
|
+
),
|
|
323
|
+
)
|
|
324
|
+
if _response.status_code == 409:
|
|
325
|
+
raise ConflictError(
|
|
326
|
+
headers=dict(_response.headers),
|
|
327
|
+
body=typing.cast(
|
|
328
|
+
ErrorEnvelope,
|
|
329
|
+
construct_type(
|
|
330
|
+
type_=ErrorEnvelope, # type: ignore
|
|
331
|
+
object_=_response.json(),
|
|
332
|
+
),
|
|
333
|
+
),
|
|
334
|
+
)
|
|
335
|
+
if _response.status_code == 429:
|
|
336
|
+
raise TooManyRequestsError(
|
|
337
|
+
headers=dict(_response.headers),
|
|
338
|
+
body=typing.cast(
|
|
339
|
+
ErrorEnvelope,
|
|
340
|
+
construct_type(
|
|
341
|
+
type_=ErrorEnvelope, # type: ignore
|
|
342
|
+
object_=_response.json(),
|
|
343
|
+
),
|
|
344
|
+
),
|
|
345
|
+
)
|
|
346
|
+
if _response.status_code == 500:
|
|
347
|
+
raise InternalServerError(
|
|
348
|
+
headers=dict(_response.headers),
|
|
349
|
+
body=typing.cast(
|
|
350
|
+
ErrorEnvelope,
|
|
351
|
+
construct_type(
|
|
352
|
+
type_=ErrorEnvelope, # type: ignore
|
|
353
|
+
object_=_response.json(),
|
|
354
|
+
),
|
|
355
|
+
),
|
|
356
|
+
)
|
|
357
|
+
if _response.status_code == 502:
|
|
358
|
+
raise BadGatewayError(
|
|
359
|
+
headers=dict(_response.headers),
|
|
360
|
+
body=typing.cast(
|
|
361
|
+
ErrorEnvelope,
|
|
362
|
+
construct_type(
|
|
363
|
+
type_=ErrorEnvelope, # type: ignore
|
|
364
|
+
object_=_response.json(),
|
|
365
|
+
),
|
|
366
|
+
),
|
|
367
|
+
)
|
|
368
|
+
if _response.status_code == 503:
|
|
369
|
+
raise ServiceUnavailableError(
|
|
370
|
+
headers=dict(_response.headers),
|
|
371
|
+
body=typing.cast(
|
|
372
|
+
ErrorEnvelope,
|
|
373
|
+
construct_type(
|
|
374
|
+
type_=ErrorEnvelope, # type: ignore
|
|
375
|
+
object_=_response.json(),
|
|
376
|
+
),
|
|
377
|
+
),
|
|
378
|
+
)
|
|
379
|
+
_response_json = _response.json()
|
|
380
|
+
except JSONDecodeError:
|
|
381
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
382
|
+
except ValidationError as e:
|
|
383
|
+
raise ParsingError(
|
|
384
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
385
|
+
)
|
|
386
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
class AsyncRawReactionsClient:
|
|
390
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
391
|
+
self._client_wrapper = client_wrapper
|
|
392
|
+
|
|
393
|
+
async def add(
|
|
394
|
+
self,
|
|
395
|
+
message_id: MessageId,
|
|
396
|
+
*,
|
|
397
|
+
type: ReactionType,
|
|
398
|
+
emoji: typing.Optional[ReactionEmoji] = OMIT,
|
|
399
|
+
part_index: typing.Optional[int] = OMIT,
|
|
400
|
+
idempotency_key: typing.Optional[str] = None,
|
|
401
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
402
|
+
) -> AsyncHttpResponse[MessageReactionAddResponse]:
|
|
403
|
+
"""
|
|
404
|
+
Adds a tapback to a message in an iMessage chat, from the Blujay phone number the chat belongs to. You can react to messages your contacts sent and to your own. The six standard reactions are `love`, `like`, `dislike`, `laugh`, `emphasize` and `question`. To react with any emoji, send `type: custom` with `emoji` set to exactly one emoji, such as `😍` or `👍🏽`. A symbol sent without its emoji style, such as `❤`, is sent and reported as iPhones send it (`❤️`). A message can carry one reaction per person on each part, so adding a different one, standard or emoji, replaces yours. Recipients on iOS 17 or earlier see an emoji reaction as the text "Reacted 😍 to …".
|
|
405
|
+
|
|
406
|
+
Stickers contacts put on your messages arrive as `sticker` reactions, but you can't send stickers (`400 VALIDATION_ERROR`).
|
|
407
|
+
|
|
408
|
+
A `202` means Blujay accepted the reaction and is sending it. Confirm it through the `reaction.added` webhook, where `reactor` is your phone number. If you already have that reaction on the message, Blujay returns `202` without sending it again. Send an `Idempotency-Key` so a retry after a lost response is safe.
|
|
409
|
+
|
|
410
|
+
iMessage only: a message sent or received as SMS or RCS returns `400 UNSUPPORTED_CHAT_OPERATION`. A reaction can't itself be reacted to (`404 NOT_FOUND`), and an unsent or failed message can't be either (`400 VALIDATION_ERROR`). A reaction notifies the other person like a message, so a chat with an opted-out contact returns `403 RECIPIENT_SUPPRESSED`, the same rule as sending a message in it.
|
|
411
|
+
|
|
412
|
+
Parameters
|
|
413
|
+
----------
|
|
414
|
+
message_id : MessageId
|
|
415
|
+
|
|
416
|
+
type : ReactionType
|
|
417
|
+
|
|
418
|
+
emoji : typing.Optional[ReactionEmoji]
|
|
419
|
+
Required with type `custom`, and not allowed with the standard types.
|
|
420
|
+
|
|
421
|
+
part_index : typing.Optional[int]
|
|
422
|
+
Which part of the message to react to, numbered the same way as `part_index` in `reaction.added`. For a text-only message, `0` is the only part.
|
|
423
|
+
|
|
424
|
+
idempotency_key : typing.Optional[str]
|
|
425
|
+
|
|
426
|
+
request_options : typing.Optional[RequestOptions]
|
|
427
|
+
Request-specific configuration.
|
|
428
|
+
|
|
429
|
+
Returns
|
|
430
|
+
-------
|
|
431
|
+
AsyncHttpResponse[MessageReactionAddResponse]
|
|
432
|
+
Blujay accepted the reaction and is sending it from the message's phone number. Confirm it through the `reaction.added` or `reaction.removed` webhook. If the reaction was already in place (or already absent), the response is the same and nothing is sent.
|
|
433
|
+
"""
|
|
434
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
435
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
436
|
+
)
|
|
437
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
438
|
+
f"v1/messages/{encode_path_param(message_id)}/reactions",
|
|
439
|
+
method="POST",
|
|
440
|
+
json={
|
|
441
|
+
"type": type,
|
|
442
|
+
"emoji": emoji,
|
|
443
|
+
"part_index": part_index,
|
|
444
|
+
},
|
|
445
|
+
headers={
|
|
446
|
+
"content-type": "application/json",
|
|
447
|
+
"Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
|
|
448
|
+
},
|
|
449
|
+
request_options=_request_options_with_retries_disabled,
|
|
450
|
+
omit=OMIT,
|
|
451
|
+
)
|
|
452
|
+
try:
|
|
453
|
+
if 200 <= _response.status_code < 300:
|
|
454
|
+
_data = typing.cast(
|
|
455
|
+
MessageReactionAddResponse,
|
|
456
|
+
construct_type(
|
|
457
|
+
type_=MessageReactionAddResponse, # type: ignore
|
|
458
|
+
object_=_response.json(),
|
|
459
|
+
),
|
|
460
|
+
)
|
|
461
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
462
|
+
if _response.status_code == 400:
|
|
463
|
+
raise BadRequestError(
|
|
464
|
+
headers=dict(_response.headers),
|
|
465
|
+
body=typing.cast(
|
|
466
|
+
ErrorEnvelope,
|
|
467
|
+
construct_type(
|
|
468
|
+
type_=ErrorEnvelope, # type: ignore
|
|
469
|
+
object_=_response.json(),
|
|
470
|
+
),
|
|
471
|
+
),
|
|
472
|
+
)
|
|
473
|
+
if _response.status_code == 401:
|
|
474
|
+
raise UnauthorizedError(
|
|
475
|
+
headers=dict(_response.headers),
|
|
476
|
+
body=typing.cast(
|
|
477
|
+
ErrorEnvelope,
|
|
478
|
+
construct_type(
|
|
479
|
+
type_=ErrorEnvelope, # type: ignore
|
|
480
|
+
object_=_response.json(),
|
|
481
|
+
),
|
|
482
|
+
),
|
|
483
|
+
)
|
|
484
|
+
if _response.status_code == 403:
|
|
485
|
+
raise ForbiddenError(
|
|
486
|
+
headers=dict(_response.headers),
|
|
487
|
+
body=typing.cast(
|
|
488
|
+
ErrorEnvelope,
|
|
489
|
+
construct_type(
|
|
490
|
+
type_=ErrorEnvelope, # type: ignore
|
|
491
|
+
object_=_response.json(),
|
|
492
|
+
),
|
|
493
|
+
),
|
|
494
|
+
)
|
|
495
|
+
if _response.status_code == 404:
|
|
496
|
+
raise NotFoundError(
|
|
497
|
+
headers=dict(_response.headers),
|
|
498
|
+
body=typing.cast(
|
|
499
|
+
ErrorEnvelope,
|
|
500
|
+
construct_type(
|
|
501
|
+
type_=ErrorEnvelope, # type: ignore
|
|
502
|
+
object_=_response.json(),
|
|
503
|
+
),
|
|
504
|
+
),
|
|
505
|
+
)
|
|
506
|
+
if _response.status_code == 409:
|
|
507
|
+
raise ConflictError(
|
|
508
|
+
headers=dict(_response.headers),
|
|
509
|
+
body=typing.cast(
|
|
510
|
+
ErrorEnvelope,
|
|
511
|
+
construct_type(
|
|
512
|
+
type_=ErrorEnvelope, # type: ignore
|
|
513
|
+
object_=_response.json(),
|
|
514
|
+
),
|
|
515
|
+
),
|
|
516
|
+
)
|
|
517
|
+
if _response.status_code == 429:
|
|
518
|
+
raise TooManyRequestsError(
|
|
519
|
+
headers=dict(_response.headers),
|
|
520
|
+
body=typing.cast(
|
|
521
|
+
ErrorEnvelope,
|
|
522
|
+
construct_type(
|
|
523
|
+
type_=ErrorEnvelope, # type: ignore
|
|
524
|
+
object_=_response.json(),
|
|
525
|
+
),
|
|
526
|
+
),
|
|
527
|
+
)
|
|
528
|
+
if _response.status_code == 500:
|
|
529
|
+
raise InternalServerError(
|
|
530
|
+
headers=dict(_response.headers),
|
|
531
|
+
body=typing.cast(
|
|
532
|
+
ErrorEnvelope,
|
|
533
|
+
construct_type(
|
|
534
|
+
type_=ErrorEnvelope, # type: ignore
|
|
535
|
+
object_=_response.json(),
|
|
536
|
+
),
|
|
537
|
+
),
|
|
538
|
+
)
|
|
539
|
+
if _response.status_code == 502:
|
|
540
|
+
raise BadGatewayError(
|
|
541
|
+
headers=dict(_response.headers),
|
|
542
|
+
body=typing.cast(
|
|
543
|
+
ErrorEnvelope,
|
|
544
|
+
construct_type(
|
|
545
|
+
type_=ErrorEnvelope, # type: ignore
|
|
546
|
+
object_=_response.json(),
|
|
547
|
+
),
|
|
548
|
+
),
|
|
549
|
+
)
|
|
550
|
+
if _response.status_code == 503:
|
|
551
|
+
raise ServiceUnavailableError(
|
|
552
|
+
headers=dict(_response.headers),
|
|
553
|
+
body=typing.cast(
|
|
554
|
+
ErrorEnvelope,
|
|
555
|
+
construct_type(
|
|
556
|
+
type_=ErrorEnvelope, # type: ignore
|
|
557
|
+
object_=_response.json(),
|
|
558
|
+
),
|
|
559
|
+
),
|
|
560
|
+
)
|
|
561
|
+
_response_json = _response.json()
|
|
562
|
+
except JSONDecodeError:
|
|
563
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
564
|
+
except ValidationError as e:
|
|
565
|
+
raise ParsingError(
|
|
566
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
567
|
+
)
|
|
568
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
569
|
+
|
|
570
|
+
async def remove(
|
|
571
|
+
self,
|
|
572
|
+
message_id: MessageId,
|
|
573
|
+
type: ReactionType,
|
|
574
|
+
*,
|
|
575
|
+
part_index: typing.Optional[int] = None,
|
|
576
|
+
emoji: typing.Optional[ReactionEmoji] = None,
|
|
577
|
+
idempotency_key: typing.Optional[str] = None,
|
|
578
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
579
|
+
) -> AsyncHttpResponse[MessageReactionRemoveResponse]:
|
|
580
|
+
"""
|
|
581
|
+
Removes a tapback your phone number put on a message, whether it was added through the API or in the Blujay app. A `202` means Blujay accepted the removal and is sending it; confirm it through the `reaction.removed` webhook.
|
|
582
|
+
|
|
583
|
+
To remove an emoji reaction, use `custom` as the type and pass the emoji: `DELETE /v1/messages/{message_id}/reactions/custom?emoji=😍` (URL-encoded). Stickers can't be removed (`400 VALIDATION_ERROR`).
|
|
584
|
+
|
|
585
|
+
If you don't have that reaction on the message, Blujay returns `202` and sends nothing. Pass `part_index` when you reacted to a part other than the first. Send an `Idempotency-Key` so a retry after a lost response is safe. The same iMessage-only rules apply as for adding a reaction.
|
|
586
|
+
|
|
587
|
+
Parameters
|
|
588
|
+
----------
|
|
589
|
+
message_id : MessageId
|
|
590
|
+
|
|
591
|
+
type : ReactionType
|
|
592
|
+
The reaction to remove.
|
|
593
|
+
|
|
594
|
+
part_index : typing.Optional[int]
|
|
595
|
+
Which part of the message the reaction is on, numbered the same way as `part_index` in `reaction.added`. Defaults to `0`.
|
|
596
|
+
|
|
597
|
+
emoji : typing.Optional[ReactionEmoji]
|
|
598
|
+
With type `custom`, the emoji to remove (exactly one emoji, URL-encoded; `❤` matches `❤️`). Required for `custom`; not allowed with the standard types.
|
|
599
|
+
|
|
600
|
+
idempotency_key : typing.Optional[str]
|
|
601
|
+
|
|
602
|
+
request_options : typing.Optional[RequestOptions]
|
|
603
|
+
Request-specific configuration.
|
|
604
|
+
|
|
605
|
+
Returns
|
|
606
|
+
-------
|
|
607
|
+
AsyncHttpResponse[MessageReactionRemoveResponse]
|
|
608
|
+
Blujay accepted the reaction and is sending it from the message's phone number. Confirm it through the `reaction.added` or `reaction.removed` webhook. If the reaction was already in place (or already absent), the response is the same and nothing is sent.
|
|
609
|
+
"""
|
|
610
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
611
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
612
|
+
)
|
|
613
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
614
|
+
f"v1/messages/{encode_path_param(message_id)}/reactions/{encode_path_param(type)}",
|
|
615
|
+
method="DELETE",
|
|
616
|
+
params={
|
|
617
|
+
"part_index": part_index,
|
|
618
|
+
"emoji": emoji,
|
|
619
|
+
},
|
|
620
|
+
headers={
|
|
621
|
+
"Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
|
|
622
|
+
},
|
|
623
|
+
request_options=_request_options_with_retries_disabled,
|
|
624
|
+
)
|
|
625
|
+
try:
|
|
626
|
+
if 200 <= _response.status_code < 300:
|
|
627
|
+
_data = typing.cast(
|
|
628
|
+
MessageReactionRemoveResponse,
|
|
629
|
+
construct_type(
|
|
630
|
+
type_=MessageReactionRemoveResponse, # type: ignore
|
|
631
|
+
object_=_response.json(),
|
|
632
|
+
),
|
|
633
|
+
)
|
|
634
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
635
|
+
if _response.status_code == 400:
|
|
636
|
+
raise BadRequestError(
|
|
637
|
+
headers=dict(_response.headers),
|
|
638
|
+
body=typing.cast(
|
|
639
|
+
ErrorEnvelope,
|
|
640
|
+
construct_type(
|
|
641
|
+
type_=ErrorEnvelope, # type: ignore
|
|
642
|
+
object_=_response.json(),
|
|
643
|
+
),
|
|
644
|
+
),
|
|
645
|
+
)
|
|
646
|
+
if _response.status_code == 401:
|
|
647
|
+
raise UnauthorizedError(
|
|
648
|
+
headers=dict(_response.headers),
|
|
649
|
+
body=typing.cast(
|
|
650
|
+
ErrorEnvelope,
|
|
651
|
+
construct_type(
|
|
652
|
+
type_=ErrorEnvelope, # type: ignore
|
|
653
|
+
object_=_response.json(),
|
|
654
|
+
),
|
|
655
|
+
),
|
|
656
|
+
)
|
|
657
|
+
if _response.status_code == 403:
|
|
658
|
+
raise ForbiddenError(
|
|
659
|
+
headers=dict(_response.headers),
|
|
660
|
+
body=typing.cast(
|
|
661
|
+
ErrorEnvelope,
|
|
662
|
+
construct_type(
|
|
663
|
+
type_=ErrorEnvelope, # type: ignore
|
|
664
|
+
object_=_response.json(),
|
|
665
|
+
),
|
|
666
|
+
),
|
|
667
|
+
)
|
|
668
|
+
if _response.status_code == 404:
|
|
669
|
+
raise NotFoundError(
|
|
670
|
+
headers=dict(_response.headers),
|
|
671
|
+
body=typing.cast(
|
|
672
|
+
ErrorEnvelope,
|
|
673
|
+
construct_type(
|
|
674
|
+
type_=ErrorEnvelope, # type: ignore
|
|
675
|
+
object_=_response.json(),
|
|
676
|
+
),
|
|
677
|
+
),
|
|
678
|
+
)
|
|
679
|
+
if _response.status_code == 409:
|
|
680
|
+
raise ConflictError(
|
|
681
|
+
headers=dict(_response.headers),
|
|
682
|
+
body=typing.cast(
|
|
683
|
+
ErrorEnvelope,
|
|
684
|
+
construct_type(
|
|
685
|
+
type_=ErrorEnvelope, # type: ignore
|
|
686
|
+
object_=_response.json(),
|
|
687
|
+
),
|
|
688
|
+
),
|
|
689
|
+
)
|
|
690
|
+
if _response.status_code == 429:
|
|
691
|
+
raise TooManyRequestsError(
|
|
692
|
+
headers=dict(_response.headers),
|
|
693
|
+
body=typing.cast(
|
|
694
|
+
ErrorEnvelope,
|
|
695
|
+
construct_type(
|
|
696
|
+
type_=ErrorEnvelope, # type: ignore
|
|
697
|
+
object_=_response.json(),
|
|
698
|
+
),
|
|
699
|
+
),
|
|
700
|
+
)
|
|
701
|
+
if _response.status_code == 500:
|
|
702
|
+
raise InternalServerError(
|
|
703
|
+
headers=dict(_response.headers),
|
|
704
|
+
body=typing.cast(
|
|
705
|
+
ErrorEnvelope,
|
|
706
|
+
construct_type(
|
|
707
|
+
type_=ErrorEnvelope, # type: ignore
|
|
708
|
+
object_=_response.json(),
|
|
709
|
+
),
|
|
710
|
+
),
|
|
711
|
+
)
|
|
712
|
+
if _response.status_code == 502:
|
|
713
|
+
raise BadGatewayError(
|
|
714
|
+
headers=dict(_response.headers),
|
|
715
|
+
body=typing.cast(
|
|
716
|
+
ErrorEnvelope,
|
|
717
|
+
construct_type(
|
|
718
|
+
type_=ErrorEnvelope, # type: ignore
|
|
719
|
+
object_=_response.json(),
|
|
720
|
+
),
|
|
721
|
+
),
|
|
722
|
+
)
|
|
723
|
+
if _response.status_code == 503:
|
|
724
|
+
raise ServiceUnavailableError(
|
|
725
|
+
headers=dict(_response.headers),
|
|
726
|
+
body=typing.cast(
|
|
727
|
+
ErrorEnvelope,
|
|
728
|
+
construct_type(
|
|
729
|
+
type_=ErrorEnvelope, # type: ignore
|
|
730
|
+
object_=_response.json(),
|
|
731
|
+
),
|
|
732
|
+
),
|
|
733
|
+
)
|
|
734
|
+
_response_json = _response.json()
|
|
735
|
+
except JSONDecodeError:
|
|
736
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
737
|
+
except ValidationError as e:
|
|
738
|
+
raise ParsingError(
|
|
739
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
740
|
+
)
|
|
741
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|