rcs 1.0.17 → 2.0.0.pre.rc.1
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.
- checksums.yaml +4 -4
- data/lib/environment.rb +1 -1
- data/lib/rcs/brands/client.rb +631 -0
- data/lib/rcs/brands/types/autofill_brand_schema_options.rb +61 -0
- data/lib/rcs/brands/types/brand_contact.rb +84 -0
- data/lib/rcs/campaigns/client.rb +44 -0
- data/lib/rcs/campaigns/dlc/client.rb +480 -0
- data/lib/rcs/campaigns/dlc/types/upsert_dlc_schema_keywords.rb +99 -0
- data/lib/rcs/campaigns/dlc/types/upsert_dlc_schema_keywords_help.rb +74 -0
- data/lib/rcs/campaigns/dlc/types/upsert_dlc_schema_keywords_opt_in.rb +74 -0
- data/lib/rcs/campaigns/dlc/types/upsert_dlc_schema_keywords_opt_out.rb +74 -0
- data/lib/rcs/campaigns/dlc/types/upsert_dlc_schema_links.rb +74 -0
- data/lib/rcs/campaigns/dlc/types/upsert_dlc_schema_options.rb +110 -0
- data/lib/rcs/campaigns/dlc/types/upsert_dlc_schema_use_case.rb +76 -0
- data/lib/rcs/campaigns/rcs/client.rb +457 -0
- data/lib/rcs/campaigns/rcs/types/rcs_autofill_response.rb +155 -0
- data/lib/rcs/campaigns/rcs/types/upsert_rcs_schema_agent.rb +140 -0
- data/lib/rcs/campaigns/rcs/types/upsert_rcs_schema_agent_emails_item.rb +73 -0
- data/lib/rcs/campaigns/rcs/types/upsert_rcs_schema_agent_phones_item.rb +73 -0
- data/lib/rcs/campaigns/rcs/types/upsert_rcs_schema_agent_websites_item.rb +73 -0
- data/lib/rcs/campaigns/rcs/types/upsert_rcs_schema_links.rb +74 -0
- data/lib/rcs/campaigns/rcs/types/upsert_rcs_schema_opt_in.rb +75 -0
- data/lib/rcs/campaigns/rcs/types/upsert_rcs_schema_opt_out.rb +76 -0
- data/lib/rcs/campaigns/rcs/types/upsert_rcs_schema_use_case.rb +75 -0
- data/lib/rcs/campaigns/toll_free/client.rb +429 -0
- data/lib/rcs/campaigns/toll_free/types/toll_free_autofill_response.rb +130 -0
- data/lib/rcs/campaigns/toll_free/types/upsert_toll_free_schema_opt_in.rb +86 -0
- data/lib/rcs/campaigns/toll_free/types/upsert_toll_free_schema_use_case.rb +75 -0
- data/lib/rcs/contacts/client.rb +275 -0
- data/lib/rcs/conversations/client.rb +273 -0
- data/lib/rcs/message/client.rb +30 -0
- data/lib/rcs/message/sms/client.rb +96 -0
- data/lib/rcs/messages/client.rb +185 -0
- data/lib/rcs/messages/mms/client.rb +98 -0
- data/lib/rcs/messages/rcs/client.rb +94 -0
- data/lib/rcs/messages/send/client.rb +318 -0
- data/lib/rcs/messages/send/types/send_mms_response.rb +60 -0
- data/lib/rcs/messages/send/types/send_mms_schema_options.rb +108 -0
- data/lib/rcs/messages/send/types/send_rcs_response.rb +60 -0
- data/lib/rcs/messages/send/types/send_sms_response.rb +60 -0
- data/lib/rcs/messages/send/types/send_sms_schema_options.rb +81 -0
- data/lib/rcs/messages/types/message_reaction_schema_options.rb +71 -0
- data/lib/rcs/phone_numbers/campaign/client.rb +179 -0
- data/lib/rcs/phone_numbers/client.rb +345 -0
- data/lib/rcs/phone_numbers/types/phone_details_schema_level.rb +16 -0
- data/lib/rcs/phone_numbers/types/phone_details_schema_options.rb +93 -0
- data/lib/rcs/phone_numbers/types/phone_details_schema_options_enhanced_contact_info.rb +64 -0
- data/lib/rcs/phone_numbers/types/phone_numbers_get_response.rb +58 -0
- data/lib/rcs/phone_numbers/types/search_schema_location.rb +96 -0
- data/lib/rcs/phone_numbers/types/search_schema_number.rb +81 -0
- data/lib/rcs/phone_numbers/types/search_schema_options.rb +62 -0
- data/lib/rcs/phone_numbers/webhook/client.rb +191 -0
- data/lib/rcs/status/client.rb +30 -0
- data/lib/rcs/status/get/client.rb +367 -0
- data/lib/rcs/tools/client.rb +32 -199
- data/lib/rcs/tools/contact_card/client.rb +285 -0
- data/lib/rcs/tools/contact_card/types/get_v_card_schema_options.rb +67 -0
- data/lib/rcs/tools/file/client.rb +138 -0
- data/lib/rcs/tools/file/types/file_upload_schema_options.rb +70 -0
- data/lib/rcs/tools/file/types/file_upload_schema_options_download.rb +66 -0
- data/lib/rcs/tools/url/client.rb +245 -0
- data/lib/rcs/types/advanced_phone_information.rb +147 -0
- data/lib/rcs/types/advanced_phone_information_carrier.rb +90 -0
- data/lib/rcs/types/advanced_phone_information_contact.rb +146 -0
- data/lib/rcs/types/advanced_phone_information_location.rb +142 -0
- data/lib/rcs/types/advanced_phone_information_location_coordinates.rb +73 -0
- data/lib/rcs/types/advanced_phone_information_location_country.rb +77 -0
- data/lib/rcs/types/advanced_phone_information_type.rb +97 -0
- data/lib/rcs/types/advanced_phone_information_type_recommendation.rb +15 -0
- data/lib/rcs/types/agent.rb +68 -0
- data/lib/rcs/types/attach_webhook_params.rb +60 -0
- data/lib/rcs/types/attach_webhook_response_webhook.rb +86 -0
- data/lib/rcs/types/attach_webhook_schema_name.rb +88 -0
- data/lib/rcs/types/attach_webhook_schema_webhook_id.rb +77 -0
- data/lib/rcs/types/attached_phone_number_result.rb +75 -0
- data/lib/rcs/types/autofill_campaign_params.rb +69 -0
- data/lib/rcs/types/autofill_dlc_campaign_response.rb +169 -0
- data/lib/rcs/types/autofill_dlc_response_keywords.rb +95 -0
- data/lib/rcs/types/autofill_dlc_response_keywords_help.rb +70 -0
- data/lib/rcs/{send/types/send_sms_response.rb → types/autofill_dlc_response_keywords_opt_in.rb} +18 -17
- data/lib/rcs/types/autofill_dlc_response_keywords_opt_out.rb +70 -0
- data/lib/rcs/types/autofill_dlc_response_links.rb +70 -0
- data/lib/rcs/types/autofill_dlc_response_options.rb +106 -0
- data/lib/rcs/types/autofill_dlc_response_use_case.rb +72 -0
- data/lib/rcs/types/bad_request_error_body.rb +44 -45
- data/lib/rcs/types/basic_phone_information.rb +127 -0
- data/lib/rcs/{company/types/company_register_response_brand.rb → types/basic_phone_information_contact.rb} +12 -21
- data/lib/rcs/types/basic_phone_information_location.rb +74 -0
- data/lib/rcs/types/basic_phone_information_location_country.rb +75 -0
- data/lib/rcs/types/brand_status.rb +92 -0
- data/lib/rcs/types/brand_status_enum.rb +21 -0
- data/lib/rcs/types/buy_response_capabilities.rb +77 -0
- data/lib/rcs/types/campaign_enum.rb +15 -0
- data/lib/rcs/types/campaign_query.rb +69 -0
- data/lib/rcs/{company/types/company_register_request_company_id.rb → types/campaign_submission_result.rb} +15 -16
- data/lib/rcs/types/campaign_validation_response_errors_item.rb +76 -0
- data/lib/rcs/types/campaign_validation_result.rb +71 -0
- data/lib/rcs/types/click_action.rb +73 -0
- data/lib/rcs/types/click_action_data.rb +56 -0
- data/lib/rcs/types/click_action_data_metadata.rb +69 -0
- data/lib/rcs/types/company_sector_enum.rb +26 -0
- data/lib/rcs/types/company_type_enum.rb +14 -0
- data/lib/rcs/types/configured_webhook.rb +85 -0
- data/lib/rcs/types/contact.rb +105 -0
- data/lib/rcs/types/contact_id.rb +57 -0
- data/lib/rcs/types/conversation.rb +146 -0
- data/lib/rcs/types/conversation_contact.rb +68 -0
- data/lib/rcs/types/conversation_list.rb +79 -0
- data/lib/rcs/types/conversation_sender.rb +60 -0
- data/lib/rcs/types/create_url_options.rb +61 -0
- data/lib/rcs/types/detached_phone_number_result.rb +75 -0
- data/lib/rcs/types/detached_webhook_info.rb +74 -0
- data/lib/rcs/types/detailed_phone_number_enum.rb +25 -0
- data/lib/rcs/types/dlc_assignment_status_enum.rb +19 -0
- data/lib/rcs/types/dlc_campaign_status.rb +107 -0
- data/lib/rcs/types/dlc_campaign_use_case_enum.rb +35 -0
- data/lib/rcs/types/dlc_campaign_with_extended_brand_and_status.rb +194 -0
- data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords.rb +94 -0
- data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords_help.rb +72 -0
- data/lib/rcs/{send/types/send_mms_response.rb → types/dlc_with_extended_brand_and_status_keywords_opt_in.rb} +20 -17
- data/lib/rcs/{send/types/send_rcs_response.rb → types/dlc_with_extended_brand_and_status_keywords_opt_out.rb} +20 -17
- data/lib/rcs/types/dlc_with_extended_brand_and_status_links.rb +70 -0
- data/lib/rcs/types/dlc_with_extended_brand_and_status_options.rb +106 -0
- data/lib/rcs/types/dlc_with_extended_brand_and_status_use_case.rb +72 -0
- data/lib/rcs/types/enhanced_contact.rb +9 -0
- data/lib/rcs/types/enhanced_contact_item.rb +104 -0
- data/lib/rcs/types/error.rb +61 -0
- data/lib/rcs/types/extended_brand.rb +194 -0
- data/lib/rcs/types/extended_brand_with_vetting.rb +226 -0
- data/lib/rcs/types/extended_rcs_campaign.rb +173 -0
- data/lib/rcs/{company/types/company_register_request.rb → types/get_conversation_params.rb} +13 -12
- data/lib/rcs/types/get_conversation_request_id.rb +58 -0
- data/lib/rcs/types/get_conversation_request_recipient.rb +72 -0
- data/lib/rcs/types/get_dlc_campaign_status_response_updates.rb +96 -0
- data/lib/rcs/types/get_toll_free_campaign_status_response_updates.rb +92 -0
- data/lib/rcs/types/inbound_button.rb +56 -0
- data/lib/rcs/types/link_click_event.rb +465 -0
- data/lib/rcs/{company/types/company_update_response.rb → types/location_share_action.rb} +19 -19
- data/lib/rcs/types/location_share_action_data.rb +89 -0
- data/lib/rcs/types/message.rb +174 -0
- data/lib/rcs/types/message_content.rb +85 -0
- data/lib/rcs/types/message_method_enum.rb +12 -0
- data/lib/rcs/types/message_protocol_enum.rb +12 -0
- data/lib/rcs/types/message_schedule.rb +94 -0
- data/lib/rcs/types/message_status_enum.rb +16 -0
- data/lib/rcs/types/message_volume_enum.rb +20 -0
- data/lib/rcs/types/messaging_profile_enum.rb +11 -0
- data/lib/rcs/types/mms_content.rb +74 -0
- data/lib/rcs/types/mms_validation_response_segments.rb +85 -0
- data/lib/rcs/types/mms_validation_response_segments_value_item.rb +75 -0
- data/lib/rcs/types/mms_validation_result.rb +82 -0
- data/lib/rcs/types/nullable_contact.rb +84 -0
- data/lib/rcs/types/number_format.rb +79 -0
- data/lib/rcs/types/opt_in_method_enum.rb +13 -0
- data/lib/rcs/types/optional_brand_info.rb +145 -0
- data/lib/rcs/types/optional_contact.rb +83 -0
- data/lib/rcs/types/optional_contacts.rb +84 -0
- data/lib/rcs/types/phone.rb +101 -0
- data/lib/rcs/types/phone_capabilities.rb +75 -0
- data/lib/rcs/types/phone_enum.rb +13 -0
- data/lib/rcs/types/phone_feature_enum.rb +18 -0
- data/lib/rcs/types/phone_number_campaign_attach_failed_item.rb +67 -0
- data/lib/rcs/types/phone_number_campaign_attach_phone_numbers_item.rb +75 -0
- data/lib/rcs/types/phone_number_campaign_attach_phone_numbers_item_campaign.rb +78 -0
- data/lib/rcs/types/phone_number_campaign_detach_failed_item.rb +67 -0
- data/lib/rcs/types/phone_number_campaign_detach_phone_numbers_item.rb +75 -0
- data/lib/rcs/types/phone_number_campaign_detach_phone_numbers_item_campaign.rb +78 -0
- data/lib/rcs/types/phone_number_cost.rb +75 -0
- data/lib/rcs/types/phone_number_details.rb +110 -0
- data/lib/rcs/types/phone_number_enum.rb +18 -0
- data/lib/rcs/types/phone_number_region.rb +91 -0
- data/lib/rcs/types/phone_number_status.rb +90 -0
- data/lib/rcs/types/phone_number_status_enum.rb +16 -0
- data/lib/rcs/types/pinnacle_file_upload_metadata.rb +84 -0
- data/lib/rcs/types/pinnacle_url_config.rb +71 -0
- data/lib/rcs/types/profile_status_enum.rb +17 -0
- data/lib/rcs/types/purchased_number.rb +75 -0
- data/lib/rcs/types/rcs.rb +70 -0
- data/lib/rcs/types/rcs_base.rb +82 -0
- data/lib/rcs/types/rcs_base_options.rb +100 -0
- data/lib/rcs/types/rcs_button_call.rb +68 -0
- data/lib/rcs/types/rcs_button_content.rb +148 -0
- data/lib/rcs/types/rcs_button_open_url.rb +68 -0
- data/lib/rcs/types/rcs_button_request_user_location.rb +58 -0
- data/lib/rcs/types/rcs_button_schedule_event.rb +98 -0
- data/lib/rcs/types/rcs_button_send_location.rb +74 -0
- data/lib/rcs/types/rcs_button_send_location_lat_long.rb +68 -0
- data/lib/rcs/types/rcs_button_trigger.rb +78 -0
- data/lib/rcs/types/rcs_campaign.rb +143 -0
- data/lib/rcs/types/rcs_campaign_opt_in_method_enum.rb +15 -0
- data/lib/rcs/types/rcs_campaign_schema_agent.rb +134 -0
- data/lib/rcs/types/rcs_campaign_schema_agent_emails_item.rb +69 -0
- data/lib/rcs/types/rcs_campaign_schema_agent_phones_item.rb +69 -0
- data/lib/rcs/types/rcs_campaign_schema_agent_websites_item.rb +69 -0
- data/lib/rcs/types/rcs_campaign_schema_extra_agent.rb +134 -0
- data/lib/rcs/types/rcs_campaign_schema_extra_agent_emails_item.rb +70 -0
- data/lib/rcs/types/rcs_campaign_schema_extra_agent_phones_item.rb +70 -0
- data/lib/rcs/types/rcs_campaign_schema_extra_agent_websites_item.rb +71 -0
- data/lib/rcs/types/rcs_campaign_schema_extra_links.rb +70 -0
- data/lib/rcs/types/rcs_campaign_schema_extra_opt_in.rb +71 -0
- data/lib/rcs/types/rcs_campaign_schema_extra_opt_out.rb +70 -0
- data/lib/rcs/types/rcs_campaign_schema_extra_use_case.rb +71 -0
- data/lib/rcs/types/rcs_campaign_schema_links.rb +70 -0
- data/lib/rcs/types/rcs_campaign_schema_opt_in.rb +71 -0
- data/lib/rcs/types/rcs_campaign_schema_opt_out.rb +70 -0
- data/lib/rcs/types/rcs_campaign_schema_use_case.rb +71 -0
- data/lib/rcs/types/rcs_campaign_status.rb +86 -0
- data/lib/rcs/types/rcs_campaign_use_case_enum.rb +23 -0
- data/lib/rcs/types/rcs_card.rb +110 -0
- data/lib/rcs/types/rcs_cards.rb +79 -0
- data/lib/rcs/types/rcs_cards_cards_item.rb +88 -0
- data/lib/rcs/types/rcs_cards_content.rb +79 -0
- data/lib/rcs/types/rcs_cards_content_cards_item.rb +94 -0
- data/lib/rcs/types/rcs_content.rb +72 -0
- data/lib/rcs/types/rcs_media.rb +110 -0
- data/lib/rcs/types/rcs_media_content.rb +81 -0
- data/lib/rcs/types/rcs_media_details_content.rb +77 -0
- data/lib/rcs/types/rcs_text.rb +106 -0
- data/lib/rcs/types/rcs_text_content.rb +72 -0
- data/lib/rcs/types/rcs_validate_content.rb +70 -0
- data/lib/rcs/{company/types/company_register_response.rb → types/rcs_validate_content_media.rb} +19 -21
- data/lib/rcs/types/rcs_validation_result.rb +76 -0
- data/lib/rcs/types/reaction_result.rb +67 -0
- data/lib/rcs/types/scheduled_messaage.rb +73 -0
- data/lib/rcs/types/scheduled_send_response_config.rb +89 -0
- data/lib/rcs/types/send_sms_response_segments.rb +69 -0
- data/lib/rcs/types/send_sms_response_segments_encoding.rb +11 -0
- data/lib/rcs/types/sent_mms_details.rb +102 -0
- data/lib/rcs/types/sent_rcs_details.rb +105 -0
- data/lib/rcs/types/sent_sms_details.rb +108 -0
- data/lib/rcs/types/shortened_url.rb +77 -0
- data/lib/rcs/types/shortened_url_with_click_data.rb +90 -0
- data/lib/rcs/types/sms_content.rb +58 -0
- data/lib/rcs/types/sms_validation_response_segments.rb +80 -0
- data/lib/rcs/types/sms_validation_response_segments_gsm_7.rb +75 -0
- data/lib/rcs/types/sms_validation_response_segments_utf_16.rb +68 -0
- data/lib/rcs/types/sms_validation_response_total.rb +75 -0
- data/lib/rcs/types/sms_validation_result.rb +102 -0
- data/lib/rcs/types/sub_use_case_enum.rb +19 -0
- data/lib/rcs/types/submission_results.rb +57 -0
- data/lib/rcs/types/successful_conversation_update.rb +58 -0
- data/lib/rcs/types/toll_free_campaign.rb +118 -0
- data/lib/rcs/types/toll_free_campaign_schema_opt_in.rb +78 -0
- data/lib/rcs/types/toll_free_campaign_schema_use_case.rb +71 -0
- data/lib/rcs/types/toll_free_campaign_status.rb +91 -0
- data/lib/rcs/types/toll_free_campaign_use_case_enum.rb +52 -0
- data/lib/rcs/types/toll_free_campaign_with_extended_brand_and_status.rb +155 -0
- data/lib/rcs/types/toll_free_status_enum.rb +20 -0
- data/lib/rcs/types/tracking.rb +17 -0
- data/lib/rcs/types/updated_contact_id.rb +57 -0
- data/lib/rcs/types/upload_results.rb +80 -0
- data/lib/rcs/types/v_card_address_schema_type_item.rb +15 -0
- data/lib/rcs/types/v_card_data.rb +237 -0
- data/lib/rcs/types/v_card_data_file.rb +74 -0
- data/lib/rcs/types/v_card_data_file_metadata.rb +62 -0
- data/lib/rcs/types/v_card_email_schema_type_item.rb +21 -0
- data/lib/rcs/types/v_card_geo.rb +70 -0
- data/lib/rcs/types/v_card_name.rb +98 -0
- data/lib/rcs/types/v_card_organization.rb +70 -0
- data/lib/rcs/types/v_card_phone_schema_type_item.rb +21 -0
- data/lib/rcs/types/validate_campaign_params.rb +69 -0
- data/lib/rcs/types/validation_error_details.rb +76 -0
- data/lib/rcs/types/validation_results.rb +71 -0
- data/lib/rcs/types/vcard.rb +215 -0
- data/lib/rcs/types/vcard_address.rb +130 -0
- data/lib/rcs/types/vcard_content.rb +223 -0
- data/lib/rcs/types/vcard_email.rb +70 -0
- data/lib/rcs/types/vcard_phone.rb +70 -0
- data/lib/rcs/types/vcard_resource.rb +71 -0
- data/lib/rcs/types/vetting_feedback.rb +81 -0
- data/lib/rcs/types/vetting_history.rb +98 -0
- data/lib/rcs/types/vetting_history_vetting_status.rb +13 -0
- data/lib/rcs/types/vetting_results.rb +57 -0
- data/lib/rcs/types/webhook_event_enum.rb +13 -0
- data/lib/rcs/types/webhook_result.rb +64 -0
- data/lib/rcs/{company/types/company_update_response_brand.rb → types/webhooks.rb} +25 -17
- data/lib/rcs/types/zod_error.rb +73 -0
- data/lib/rcs/webhooks/client.rb +93 -0
- data/lib/rcs.rb +67 -83
- data/lib/requests.rb +4 -4
- data/lib/types_export.rb +252 -46
- metadata +278 -52
- data/lib/rcs/company/client.rb +0 -375
- data/lib/rcs/company/types/company_register_request_company.rb +0 -128
- data/lib/rcs/send/client.rb +0 -382
- data/lib/rcs/send/types/rcs_fallback.rb +0 -84
- data/lib/rcs/tools/types/tools_shorten_url_response.rb +0 -70
- data/lib/rcs/tools/types/tools_upload_url_response.rb +0 -69
- data/lib/rcs/types/action.rb +0 -154
- data/lib/rcs/types/action_lat_long.rb +0 -68
- data/lib/rcs/types/action_type.rb +0 -16
- data/lib/rcs/types/additional_email.rb +0 -65
- data/lib/rcs/types/additional_phone_number.rb +0 -65
- data/lib/rcs/types/additional_website.rb +0 -65
- data/lib/rcs/types/card.rb +0 -90
- data/lib/rcs/types/company.rb +0 -319
- data/lib/rcs/types/company_additional_emails_item.rb +0 -67
- data/lib/rcs/types/company_additional_phone_numbers_item.rb +0 -67
- data/lib/rcs/types/company_additional_websites_item.rb +0 -67
- data/lib/rcs/types/company_category.rb +0 -20
- data/lib/rcs/types/company_contact.rb +0 -117
- data/lib/rcs/types/company_details.rb +0 -120
- data/lib/rcs/types/forbidden_error_body.rb +0 -57
- data/lib/rcs/types/inbound_action_message.rb +0 -117
- data/lib/rcs/types/inbound_location_message.rb +0 -106
- data/lib/rcs/types/inbound_location_message_coordinates.rb +0 -65
- data/lib/rcs/types/inbound_media_message.rb +0 -112
- data/lib/rcs/types/inbound_message.rb +0 -88
- data/lib/rcs/types/inbound_message_message_type.rb +0 -10
- data/lib/rcs/types/inbound_message_metadata.rb +0 -79
- data/lib/rcs/types/inbound_text_message.rb +0 -100
- data/lib/rcs/types/internal_server_error_body.rb +0 -57
- data/lib/rcs/types/media_payload.rb +0 -65
- data/lib/rcs/types/message_metadata.rb +0 -56
- data/lib/rcs/types/messaging.rb +0 -95
- data/lib/rcs/types/optionals.rb +0 -99
- data/lib/rcs/types/payment_required_error_body.rb +0 -57
- data/lib/rcs/types/point_of_contact.rb +0 -72
- data/lib/rcs/types/rcs_functionalities.rb +0 -117
- data/lib/rcs/types/sender_metadata.rb +0 -74
- data/lib/rcs/types/unauthorized_error_body.rb +0 -57
@@ -0,0 +1,285 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../../requests"
|
4
|
+
require_relative "types/get_v_card_schema_options"
|
5
|
+
require_relative "../../types/v_card_data"
|
6
|
+
require_relative "../../types/v_card_name"
|
7
|
+
require_relative "../../types/vcard_address"
|
8
|
+
require_relative "../../types/vcard_phone"
|
9
|
+
require_relative "../../types/vcard_email"
|
10
|
+
require_relative "../../types/v_card_geo"
|
11
|
+
require_relative "../../types/v_card_organization"
|
12
|
+
require_relative "../../types/vcard_resource"
|
13
|
+
require "async"
|
14
|
+
|
15
|
+
module Pinnacle
|
16
|
+
module Tools
|
17
|
+
class ContactCardClient
|
18
|
+
# @return [Pinnacle::RequestClient]
|
19
|
+
attr_reader :request_client
|
20
|
+
|
21
|
+
# @param request_client [Pinnacle::RequestClient]
|
22
|
+
# @return [Pinnacle::Tools::ContactCardClient]
|
23
|
+
def initialize(request_client:)
|
24
|
+
@request_client = request_client
|
25
|
+
end
|
26
|
+
|
27
|
+
# Retrieve contact information as a vCard and get a presigned URL to download the
|
28
|
+
# file.
|
29
|
+
#
|
30
|
+
# @param id [Integer] ID of your contact.
|
31
|
+
# @param options [Hash] Request of type Pinnacle::Tools::ContactCard::Types::GetVCardSchemaOptions, as a Hash
|
32
|
+
# * :expires_at (String)
|
33
|
+
# @param request_options [Pinnacle::RequestOptions]
|
34
|
+
# @return [Pinnacle::Types::VCardData]
|
35
|
+
# @example
|
36
|
+
# api = Pinnacle::Client.new(
|
37
|
+
# base_url: "https://api.example.com",
|
38
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
39
|
+
# api_key: "YOUR_API_KEY"
|
40
|
+
# )
|
41
|
+
# api.tools.contact_card.get(id: 33)
|
42
|
+
def get(id:, options: nil, request_options: nil)
|
43
|
+
response = @request_client.conn.post do |req|
|
44
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
45
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
46
|
+
req.headers = {
|
47
|
+
**(req.headers || {}),
|
48
|
+
**@request_client.get_headers,
|
49
|
+
**(request_options&.additional_headers || {})
|
50
|
+
}.compact
|
51
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
52
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
53
|
+
end
|
54
|
+
req.body = { **(request_options&.additional_body_parameters || {}), id: id, options: options }.compact
|
55
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/tools/contact-card"
|
56
|
+
end
|
57
|
+
Pinnacle::Types::VCardData.from_json(json_object: response.body)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Create a new contact card or updates an existing one with full vCard data.
|
61
|
+
#
|
62
|
+
# @param id [Integer] Unique identifier for the contact.
|
63
|
+
# @param formatted_name [String] Full display name for the vCard.
|
64
|
+
# @param name [Hash] Structured name components.Request of type Pinnacle::Types::VCardName, as a Hash
|
65
|
+
# * :family_name (String)
|
66
|
+
# * :given_name (String)
|
67
|
+
# * :additional_names (Array<String>)
|
68
|
+
# * :honorific_prefixes (Array<String>)
|
69
|
+
# * :honorific_suffixes (Array<String>)
|
70
|
+
# @param nickname [Array<String>] Nicknames or aliases.
|
71
|
+
# @param birthday [String] Birthday in ISO 8601 date format (YYYY-MM-DD).
|
72
|
+
# @param addresses [Array<Hash>] Physical addresses.Request of type Array<Pinnacle::Types::VcardAddress>, as a Hash
|
73
|
+
# * :country_name (String)
|
74
|
+
# * :extended_address (String)
|
75
|
+
# * :fulladdress (String)
|
76
|
+
# * :locality (String)
|
77
|
+
# * :postal_code (String)
|
78
|
+
# * :post_office_box (String)
|
79
|
+
# * :region (String)
|
80
|
+
# * :street_address (String)
|
81
|
+
# * :type (Array<Pinnacle::Types::VCardAddressSchemaTypeItem>)
|
82
|
+
# @param url [String] Website URL.
|
83
|
+
# @param phones [Array<Hash>] Phone numbers.Request of type Array<Pinnacle::Types::VcardPhone>, as a Hash
|
84
|
+
# * :type (Array<Pinnacle::Types::VCardPhoneSchemaTypeItem>)
|
85
|
+
# * :value (String)
|
86
|
+
# @param emails [Array<Hash>] Email addresses.Request of type Array<Pinnacle::Types::VcardEmail>, as a Hash
|
87
|
+
# * :type (Array<Pinnacle::Types::VCardEmailSchemaTypeItem>)
|
88
|
+
# * :value (String)
|
89
|
+
# @param timezone [String] Timezone (e.g., "America/New_York").
|
90
|
+
# @param geo [Hash] Geographic coordinates.Request of type Pinnacle::Types::VCardGeo, as a Hash
|
91
|
+
# * :latitude (Float)
|
92
|
+
# * :longitude (Float)
|
93
|
+
# @param title [String] Job title or position.
|
94
|
+
# @param role [String] Role or function within the organization.
|
95
|
+
# @param organization [Hash] Organization or company information.Request of type Pinnacle::Types::VCardOrganization, as a Hash
|
96
|
+
# * :name (String)
|
97
|
+
# * :units (Array<String>)
|
98
|
+
# @param categories [Array<String>] Categories or tags for organizing contacts.
|
99
|
+
# @param note [String] Additional notes or comments.
|
100
|
+
# @param photo [String] Contact's photo
|
101
|
+
# @param request_options [Pinnacle::RequestOptions]
|
102
|
+
# @return [Pinnacle::Types::VcardResource]
|
103
|
+
# @example
|
104
|
+
# api = Pinnacle::Client.new(
|
105
|
+
# base_url: "https://api.example.com",
|
106
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
107
|
+
# api_key: "YOUR_API_KEY"
|
108
|
+
# )
|
109
|
+
# api.tools.contact_card.upsert(photo: "https://fastly.picsum.photos/id/853/200/200.jpg?hmac=f4LF-tVBBnJb9PQAVEO8GCTGWgLUnxQLw44rUofE6mQ")
|
110
|
+
def upsert(id: nil, formatted_name: nil, name: nil, nickname: nil, birthday: nil, addresses: nil, url: nil,
|
111
|
+
phones: nil, emails: nil, timezone: nil, geo: nil, title: nil, role: nil, organization: nil, categories: nil, note: nil, photo: nil, request_options: nil)
|
112
|
+
response = @request_client.conn.post do |req|
|
113
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
114
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
115
|
+
req.headers = {
|
116
|
+
**(req.headers || {}),
|
117
|
+
**@request_client.get_headers,
|
118
|
+
**(request_options&.additional_headers || {})
|
119
|
+
}.compact
|
120
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
121
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
122
|
+
end
|
123
|
+
req.body = {
|
124
|
+
**(request_options&.additional_body_parameters || {}),
|
125
|
+
id: id,
|
126
|
+
formattedName: formatted_name,
|
127
|
+
name: name,
|
128
|
+
nickname: nickname,
|
129
|
+
birthday: birthday,
|
130
|
+
addresses: addresses,
|
131
|
+
url: url,
|
132
|
+
phones: phones,
|
133
|
+
emails: emails,
|
134
|
+
timezone: timezone,
|
135
|
+
geo: geo,
|
136
|
+
title: title,
|
137
|
+
role: role,
|
138
|
+
organization: organization,
|
139
|
+
categories: categories,
|
140
|
+
note: note,
|
141
|
+
photo: photo
|
142
|
+
}.compact
|
143
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/tools/contact-card/upsert"
|
144
|
+
end
|
145
|
+
Pinnacle::Types::VcardResource.from_json(json_object: response.body)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
class AsyncContactCardClient
|
150
|
+
# @return [Pinnacle::AsyncRequestClient]
|
151
|
+
attr_reader :request_client
|
152
|
+
|
153
|
+
# @param request_client [Pinnacle::AsyncRequestClient]
|
154
|
+
# @return [Pinnacle::Tools::AsyncContactCardClient]
|
155
|
+
def initialize(request_client:)
|
156
|
+
@request_client = request_client
|
157
|
+
end
|
158
|
+
|
159
|
+
# Retrieve contact information as a vCard and get a presigned URL to download the
|
160
|
+
# file.
|
161
|
+
#
|
162
|
+
# @param id [Integer] ID of your contact.
|
163
|
+
# @param options [Hash] Request of type Pinnacle::Tools::ContactCard::Types::GetVCardSchemaOptions, as a Hash
|
164
|
+
# * :expires_at (String)
|
165
|
+
# @param request_options [Pinnacle::RequestOptions]
|
166
|
+
# @return [Pinnacle::Types::VCardData]
|
167
|
+
# @example
|
168
|
+
# api = Pinnacle::Client.new(
|
169
|
+
# base_url: "https://api.example.com",
|
170
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
171
|
+
# api_key: "YOUR_API_KEY"
|
172
|
+
# )
|
173
|
+
# api.tools.contact_card.get(id: 33)
|
174
|
+
def get(id:, options: nil, request_options: nil)
|
175
|
+
Async do
|
176
|
+
response = @request_client.conn.post do |req|
|
177
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
178
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
179
|
+
req.headers = {
|
180
|
+
**(req.headers || {}),
|
181
|
+
**@request_client.get_headers,
|
182
|
+
**(request_options&.additional_headers || {})
|
183
|
+
}.compact
|
184
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
185
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
186
|
+
end
|
187
|
+
req.body = { **(request_options&.additional_body_parameters || {}), id: id, options: options }.compact
|
188
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/tools/contact-card"
|
189
|
+
end
|
190
|
+
Pinnacle::Types::VCardData.from_json(json_object: response.body)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
# Create a new contact card or updates an existing one with full vCard data.
|
195
|
+
#
|
196
|
+
# @param id [Integer] Unique identifier for the contact.
|
197
|
+
# @param formatted_name [String] Full display name for the vCard.
|
198
|
+
# @param name [Hash] Structured name components.Request of type Pinnacle::Types::VCardName, as a Hash
|
199
|
+
# * :family_name (String)
|
200
|
+
# * :given_name (String)
|
201
|
+
# * :additional_names (Array<String>)
|
202
|
+
# * :honorific_prefixes (Array<String>)
|
203
|
+
# * :honorific_suffixes (Array<String>)
|
204
|
+
# @param nickname [Array<String>] Nicknames or aliases.
|
205
|
+
# @param birthday [String] Birthday in ISO 8601 date format (YYYY-MM-DD).
|
206
|
+
# @param addresses [Array<Hash>] Physical addresses.Request of type Array<Pinnacle::Types::VcardAddress>, as a Hash
|
207
|
+
# * :country_name (String)
|
208
|
+
# * :extended_address (String)
|
209
|
+
# * :fulladdress (String)
|
210
|
+
# * :locality (String)
|
211
|
+
# * :postal_code (String)
|
212
|
+
# * :post_office_box (String)
|
213
|
+
# * :region (String)
|
214
|
+
# * :street_address (String)
|
215
|
+
# * :type (Array<Pinnacle::Types::VCardAddressSchemaTypeItem>)
|
216
|
+
# @param url [String] Website URL.
|
217
|
+
# @param phones [Array<Hash>] Phone numbers.Request of type Array<Pinnacle::Types::VcardPhone>, as a Hash
|
218
|
+
# * :type (Array<Pinnacle::Types::VCardPhoneSchemaTypeItem>)
|
219
|
+
# * :value (String)
|
220
|
+
# @param emails [Array<Hash>] Email addresses.Request of type Array<Pinnacle::Types::VcardEmail>, as a Hash
|
221
|
+
# * :type (Array<Pinnacle::Types::VCardEmailSchemaTypeItem>)
|
222
|
+
# * :value (String)
|
223
|
+
# @param timezone [String] Timezone (e.g., "America/New_York").
|
224
|
+
# @param geo [Hash] Geographic coordinates.Request of type Pinnacle::Types::VCardGeo, as a Hash
|
225
|
+
# * :latitude (Float)
|
226
|
+
# * :longitude (Float)
|
227
|
+
# @param title [String] Job title or position.
|
228
|
+
# @param role [String] Role or function within the organization.
|
229
|
+
# @param organization [Hash] Organization or company information.Request of type Pinnacle::Types::VCardOrganization, as a Hash
|
230
|
+
# * :name (String)
|
231
|
+
# * :units (Array<String>)
|
232
|
+
# @param categories [Array<String>] Categories or tags for organizing contacts.
|
233
|
+
# @param note [String] Additional notes or comments.
|
234
|
+
# @param photo [String] Contact's photo
|
235
|
+
# @param request_options [Pinnacle::RequestOptions]
|
236
|
+
# @return [Pinnacle::Types::VcardResource]
|
237
|
+
# @example
|
238
|
+
# api = Pinnacle::Client.new(
|
239
|
+
# base_url: "https://api.example.com",
|
240
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
241
|
+
# api_key: "YOUR_API_KEY"
|
242
|
+
# )
|
243
|
+
# api.tools.contact_card.upsert(photo: "https://fastly.picsum.photos/id/853/200/200.jpg?hmac=f4LF-tVBBnJb9PQAVEO8GCTGWgLUnxQLw44rUofE6mQ")
|
244
|
+
def upsert(id: nil, formatted_name: nil, name: nil, nickname: nil, birthday: nil, addresses: nil, url: nil,
|
245
|
+
phones: nil, emails: nil, timezone: nil, geo: nil, title: nil, role: nil, organization: nil, categories: nil, note: nil, photo: nil, request_options: nil)
|
246
|
+
Async do
|
247
|
+
response = @request_client.conn.post do |req|
|
248
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
249
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
250
|
+
req.headers = {
|
251
|
+
**(req.headers || {}),
|
252
|
+
**@request_client.get_headers,
|
253
|
+
**(request_options&.additional_headers || {})
|
254
|
+
}.compact
|
255
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
256
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
257
|
+
end
|
258
|
+
req.body = {
|
259
|
+
**(request_options&.additional_body_parameters || {}),
|
260
|
+
id: id,
|
261
|
+
formattedName: formatted_name,
|
262
|
+
name: name,
|
263
|
+
nickname: nickname,
|
264
|
+
birthday: birthday,
|
265
|
+
addresses: addresses,
|
266
|
+
url: url,
|
267
|
+
phones: phones,
|
268
|
+
emails: emails,
|
269
|
+
timezone: timezone,
|
270
|
+
geo: geo,
|
271
|
+
title: title,
|
272
|
+
role: role,
|
273
|
+
organization: organization,
|
274
|
+
categories: categories,
|
275
|
+
note: note,
|
276
|
+
photo: photo
|
277
|
+
}.compact
|
278
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/tools/contact-card/upsert"
|
279
|
+
end
|
280
|
+
Pinnacle::Types::VcardResource.from_json(json_object: response.body)
|
281
|
+
end
|
282
|
+
end
|
283
|
+
end
|
284
|
+
end
|
285
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Pinnacle
|
7
|
+
module Tools
|
8
|
+
module ContactCard
|
9
|
+
module Types
|
10
|
+
class GetVCardSchemaOptions
|
11
|
+
# @return [String] Set an expiration date for your download URL in IS0 8610 format. <br>
|
12
|
+
# If this field is not provided, the expiration time is defaulted to one hour
|
13
|
+
# after retrieval.
|
14
|
+
attr_reader :expires_at
|
15
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
+
attr_reader :additional_properties
|
17
|
+
# @return [Object]
|
18
|
+
attr_reader :_field_set
|
19
|
+
protected :_field_set
|
20
|
+
|
21
|
+
OMIT = Object.new
|
22
|
+
|
23
|
+
# @param expires_at [String] Set an expiration date for your download URL in IS0 8610 format. <br>
|
24
|
+
# If this field is not provided, the expiration time is defaulted to one hour
|
25
|
+
# after retrieval.
|
26
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
27
|
+
# @return [Pinnacle::Tools::ContactCard::Types::GetVCardSchemaOptions]
|
28
|
+
def initialize(expires_at: OMIT, additional_properties: nil)
|
29
|
+
@expires_at = expires_at if expires_at != OMIT
|
30
|
+
@additional_properties = additional_properties
|
31
|
+
@_field_set = { "expiresAt": expires_at }.reject do |_k, v|
|
32
|
+
v == OMIT
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Deserialize a JSON object to an instance of GetVCardSchemaOptions
|
37
|
+
#
|
38
|
+
# @param json_object [String]
|
39
|
+
# @return [Pinnacle::Tools::ContactCard::Types::GetVCardSchemaOptions]
|
40
|
+
def self.from_json(json_object:)
|
41
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
42
|
+
parsed_json = JSON.parse(json_object)
|
43
|
+
expires_at = parsed_json["expiresAt"]
|
44
|
+
new(expires_at: expires_at, additional_properties: struct)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Serialize an instance of GetVCardSchemaOptions to a JSON object
|
48
|
+
#
|
49
|
+
# @return [String]
|
50
|
+
def to_json(*_args)
|
51
|
+
@_field_set&.to_json
|
52
|
+
end
|
53
|
+
|
54
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
55
|
+
# hash and check each fields type against the current object's property
|
56
|
+
# definitions.
|
57
|
+
#
|
58
|
+
# @param obj [Object]
|
59
|
+
# @return [Void]
|
60
|
+
def self.validate_raw(obj:)
|
61
|
+
obj.expires_at&.is_a?(String) != false || raise("Passed value for field obj.expires_at is not the expected type, validation failed.")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../../requests"
|
4
|
+
require_relative "types/file_upload_schema_options"
|
5
|
+
require_relative "../../types/upload_results"
|
6
|
+
require "async"
|
7
|
+
|
8
|
+
module Pinnacle
|
9
|
+
module Tools
|
10
|
+
class FileClient
|
11
|
+
# @return [Pinnacle::RequestClient]
|
12
|
+
attr_reader :request_client
|
13
|
+
|
14
|
+
# @param request_client [Pinnacle::RequestClient]
|
15
|
+
# @return [Pinnacle::Tools::FileClient]
|
16
|
+
def initialize(request_client:)
|
17
|
+
@request_client = request_client
|
18
|
+
end
|
19
|
+
|
20
|
+
# Generate presigned URLs that let you upload files directly to our storage and
|
21
|
+
# allow your users to download them securely.
|
22
|
+
#
|
23
|
+
# @param content_type [String] MIME type of your file. <br>
|
24
|
+
# Supported file types:
|
25
|
+
# - Audio: mp3, mp4, mpeg, ogg, aac, webm, wav, 3gpp, amr
|
26
|
+
# - Video: mp4, mpeg, quicktime, webm, 3gpp, H.264, m4v
|
27
|
+
# - Image: jpeg, png, gif, bmp, tiff, webp
|
28
|
+
# - Documents: pdf, csv, rtf, calendar, vcard
|
29
|
+
# @param size [Integer] Size of your file in bytes. Should be less than 100 MB.
|
30
|
+
# @param name [String] Name of your file.
|
31
|
+
# @param options [Hash] Additional configurations for your file.Request of type Pinnacle::Tools::File::Types::FileUploadSchemaOptions, as a Hash
|
32
|
+
# * :download (Hash)
|
33
|
+
# * :expires_at (String)
|
34
|
+
# @param request_options [Pinnacle::RequestOptions]
|
35
|
+
# @return [Pinnacle::Types::UploadResults]
|
36
|
+
# @example
|
37
|
+
# api = Pinnacle::Client.new(
|
38
|
+
# base_url: "https://api.example.com",
|
39
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
40
|
+
# api_key: "YOUR_API_KEY"
|
41
|
+
# )
|
42
|
+
# api.tools.file.upload(
|
43
|
+
# content_type: "image/jpeg",
|
44
|
+
# size: 1024,
|
45
|
+
# name: "test.jpg",
|
46
|
+
# options: { download: { expires_at: "2025-06-30T12:00:00.000Z" } }
|
47
|
+
# )
|
48
|
+
def upload(content_type:, size:, name: nil, options: nil, request_options: nil)
|
49
|
+
response = @request_client.conn.post do |req|
|
50
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
51
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
52
|
+
req.headers = {
|
53
|
+
**(req.headers || {}),
|
54
|
+
**@request_client.get_headers,
|
55
|
+
**(request_options&.additional_headers || {})
|
56
|
+
}.compact
|
57
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
58
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
59
|
+
end
|
60
|
+
req.body = {
|
61
|
+
**(request_options&.additional_body_parameters || {}),
|
62
|
+
contentType: content_type,
|
63
|
+
size: size,
|
64
|
+
name: name,
|
65
|
+
options: options
|
66
|
+
}.compact
|
67
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/tools/files/upload"
|
68
|
+
end
|
69
|
+
Pinnacle::Types::UploadResults.from_json(json_object: response.body)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
class AsyncFileClient
|
74
|
+
# @return [Pinnacle::AsyncRequestClient]
|
75
|
+
attr_reader :request_client
|
76
|
+
|
77
|
+
# @param request_client [Pinnacle::AsyncRequestClient]
|
78
|
+
# @return [Pinnacle::Tools::AsyncFileClient]
|
79
|
+
def initialize(request_client:)
|
80
|
+
@request_client = request_client
|
81
|
+
end
|
82
|
+
|
83
|
+
# Generate presigned URLs that let you upload files directly to our storage and
|
84
|
+
# allow your users to download them securely.
|
85
|
+
#
|
86
|
+
# @param content_type [String] MIME type of your file. <br>
|
87
|
+
# Supported file types:
|
88
|
+
# - Audio: mp3, mp4, mpeg, ogg, aac, webm, wav, 3gpp, amr
|
89
|
+
# - Video: mp4, mpeg, quicktime, webm, 3gpp, H.264, m4v
|
90
|
+
# - Image: jpeg, png, gif, bmp, tiff, webp
|
91
|
+
# - Documents: pdf, csv, rtf, calendar, vcard
|
92
|
+
# @param size [Integer] Size of your file in bytes. Should be less than 100 MB.
|
93
|
+
# @param name [String] Name of your file.
|
94
|
+
# @param options [Hash] Additional configurations for your file.Request of type Pinnacle::Tools::File::Types::FileUploadSchemaOptions, as a Hash
|
95
|
+
# * :download (Hash)
|
96
|
+
# * :expires_at (String)
|
97
|
+
# @param request_options [Pinnacle::RequestOptions]
|
98
|
+
# @return [Pinnacle::Types::UploadResults]
|
99
|
+
# @example
|
100
|
+
# api = Pinnacle::Client.new(
|
101
|
+
# base_url: "https://api.example.com",
|
102
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
103
|
+
# api_key: "YOUR_API_KEY"
|
104
|
+
# )
|
105
|
+
# api.tools.file.upload(
|
106
|
+
# content_type: "image/jpeg",
|
107
|
+
# size: 1024,
|
108
|
+
# name: "test.jpg",
|
109
|
+
# options: { download: { expires_at: "2025-06-30T12:00:00.000Z" } }
|
110
|
+
# )
|
111
|
+
def upload(content_type:, size:, name: nil, options: nil, request_options: nil)
|
112
|
+
Async do
|
113
|
+
response = @request_client.conn.post do |req|
|
114
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
115
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
116
|
+
req.headers = {
|
117
|
+
**(req.headers || {}),
|
118
|
+
**@request_client.get_headers,
|
119
|
+
**(request_options&.additional_headers || {})
|
120
|
+
}.compact
|
121
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
122
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
123
|
+
end
|
124
|
+
req.body = {
|
125
|
+
**(request_options&.additional_body_parameters || {}),
|
126
|
+
contentType: content_type,
|
127
|
+
size: size,
|
128
|
+
name: name,
|
129
|
+
options: options
|
130
|
+
}.compact
|
131
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/tools/files/upload"
|
132
|
+
end
|
133
|
+
Pinnacle::Types::UploadResults.from_json(json_object: response.body)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "file_upload_schema_options_download"
|
4
|
+
require "ostruct"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Pinnacle
|
8
|
+
module Tools
|
9
|
+
module File
|
10
|
+
module Types
|
11
|
+
# Additional configurations for your file.
|
12
|
+
class FileUploadSchemaOptions
|
13
|
+
# @return [Pinnacle::Tools::File::Types::FileUploadSchemaOptionsDownload] Configure download settings for your uploaded file.
|
14
|
+
attr_reader :download
|
15
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
+
attr_reader :additional_properties
|
17
|
+
# @return [Object]
|
18
|
+
attr_reader :_field_set
|
19
|
+
protected :_field_set
|
20
|
+
|
21
|
+
OMIT = Object.new
|
22
|
+
|
23
|
+
# @param download [Pinnacle::Tools::File::Types::FileUploadSchemaOptionsDownload] Configure download settings for your uploaded file.
|
24
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
25
|
+
# @return [Pinnacle::Tools::File::Types::FileUploadSchemaOptions]
|
26
|
+
def initialize(download: OMIT, additional_properties: nil)
|
27
|
+
@download = download if download != OMIT
|
28
|
+
@additional_properties = additional_properties
|
29
|
+
@_field_set = { "download": download }.reject do |_k, v|
|
30
|
+
v == OMIT
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# Deserialize a JSON object to an instance of FileUploadSchemaOptions
|
35
|
+
#
|
36
|
+
# @param json_object [String]
|
37
|
+
# @return [Pinnacle::Tools::File::Types::FileUploadSchemaOptions]
|
38
|
+
def self.from_json(json_object:)
|
39
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
40
|
+
parsed_json = JSON.parse(json_object)
|
41
|
+
if parsed_json["download"].nil?
|
42
|
+
download = nil
|
43
|
+
else
|
44
|
+
download = parsed_json["download"].to_json
|
45
|
+
download = Pinnacle::Tools::File::Types::FileUploadSchemaOptionsDownload.from_json(json_object: download)
|
46
|
+
end
|
47
|
+
new(download: download, additional_properties: struct)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Serialize an instance of FileUploadSchemaOptions to a JSON object
|
51
|
+
#
|
52
|
+
# @return [String]
|
53
|
+
def to_json(*_args)
|
54
|
+
@_field_set&.to_json
|
55
|
+
end
|
56
|
+
|
57
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
58
|
+
# hash and check each fields type against the current object's property
|
59
|
+
# definitions.
|
60
|
+
#
|
61
|
+
# @param obj [Object]
|
62
|
+
# @return [Void]
|
63
|
+
def self.validate_raw(obj:)
|
64
|
+
obj.download.nil? || Pinnacle::Tools::File::Types::FileUploadSchemaOptionsDownload.validate_raw(obj: obj.download)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Pinnacle
|
7
|
+
module Tools
|
8
|
+
module File
|
9
|
+
module Types
|
10
|
+
# Configure download settings for your uploaded file.
|
11
|
+
class FileUploadSchemaOptionsDownload
|
12
|
+
# @return [String] Set an expiration date for file download access.<br>
|
13
|
+
# If this field is not provided, then a short permalink is generated instead.
|
14
|
+
attr_reader :expires_at
|
15
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
+
attr_reader :additional_properties
|
17
|
+
# @return [Object]
|
18
|
+
attr_reader :_field_set
|
19
|
+
protected :_field_set
|
20
|
+
|
21
|
+
OMIT = Object.new
|
22
|
+
|
23
|
+
# @param expires_at [String] Set an expiration date for file download access.<br>
|
24
|
+
# If this field is not provided, then a short permalink is generated instead.
|
25
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
26
|
+
# @return [Pinnacle::Tools::File::Types::FileUploadSchemaOptionsDownload]
|
27
|
+
def initialize(expires_at: OMIT, additional_properties: nil)
|
28
|
+
@expires_at = expires_at if expires_at != OMIT
|
29
|
+
@additional_properties = additional_properties
|
30
|
+
@_field_set = { "expiresAt": expires_at }.reject do |_k, v|
|
31
|
+
v == OMIT
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Deserialize a JSON object to an instance of FileUploadSchemaOptionsDownload
|
36
|
+
#
|
37
|
+
# @param json_object [String]
|
38
|
+
# @return [Pinnacle::Tools::File::Types::FileUploadSchemaOptionsDownload]
|
39
|
+
def self.from_json(json_object:)
|
40
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
41
|
+
parsed_json = JSON.parse(json_object)
|
42
|
+
expires_at = parsed_json["expiresAt"]
|
43
|
+
new(expires_at: expires_at, additional_properties: struct)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Serialize an instance of FileUploadSchemaOptionsDownload to a JSON object
|
47
|
+
#
|
48
|
+
# @return [String]
|
49
|
+
def to_json(*_args)
|
50
|
+
@_field_set&.to_json
|
51
|
+
end
|
52
|
+
|
53
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
54
|
+
# hash and check each fields type against the current object's property
|
55
|
+
# definitions.
|
56
|
+
#
|
57
|
+
# @param obj [Object]
|
58
|
+
# @return [Void]
|
59
|
+
def self.validate_raw(obj:)
|
60
|
+
obj.expires_at&.is_a?(String) != false || raise("Passed value for field obj.expires_at is not the expected type, validation failed.")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|