one_msg_sdk 2.0.2 → 2.0.3
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/AGENTS.md +62 -16
- data/README.md +97 -29
- data/docs/AddTemplate200Response.md +18 -0
- data/docs/AddTemplateRequest.md +7 -7
- data/docs/CallingApi.md +1 -1
- data/docs/CatalogApi.md +1 -1
- data/docs/ChannelApi.md +151 -5
- data/docs/CreateFlowsRequest.md +26 -0
- data/docs/CreateGroupsGroupIdRequest.md +22 -0
- data/docs/CreateGroupsRequest.md +20 -0
- data/docs/CreateSettingsRequest.md +28 -0
- data/docs/CreateSettingsRequestWebhookUrl.md +49 -0
- data/docs/CreateUploadMedia200Response.md +18 -0
- data/docs/CreateUploadMediaRequest.md +20 -0
- data/docs/FlowsApi.md +32 -16
- data/docs/GetStatus200Response.md +26 -0
- data/docs/GetWebhook200Response.md +24 -2
- data/docs/GetWebhook200ResponseWebhookUrl.md +49 -0
- data/docs/GroupsApi.md +38 -18
- data/docs/ListSettings200Response.md +52 -0
- data/docs/ListSettings200ResponseWebhookUrl.md +49 -0
- data/docs/MessagingApi.md +140 -35
- data/docs/PatchFlowsFlowIdAssetsRequest.md +18 -0
- data/docs/PatchFlowsFlowIdMetadataRequest.md +22 -0
- data/docs/ProfileApi.md +9 -11
- data/docs/RemoveTemplateRequest.md +18 -0
- data/docs/SendButtonRequest.md +9 -1
- data/docs/SendCarouselRequest1.md +4 -2
- data/docs/SendContactInfoRequest.md +26 -0
- data/docs/SendContactRequest.md +7 -1
- data/docs/SendContactRequestContact.md +26 -0
- data/docs/SendContactRequestContactName.md +49 -0
- data/docs/SendContactRequestContactsInner.md +3 -3
- data/docs/SendContactRequestContactsInnerPhonesInner.md +1 -1
- data/docs/SendListRequest.md +5 -1
- data/docs/SendLocationRequestRequest.md +5 -1
- data/docs/SendMessageRequest.md +6 -2
- data/docs/SendMessageRequestDirectSend.md +20 -0
- data/docs/SendProductRequest.md +30 -0
- data/docs/SendReactionRequest.md +3 -1
- data/docs/SendTemplateRequest.md +9 -5
- data/docs/SendTemplateRequestLanguage.md +3 -3
- data/docs/SetWebhook200Response.md +20 -0
- data/docs/SetWebhook200ResponseWebhookUrl.md +49 -0
- data/docs/SetWebhookRequest.md +18 -0
- data/docs/SetWebhookRequestWebhookUrl.md +49 -0
- data/docs/TemplatesApi.md +29 -17
- data/docs/UpdateMe200Response.md +18 -0
- data/docs/UpdateMeRequest.md +6 -6
- data/docs/WebhookUrlStatus.md +34 -0
- data/docs/WebhooksApi.md +10 -12
- data/lib/one_msg_sdk/api/calling_api.rb +4 -4
- data/lib/one_msg_sdk/api/catalog_api.rb +4 -4
- data/lib/one_msg_sdk/api/channel_api.rb +146 -7
- data/lib/one_msg_sdk/api/flows_api.rb +58 -14
- data/lib/one_msg_sdk/api/groups_api.rb +48 -10
- data/lib/one_msg_sdk/api/messaging_api.rb +163 -38
- data/lib/one_msg_sdk/api/profile_api.rb +17 -13
- data/lib/one_msg_sdk/api/templates_api.rb +36 -13
- data/lib/one_msg_sdk/api/users_api.rb +2 -2
- data/lib/one_msg_sdk/api/webhooks_api.rb +19 -15
- data/lib/one_msg_sdk/api_client.rb +2 -2
- data/lib/one_msg_sdk/api_error.rb +2 -2
- data/lib/one_msg_sdk/api_model_base.rb +2 -2
- data/lib/one_msg_sdk/configuration.rb +2 -2
- data/lib/one_msg_sdk/models/add_template200_response.rb +150 -0
- data/lib/one_msg_sdk/models/add_template_request.rb +6 -2
- data/lib/one_msg_sdk/models/block_user_request.rb +2 -2
- data/lib/one_msg_sdk/models/calling_settings.rb +2 -2
- data/lib/one_msg_sdk/models/calling_settings_calling.rb +2 -2
- data/lib/one_msg_sdk/models/calling_settings_calling_audio.rb +2 -2
- data/lib/one_msg_sdk/models/calling_settings_calling_call_hours.rb +2 -2
- data/lib/one_msg_sdk/models/calling_settings_calling_sip.rb +2 -2
- data/lib/one_msg_sdk/models/calling_settings_calling_sip_servers_inner.rb +2 -2
- data/lib/one_msg_sdk/models/calling_settings_calling_video.rb +2 -2
- data/lib/one_msg_sdk/models/conversational_automation.rb +2 -2
- data/lib/one_msg_sdk/models/conversational_automation_commands_inner.rb +2 -2
- data/lib/one_msg_sdk/models/create_commerce200_response.rb +2 -2
- data/lib/one_msg_sdk/models/create_commerce_request.rb +2 -2
- data/lib/one_msg_sdk/models/create_commerce_request_params.rb +2 -2
- data/lib/one_msg_sdk/models/create_flows_request.rb +238 -0
- data/lib/one_msg_sdk/models/create_groups200_response.rb +2 -2
- data/lib/one_msg_sdk/models/create_groups_group_id_request.rb +168 -0
- data/lib/one_msg_sdk/models/create_groups_request.rb +175 -0
- data/lib/one_msg_sdk/models/create_read_message200_response.rb +2 -2
- data/lib/one_msg_sdk/models/create_read_message401_response.rb +2 -2
- data/lib/one_msg_sdk/models/create_read_message_request.rb +2 -2
- data/lib/one_msg_sdk/models/create_settings_request.rb +192 -0
- data/lib/one_msg_sdk/models/create_settings_request_webhook_url.rb +105 -0
- data/lib/one_msg_sdk/models/create_upload_media200_response.rb +147 -0
- data/lib/one_msg_sdk/models/create_upload_media_request.rb +158 -0
- data/lib/one_msg_sdk/models/delete_flows_flow_id200_response.rb +2 -2
- data/lib/one_msg_sdk/models/delete_groups_group_id200_response.rb +2 -2
- data/lib/one_msg_sdk/models/delete_media_legacy_request.rb +2 -2
- data/lib/one_msg_sdk/models/error_response.rb +2 -2
- data/lib/one_msg_sdk/models/get_commerce200_response_inner.rb +2 -2
- data/lib/one_msg_sdk/models/get_mm_lite_status200_response.rb +2 -2
- data/lib/one_msg_sdk/models/get_status200_response.rb +185 -0
- data/lib/one_msg_sdk/models/get_webhook200_response.rb +155 -6
- data/lib/one_msg_sdk/models/get_webhook200_response_webhook_url.rb +105 -0
- data/lib/one_msg_sdk/models/get_whatsapp_business_encryption200_response.rb +2 -2
- data/lib/one_msg_sdk/models/initiate_call_request.rb +2 -2
- data/lib/one_msg_sdk/models/initiate_call_request_session.rb +2 -2
- data/lib/one_msg_sdk/models/initiate_call_response.rb +2 -2
- data/lib/one_msg_sdk/models/initiate_call_response_calls_inner.rb +2 -2
- data/lib/one_msg_sdk/models/initiate_call_response_response.rb +2 -2
- data/lib/one_msg_sdk/models/list_blocked_users200_response.rb +2 -2
- data/lib/one_msg_sdk/models/list_flows200_response.rb +2 -2
- data/lib/one_msg_sdk/models/list_messages200_response.rb +2 -2
- data/lib/one_msg_sdk/models/list_settings200_response.rb +352 -0
- data/lib/one_msg_sdk/models/list_settings200_response_webhook_url.rb +105 -0
- data/lib/one_msg_sdk/models/list_templates200_response.rb +2 -2
- data/lib/one_msg_sdk/models/message_sent_response.rb +2 -2
- data/lib/one_msg_sdk/models/patch_flows_flow_id_assets200_response.rb +2 -2
- data/lib/one_msg_sdk/models/patch_flows_flow_id_assets_request.rb +167 -0
- data/lib/one_msg_sdk/models/patch_flows_flow_id_metadata_request.rb +190 -0
- data/lib/one_msg_sdk/models/profile_info.rb +2 -2
- data/lib/one_msg_sdk/models/remove_template_request.rb +165 -0
- data/lib/one_msg_sdk/models/retrieve_media200_response.rb +2 -2
- data/lib/one_msg_sdk/models/send_address_message_request.rb +2 -2
- data/lib/one_msg_sdk/models/send_button_request.rb +48 -3
- data/lib/one_msg_sdk/models/send_button_request_sections_inner.rb +2 -2
- data/lib/one_msg_sdk/models/send_button_request_sections_inner_reply.rb +2 -2
- data/lib/one_msg_sdk/models/send_carousel_request1.rb +38 -13
- data/lib/one_msg_sdk/models/send_contact_info_request.rb +222 -0
- data/lib/one_msg_sdk/models/send_contact_request.rb +32 -3
- data/lib/one_msg_sdk/models/send_contact_request_contact.rb +221 -0
- data/lib/one_msg_sdk/models/send_contact_request_contact_name.rb +105 -0
- data/lib/one_msg_sdk/models/send_contact_request_contacts_inner.rb +5 -5
- data/lib/one_msg_sdk/models/send_contact_request_contacts_inner_name.rb +2 -2
- data/lib/one_msg_sdk/models/send_contact_request_contacts_inner_org.rb +2 -2
- data/lib/one_msg_sdk/models/send_contact_request_contacts_inner_phones_inner.rb +3 -2
- data/lib/one_msg_sdk/models/send_cta_url_request.rb +2 -2
- data/lib/one_msg_sdk/models/send_file_request.rb +2 -2
- data/lib/one_msg_sdk/models/send_flow_request1.rb +2 -2
- data/lib/one_msg_sdk/models/send_flow_request1_header.rb +2 -2
- data/lib/one_msg_sdk/models/send_flow_request_header.rb +2 -2
- data/lib/one_msg_sdk/models/send_list_request.rb +23 -3
- data/lib/one_msg_sdk/models/send_list_request_sections_inner.rb +2 -2
- data/lib/one_msg_sdk/models/send_list_request_sections_inner_rows_inner.rb +2 -2
- data/lib/one_msg_sdk/models/send_location_request1.rb +2 -2
- data/lib/one_msg_sdk/models/send_location_request_request.rb +23 -3
- data/lib/one_msg_sdk/models/send_message_request.rb +60 -28
- data/lib/one_msg_sdk/models/send_message_request_direct_send.rb +189 -0
- data/lib/one_msg_sdk/models/send_order_details_request.rb +2 -2
- data/lib/one_msg_sdk/models/send_order_details_request_language.rb +2 -2
- data/lib/one_msg_sdk/models/send_order_details_request_order.rb +2 -2
- data/lib/one_msg_sdk/models/send_order_details_request_order_items_inner.rb +2 -2
- data/lib/one_msg_sdk/models/send_order_details_request_order_items_inner_amount.rb +2 -2
- data/lib/one_msg_sdk/models/send_payment_request_request.rb +2 -2
- data/lib/one_msg_sdk/models/send_product_request.rb +225 -0
- data/lib/one_msg_sdk/models/send_reaction_request.rb +14 -3
- data/lib/one_msg_sdk/models/send_sticker_request.rb +2 -2
- data/lib/one_msg_sdk/models/send_template_request.rb +29 -5
- data/lib/one_msg_sdk/models/send_template_request_language.rb +6 -2
- data/lib/one_msg_sdk/models/set_webhook200_response.rb +157 -0
- data/lib/one_msg_sdk/models/set_webhook200_response_webhook_url.rb +105 -0
- data/lib/one_msg_sdk/models/set_webhook_request.rb +164 -0
- data/lib/one_msg_sdk/models/set_webhook_request_webhook_url.rb +105 -0
- data/lib/one_msg_sdk/models/set_whatsapp_business_encryption_request.rb +2 -2
- data/lib/one_msg_sdk/models/success_response.rb +2 -2
- data/lib/one_msg_sdk/models/update_calling_settings200_response.rb +2 -2
- data/lib/one_msg_sdk/models/update_calling_settings200_response_response.rb +2 -2
- data/lib/one_msg_sdk/models/update_me200_response.rb +147 -0
- data/lib/one_msg_sdk/models/update_me_request.rb +6 -3
- data/lib/one_msg_sdk/models/webhook_url_status.rb +287 -0
- data/lib/one_msg_sdk/platform_client.rb +182 -0
- data/lib/one_msg_sdk/version.rb +3 -3
- data/lib/one_msg_sdk.rb +30 -2
- data/one_msg_sdk.gemspec +2 -2
- data/spec/api/calling_api_spec.rb +3 -3
- data/spec/api/catalog_api_spec.rb +3 -3
- data/spec/api/channel_api_spec.rb +29 -4
- data/spec/api/flows_api_spec.rb +10 -2
- data/spec/api/groups_api_spec.rb +10 -2
- data/spec/api/messaging_api_spec.rb +37 -9
- data/spec/api/profile_api_spec.rb +5 -5
- data/spec/api/templates_api_spec.rb +11 -5
- data/spec/api/users_api_spec.rb +2 -2
- data/spec/api/webhooks_api_spec.rb +6 -6
- data/spec/models/add_template200_response_spec.rb +36 -0
- data/spec/models/add_template_request_spec.rb +2 -2
- data/spec/models/block_user_request_spec.rb +2 -2
- data/spec/models/calling_settings_calling_audio_spec.rb +2 -2
- data/spec/models/calling_settings_calling_call_hours_spec.rb +2 -2
- data/spec/models/calling_settings_calling_sip_servers_inner_spec.rb +2 -2
- data/spec/models/calling_settings_calling_sip_spec.rb +2 -2
- data/spec/models/calling_settings_calling_spec.rb +2 -2
- data/spec/models/calling_settings_calling_video_spec.rb +2 -2
- data/spec/models/calling_settings_spec.rb +2 -2
- data/spec/models/conversational_automation_commands_inner_spec.rb +2 -2
- data/spec/models/conversational_automation_spec.rb +2 -2
- data/spec/models/create_commerce200_response_spec.rb +2 -2
- data/spec/models/create_commerce_request_params_spec.rb +2 -2
- data/spec/models/create_commerce_request_spec.rb +2 -2
- data/spec/models/create_flows_request_spec.rb +64 -0
- data/spec/models/create_groups200_response_spec.rb +2 -2
- data/spec/models/create_groups_group_id_request_spec.rb +48 -0
- data/spec/models/create_groups_request_spec.rb +42 -0
- data/spec/models/create_read_message200_response_spec.rb +2 -2
- data/spec/models/create_read_message401_response_spec.rb +2 -2
- data/spec/models/create_read_message_request_spec.rb +2 -2
- data/spec/models/create_settings_request_spec.rb +66 -0
- data/spec/models/create_settings_request_webhook_url_spec.rb +32 -0
- data/spec/models/create_upload_media200_response_spec.rb +36 -0
- data/spec/models/create_upload_media_request_spec.rb +42 -0
- data/spec/models/delete_flows_flow_id200_response_spec.rb +2 -2
- data/spec/models/delete_groups_group_id200_response_spec.rb +2 -2
- data/spec/models/delete_media_legacy_request_spec.rb +2 -2
- data/spec/models/error_response_spec.rb +2 -2
- data/spec/models/get_commerce200_response_inner_spec.rb +2 -2
- data/spec/models/get_mm_lite_status200_response_spec.rb +2 -2
- data/spec/models/get_status200_response_spec.rb +60 -0
- data/spec/models/get_webhook200_response_spec.rb +72 -2
- data/spec/models/get_webhook200_response_webhook_url_spec.rb +32 -0
- data/spec/models/get_whatsapp_business_encryption200_response_spec.rb +2 -2
- data/spec/models/initiate_call_request_session_spec.rb +2 -2
- data/spec/models/initiate_call_request_spec.rb +2 -2
- data/spec/models/initiate_call_response_calls_inner_spec.rb +2 -2
- data/spec/models/initiate_call_response_response_spec.rb +2 -2
- data/spec/models/initiate_call_response_spec.rb +2 -2
- data/spec/models/list_blocked_users200_response_spec.rb +2 -2
- data/spec/models/list_flows200_response_spec.rb +2 -2
- data/spec/models/list_messages200_response_spec.rb +2 -2
- data/spec/models/list_settings200_response_spec.rb +142 -0
- data/spec/models/list_settings200_response_webhook_url_spec.rb +32 -0
- data/spec/models/list_templates200_response_spec.rb +2 -2
- data/spec/models/message_sent_response_spec.rb +2 -2
- data/spec/models/patch_flows_flow_id_assets200_response_spec.rb +2 -2
- data/spec/models/patch_flows_flow_id_assets_request_spec.rb +36 -0
- data/spec/models/patch_flows_flow_id_metadata_request_spec.rb +52 -0
- data/spec/models/profile_info_spec.rb +2 -2
- data/spec/models/remove_template_request_spec.rb +36 -0
- data/spec/models/retrieve_media200_response_spec.rb +2 -2
- data/spec/models/send_address_message_request_spec.rb +2 -2
- data/spec/models/send_button_request_sections_inner_reply_spec.rb +2 -2
- data/spec/models/send_button_request_sections_inner_spec.rb +2 -2
- data/spec/models/send_button_request_spec.rb +26 -2
- data/spec/models/send_carousel_request1_spec.rb +8 -2
- data/spec/models/send_contact_info_request_spec.rb +60 -0
- data/spec/models/send_contact_request_contact_name_spec.rb +32 -0
- data/spec/models/send_contact_request_contact_spec.rb +60 -0
- data/spec/models/send_contact_request_contacts_inner_name_spec.rb +2 -2
- data/spec/models/send_contact_request_contacts_inner_org_spec.rb +2 -2
- data/spec/models/send_contact_request_contacts_inner_phones_inner_spec.rb +2 -2
- data/spec/models/send_contact_request_contacts_inner_spec.rb +2 -2
- data/spec/models/send_contact_request_spec.rb +20 -2
- data/spec/models/send_cta_url_request_spec.rb +2 -2
- data/spec/models/send_file_request_spec.rb +2 -2
- data/spec/models/send_flow_request1_header_spec.rb +2 -2
- data/spec/models/send_flow_request1_spec.rb +2 -2
- data/spec/models/send_flow_request_header_spec.rb +2 -2
- data/spec/models/send_list_request_sections_inner_rows_inner_spec.rb +2 -2
- data/spec/models/send_list_request_sections_inner_spec.rb +2 -2
- data/spec/models/send_list_request_spec.rb +14 -2
- data/spec/models/send_location_request1_spec.rb +2 -2
- data/spec/models/send_location_request_request_spec.rb +14 -2
- data/spec/models/send_message_request_direct_send_spec.rb +42 -0
- data/spec/models/send_message_request_spec.rb +18 -2
- data/spec/models/send_order_details_request_language_spec.rb +2 -2
- data/spec/models/send_order_details_request_order_items_inner_amount_spec.rb +2 -2
- data/spec/models/send_order_details_request_order_items_inner_spec.rb +2 -2
- data/spec/models/send_order_details_request_order_spec.rb +2 -2
- data/spec/models/send_order_details_request_spec.rb +2 -2
- data/spec/models/send_payment_request_request_spec.rb +2 -2
- data/spec/models/send_product_request_spec.rb +72 -0
- data/spec/models/send_reaction_request_spec.rb +8 -2
- data/spec/models/send_sticker_request_spec.rb +2 -2
- data/spec/models/send_template_request_language_spec.rb +2 -2
- data/spec/models/send_template_request_spec.rb +14 -2
- data/spec/models/set_webhook200_response_spec.rb +42 -0
- data/spec/models/set_webhook200_response_webhook_url_spec.rb +32 -0
- data/spec/models/set_webhook_request_spec.rb +36 -0
- data/spec/models/set_webhook_request_webhook_url_spec.rb +32 -0
- data/spec/models/set_whatsapp_business_encryption_request_spec.rb +2 -2
- data/spec/models/success_response_spec.rb +2 -2
- data/spec/models/update_calling_settings200_response_response_spec.rb +2 -2
- data/spec/models/update_calling_settings200_response_spec.rb +2 -2
- data/spec/models/update_me200_response_spec.rb +36 -0
- data/spec/models/update_me_request_spec.rb +2 -2
- data/spec/models/webhook_url_status_spec.rb +88 -0
- data/spec/spec_helper.rb +2 -2
- metadata +204 -31
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#1MSG WhatsApp Business API (Public)
|
|
3
|
+
|
|
4
|
+
#Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:** Pass the channel token in **one** place. The API checks JSON body (`token`), then query string (`?token=`), then `Authorization: Bearer` header (preferred in production). **Documentation:** https://help.1msg.io/platform-1msg/getting-start/quick-start **API Docs:** https://docs.1msg.io/
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
|
7
|
+
Contact: support@1msg.io
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.22.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module OneMsgSdk
|
|
17
|
+
# Circuit / auto-disable status for one configured webhook URL. The breaker is per URL (`instanceId` + URL hash), not per channel.
|
|
18
|
+
class WebhookUrlStatus < ApiModelBase
|
|
19
|
+
# This webhook URL (same string as in `webhookUrl`)
|
|
20
|
+
attr_accessor :url
|
|
21
|
+
|
|
22
|
+
# Delivery state for this URL only. `ok` delivering; `degraded` recent qualifying fails (still delivering, warning email on the 2nd fail); `open` skipping most deliveries pending a probe; `half_open` probe in flight (resume only on HTTP 2xx); `disabled` sticky auto-disabled until self-serve re-enable (`POST /webhook` / `POST /settings` with this URL) or a successful probe before sticky disable.
|
|
23
|
+
attr_accessor :circuit_state
|
|
24
|
+
|
|
25
|
+
# Last qualifying fail reason, e.g. `http_404` or `timeout_or_network`
|
|
26
|
+
attr_accessor :reason
|
|
27
|
+
|
|
28
|
+
# Diagnostic only — safe for clients to ignore. Number of qualifying delivery failures in the rolling ~10 minute breaker window (not lifetime, not \"how many times the customer retried\"). Prefer `circuitState` / `disabledWebhooks`.
|
|
29
|
+
attr_accessor :fails
|
|
30
|
+
|
|
31
|
+
# Diagnostic only — safe for clients to ignore. How many recovery probes already failed for this URL. Probes run on a schedule (≈15 min → 1 h → 6 h); sticky disable after 3 failed probes. The 6 h step is the last probe, not a blind \"unblock in 6 hours\" timer.
|
|
32
|
+
attr_accessor :trips
|
|
33
|
+
|
|
34
|
+
# Epoch milliseconds when this URL became sticky-disabled
|
|
35
|
+
attr_accessor :disabled_at
|
|
36
|
+
|
|
37
|
+
# Diagnostic only. Epoch ms of the first fail in the current ~10 minute window (pairs with `fails`; not a customer-facing period).
|
|
38
|
+
attr_accessor :first_fail_at
|
|
39
|
+
|
|
40
|
+
# Last HTTP status from this URL, when known
|
|
41
|
+
attr_accessor :last_status
|
|
42
|
+
|
|
43
|
+
# Epoch milliseconds of the next half-open probe, if any
|
|
44
|
+
attr_accessor :next_probe_at
|
|
45
|
+
|
|
46
|
+
class EnumAttributeValidator
|
|
47
|
+
attr_reader :datatype
|
|
48
|
+
attr_reader :allowable_values
|
|
49
|
+
|
|
50
|
+
def initialize(datatype, allowable_values)
|
|
51
|
+
@allowable_values = allowable_values.map do |value|
|
|
52
|
+
case datatype.to_s
|
|
53
|
+
when /Integer/i
|
|
54
|
+
value.to_i
|
|
55
|
+
when /Float/i
|
|
56
|
+
value.to_f
|
|
57
|
+
else
|
|
58
|
+
value
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def valid?(value)
|
|
64
|
+
!value || allowable_values.include?(value)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
69
|
+
def self.attribute_map
|
|
70
|
+
{
|
|
71
|
+
:'url' => :'url',
|
|
72
|
+
:'circuit_state' => :'circuitState',
|
|
73
|
+
:'reason' => :'reason',
|
|
74
|
+
:'fails' => :'fails',
|
|
75
|
+
:'trips' => :'trips',
|
|
76
|
+
:'disabled_at' => :'disabledAt',
|
|
77
|
+
:'first_fail_at' => :'firstFailAt',
|
|
78
|
+
:'last_status' => :'lastStatus',
|
|
79
|
+
:'next_probe_at' => :'nextProbeAt'
|
|
80
|
+
}
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Returns attribute mapping this model knows about
|
|
84
|
+
def self.acceptable_attribute_map
|
|
85
|
+
attribute_map
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Returns all the JSON keys this model knows about
|
|
89
|
+
def self.acceptable_attributes
|
|
90
|
+
acceptable_attribute_map.values
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Attribute type mapping.
|
|
94
|
+
def self.openapi_types
|
|
95
|
+
{
|
|
96
|
+
:'url' => :'String',
|
|
97
|
+
:'circuit_state' => :'String',
|
|
98
|
+
:'reason' => :'String',
|
|
99
|
+
:'fails' => :'Integer',
|
|
100
|
+
:'trips' => :'Integer',
|
|
101
|
+
:'disabled_at' => :'Integer',
|
|
102
|
+
:'first_fail_at' => :'Integer',
|
|
103
|
+
:'last_status' => :'Integer',
|
|
104
|
+
:'next_probe_at' => :'Integer'
|
|
105
|
+
}
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# List of attributes with nullable: true
|
|
109
|
+
def self.openapi_nullable
|
|
110
|
+
Set.new([
|
|
111
|
+
])
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Initializes the object
|
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
116
|
+
def initialize(attributes = {})
|
|
117
|
+
if (!attributes.is_a?(Hash))
|
|
118
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OneMsgSdk::WebhookUrlStatus` initialize method"
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
122
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
123
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
124
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
125
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OneMsgSdk::WebhookUrlStatus`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
126
|
+
end
|
|
127
|
+
h[k.to_sym] = v
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if attributes.key?(:'url')
|
|
131
|
+
self.url = attributes[:'url']
|
|
132
|
+
else
|
|
133
|
+
self.url = nil
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
if attributes.key?(:'circuit_state')
|
|
137
|
+
self.circuit_state = attributes[:'circuit_state']
|
|
138
|
+
else
|
|
139
|
+
self.circuit_state = nil
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
if attributes.key?(:'reason')
|
|
143
|
+
self.reason = attributes[:'reason']
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
if attributes.key?(:'fails')
|
|
147
|
+
self.fails = attributes[:'fails']
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
if attributes.key?(:'trips')
|
|
151
|
+
self.trips = attributes[:'trips']
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
if attributes.key?(:'disabled_at')
|
|
155
|
+
self.disabled_at = attributes[:'disabled_at']
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
if attributes.key?(:'first_fail_at')
|
|
159
|
+
self.first_fail_at = attributes[:'first_fail_at']
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
if attributes.key?(:'last_status')
|
|
163
|
+
self.last_status = attributes[:'last_status']
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
if attributes.key?(:'next_probe_at')
|
|
167
|
+
self.next_probe_at = attributes[:'next_probe_at']
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
172
|
+
# @return Array for valid properties with the reasons
|
|
173
|
+
def list_invalid_properties
|
|
174
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
175
|
+
invalid_properties = Array.new
|
|
176
|
+
if @url.nil?
|
|
177
|
+
invalid_properties.push('invalid value for "url", url cannot be nil.')
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
if @circuit_state.nil?
|
|
181
|
+
invalid_properties.push('invalid value for "circuit_state", circuit_state cannot be nil.')
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
invalid_properties
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# Check to see if the all the properties in the model are valid
|
|
188
|
+
# @return true if the model is valid
|
|
189
|
+
def valid?
|
|
190
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
191
|
+
return false if @url.nil?
|
|
192
|
+
return false if @circuit_state.nil?
|
|
193
|
+
circuit_state_validator = EnumAttributeValidator.new('String', ["ok", "degraded", "open", "half_open", "disabled"])
|
|
194
|
+
return false unless circuit_state_validator.valid?(@circuit_state)
|
|
195
|
+
true
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Custom attribute writer method with validation
|
|
199
|
+
# @param [Object] url Value to be assigned
|
|
200
|
+
def url=(url)
|
|
201
|
+
if url.nil?
|
|
202
|
+
fail ArgumentError, 'url cannot be nil'
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
@url = url
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
209
|
+
# @param [Object] circuit_state Object to be assigned
|
|
210
|
+
def circuit_state=(circuit_state)
|
|
211
|
+
validator = EnumAttributeValidator.new('String', ["ok", "degraded", "open", "half_open", "disabled"])
|
|
212
|
+
unless validator.valid?(circuit_state)
|
|
213
|
+
fail ArgumentError, "invalid value for \"circuit_state\", must be one of #{validator.allowable_values}."
|
|
214
|
+
end
|
|
215
|
+
@circuit_state = circuit_state
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
# Checks equality by comparing each attribute.
|
|
219
|
+
# @param [Object] Object to be compared
|
|
220
|
+
def ==(o)
|
|
221
|
+
return true if self.equal?(o)
|
|
222
|
+
self.class == o.class &&
|
|
223
|
+
url == o.url &&
|
|
224
|
+
circuit_state == o.circuit_state &&
|
|
225
|
+
reason == o.reason &&
|
|
226
|
+
fails == o.fails &&
|
|
227
|
+
trips == o.trips &&
|
|
228
|
+
disabled_at == o.disabled_at &&
|
|
229
|
+
first_fail_at == o.first_fail_at &&
|
|
230
|
+
last_status == o.last_status &&
|
|
231
|
+
next_probe_at == o.next_probe_at
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# @see the `==` method
|
|
235
|
+
# @param [Object] Object to be compared
|
|
236
|
+
def eql?(o)
|
|
237
|
+
self == o
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# Calculates hash code according to all attributes.
|
|
241
|
+
# @return [Integer] Hash code
|
|
242
|
+
def hash
|
|
243
|
+
[url, circuit_state, reason, fails, trips, disabled_at, first_fail_at, last_status, next_probe_at].hash
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
# Builds the object from hash
|
|
247
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
248
|
+
# @return [Object] Returns the model itself
|
|
249
|
+
def self.build_from_hash(attributes)
|
|
250
|
+
return nil unless attributes.is_a?(Hash)
|
|
251
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
252
|
+
transformed_hash = {}
|
|
253
|
+
openapi_types.each_pair do |key, type|
|
|
254
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
255
|
+
transformed_hash["#{key}"] = nil
|
|
256
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
257
|
+
# check to ensure the input is an array given that the attribute
|
|
258
|
+
# is documented as an array but the input is not
|
|
259
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
260
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
261
|
+
end
|
|
262
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
263
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
264
|
+
end
|
|
265
|
+
end
|
|
266
|
+
new(transformed_hash)
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
# Returns the object in the form of hash
|
|
270
|
+
# @return [Hash] Returns the object in the form of hash
|
|
271
|
+
def to_hash
|
|
272
|
+
hash = {}
|
|
273
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
274
|
+
value = self.send(attr)
|
|
275
|
+
if value.nil?
|
|
276
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
277
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
hash[param] = _to_hash(value)
|
|
281
|
+
end
|
|
282
|
+
hash
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
end
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
require 'net/http'
|
|
3
|
+
require 'uri'
|
|
4
|
+
|
|
5
|
+
module OneMsgSdk
|
|
6
|
+
class PlatformError < StandardError
|
|
7
|
+
attr_reader :status, :body
|
|
8
|
+
def initialize(status, body)
|
|
9
|
+
super("Platform API HTTP #{status}")
|
|
10
|
+
@status = status
|
|
11
|
+
@body = body
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Platform API client. Bearer API key, not the WhatsApp channel token.
|
|
16
|
+
class PlatformClient
|
|
17
|
+
def initialize(api_key, base_url = 'https://api.1msg.io')
|
|
18
|
+
raise ArgumentError, 'api_key is required' if api_key.nil? || api_key.strip.empty?
|
|
19
|
+
@api_key = api_key.strip
|
|
20
|
+
@base_url = (base_url.nil? || base_url.strip.empty? ? 'https://api.1msg.io' : base_url).sub(%r{/+$}, '')
|
|
21
|
+
@operations = {}
|
|
22
|
+
JSON.parse("[{\"id\":\"listInboxChannels\",\"method\":\"GET\",\"path\":\"/api/v1/inbox/channels\",\"pathParams\":[]},{\"id\":\"listInboxChannelAssignees\",\"method\":\"GET\",\"path\":\"/api/v1/inbox/channels/{channelId}/assignees\",\"pathParams\":[\"channelId\"]},{\"id\":\"listInboxConversations\",\"method\":\"GET\",\"path\":\"/api/v1/inbox/conversations\",\"pathParams\":[]},{\"id\":\"searchInboxConversations\",\"method\":\"GET\",\"path\":\"/api/v1/inbox/conversations/search\",\"pathParams\":[]},{\"id\":\"countInboxConversations\",\"method\":\"GET\",\"path\":\"/api/v1/inbox/conversations/counts\",\"pathParams\":[]},{\"id\":\"getInboxConversation\",\"method\":\"GET\",\"path\":\"/api/v1/inbox/conversations/{conversationId}\",\"pathParams\":[\"conversationId\"]},{\"id\":\"updateInboxConversationStatus\",\"method\":\"PATCH\",\"path\":\"/api/v1/inbox/conversations/{conversationId}/status\",\"pathParams\":[\"conversationId\"]},{\"id\":\"updateInboxConversationAssignee\",\"method\":\"PATCH\",\"path\":\"/api/v1/inbox/conversations/{conversationId}/assignee\",\"pathParams\":[\"conversationId\"]},{\"id\":\"listInboxConversationMessages\",\"method\":\"GET\",\"path\":\"/api/v1/inbox/conversations/{conversationId}/messages\",\"pathParams\":[\"conversationId\"]},{\"id\":\"blockInboxContact\",\"method\":\"POST\",\"path\":\"/api/v1/inbox/conversations/{conversationId}/block\",\"pathParams\":[\"conversationId\"]},{\"id\":\"unblockInboxContact\",\"method\":\"POST\",\"path\":\"/api/v1/inbox/conversations/{conversationId}/unblock\",\"pathParams\":[\"conversationId\"]},{\"id\":\"renameInboxConversation\",\"method\":\"PATCH\",\"path\":\"/api/v1/inbox/conversations/{conversationId}/title\",\"pathParams\":[\"conversationId\"]},{\"id\":\"listInboxContacts\",\"method\":\"GET\",\"path\":\"/api/v1/inbox/contacts\",\"pathParams\":[]},{\"id\":\"getInboxWebhook\",\"method\":\"GET\",\"path\":\"/api/v1/inbox/webhook\",\"pathParams\":[]},{\"id\":\"setInboxWebhook\",\"method\":\"PUT\",\"path\":\"/api/v1/inbox/webhook\",\"pathParams\":[]},{\"id\":\"deleteInboxWebhook\",\"method\":\"DELETE\",\"path\":\"/api/v1/inbox/webhook\",\"pathParams\":[]},{\"id\":\"rotateInboxWebhookSecret\",\"method\":\"POST\",\"path\":\"/api/v1/inbox/webhook/secret\",\"pathParams\":[]},{\"id\":\"listCampaignSegments\",\"method\":\"GET\",\"path\":\"/api/v1/campaigns/segments\",\"pathParams\":[]},{\"id\":\"createCampaignSegment\",\"method\":\"POST\",\"path\":\"/api/v1/campaigns/segments\",\"pathParams\":[]},{\"id\":\"getCampaignSegment\",\"method\":\"GET\",\"path\":\"/api/v1/campaigns/segments/{segmentId}\",\"pathParams\":[\"segmentId\"]},{\"id\":\"updateCampaignSegment\",\"method\":\"PATCH\",\"path\":\"/api/v1/campaigns/segments/{segmentId}\",\"pathParams\":[\"segmentId\"]},{\"id\":\"deleteCampaignSegment\",\"method\":\"DELETE\",\"path\":\"/api/v1/campaigns/segments/{segmentId}\",\"pathParams\":[\"segmentId\"]},{\"id\":\"listCampaignSegmentMembers\",\"method\":\"GET\",\"path\":\"/api/v1/campaigns/segments/{segmentId}/members\",\"pathParams\":[\"segmentId\"]},{\"id\":\"addCampaignSegmentMembers\",\"method\":\"POST\",\"path\":\"/api/v1/campaigns/segments/{segmentId}/members\",\"pathParams\":[\"segmentId\"]},{\"id\":\"replaceCampaignSegmentMembers\",\"method\":\"PUT\",\"path\":\"/api/v1/campaigns/segments/{segmentId}/members\",\"pathParams\":[\"segmentId\"]},{\"id\":\"removeCampaignSegmentMembers\",\"method\":\"DELETE\",\"path\":\"/api/v1/campaigns/segments/{segmentId}/members\",\"pathParams\":[\"segmentId\"]},{\"id\":\"updateCampaignSegmentMember\",\"method\":\"PATCH\",\"path\":\"/api/v1/campaigns/segments/{segmentId}/members/{memberId}\",\"pathParams\":[\"segmentId\",\"memberId\"]},{\"id\":\"listCampaigns\",\"method\":\"GET\",\"path\":\"/api/v1/campaigns\",\"pathParams\":[]},{\"id\":\"createCampaign\",\"method\":\"POST\",\"path\":\"/api/v1/campaigns\",\"pathParams\":[]},{\"id\":\"getCampaign\",\"method\":\"GET\",\"path\":\"/api/v1/campaigns/{campaignId}\",\"pathParams\":[\"campaignId\"]},{\"id\":\"updateCampaign\",\"method\":\"PATCH\",\"path\":\"/api/v1/campaigns/{campaignId}\",\"pathParams\":[\"campaignId\"]},{\"id\":\"previewCampaign\",\"method\":\"GET\",\"path\":\"/api/v1/campaigns/{campaignId}/preview\",\"pathParams\":[\"campaignId\"]},{\"id\":\"sendCampaign\",\"method\":\"POST\",\"path\":\"/api/v1/campaigns/{campaignId}/send\",\"pathParams\":[\"campaignId\"]},{\"id\":\"scheduleCampaign\",\"method\":\"PATCH\",\"path\":\"/api/v1/campaigns/{campaignId}/schedule\",\"pathParams\":[\"campaignId\"]},{\"id\":\"unscheduleCampaign\",\"method\":\"POST\",\"path\":\"/api/v1/campaigns/{campaignId}/unschedule\",\"pathParams\":[\"campaignId\"]},{\"id\":\"pauseCampaign\",\"method\":\"POST\",\"path\":\"/api/v1/campaigns/{campaignId}/pause\",\"pathParams\":[\"campaignId\"]},{\"id\":\"resumeCampaign\",\"method\":\"POST\",\"path\":\"/api/v1/campaigns/{campaignId}/resume\",\"pathParams\":[\"campaignId\"]},{\"id\":\"completeCampaign\",\"method\":\"POST\",\"path\":\"/api/v1/campaigns/{campaignId}/complete\",\"pathParams\":[\"campaignId\"]},{\"id\":\"testCampaign\",\"method\":\"POST\",\"path\":\"/api/v1/campaigns/{campaignId}/test\",\"pathParams\":[\"campaignId\"]},{\"id\":\"getCampaignAnalytics\",\"method\":\"GET\",\"path\":\"/api/v1/campaigns/{campaignId}/analytics\",\"pathParams\":[\"campaignId\"]},{\"id\":\"listCampaignAnalyticsRecipients\",\"method\":\"GET\",\"path\":\"/api/v1/campaigns/{campaignId}/analytics/recipients\",\"pathParams\":[\"campaignId\"]},{\"id\":\"listCampaignAnalyticsReplies\",\"method\":\"GET\",\"path\":\"/api/v1/campaigns/{campaignId}/analytics/replies\",\"pathParams\":[\"campaignId\"]},{\"id\":\"listCampaignAnalyticsErrors\",\"method\":\"GET\",\"path\":\"/api/v1/campaigns/{campaignId}/analytics/errors\",\"pathParams\":[\"campaignId\"]}]").each { |operation| @operations[operation['id']] = operation }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def call(operation_id, path: nil, query: nil, body: nil)
|
|
26
|
+
spec = @operations[operation_id] or raise ArgumentError, "unknown platform operation #{operation_id}"
|
|
27
|
+
url_path = spec['path']
|
|
28
|
+
spec['pathParams'].each do |name|
|
|
29
|
+
value = path && path[name]
|
|
30
|
+
raise ArgumentError, "missing path param #{name}" if value.nil?
|
|
31
|
+
url_path = url_path.sub('{' + name + '}', URI.encode_www_form_component(value.to_s))
|
|
32
|
+
end
|
|
33
|
+
url = @base_url + url_path
|
|
34
|
+
url += '?' + URI.encode_www_form(query) if query && !query.empty?
|
|
35
|
+
uri = URI(url)
|
|
36
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
37
|
+
http.use_ssl = uri.scheme == 'https'
|
|
38
|
+
request = Net::HTTPGenericRequest.new(spec['method'], !body.nil?, true, uri)
|
|
39
|
+
request['Authorization'] = "Bearer #{@api_key}"
|
|
40
|
+
request['Accept'] = 'application/json'
|
|
41
|
+
if body
|
|
42
|
+
request['Content-Type'] = 'application/json'
|
|
43
|
+
request.body = JSON.generate(body)
|
|
44
|
+
end
|
|
45
|
+
response = http.request(request)
|
|
46
|
+
text = response.body.to_s
|
|
47
|
+
raise PlatformError.new(response.code.to_i, text) unless response.is_a?(Net::HTTPSuccess)
|
|
48
|
+
return nil if text.empty?
|
|
49
|
+
JSON.parse(text)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def list_inbox_channels(path: nil, query: nil, body: nil)
|
|
53
|
+
call("listInboxChannels", path: path, query: query, body: body)
|
|
54
|
+
end
|
|
55
|
+
def list_inbox_channel_assignees(path: nil, query: nil, body: nil)
|
|
56
|
+
call("listInboxChannelAssignees", path: path, query: query, body: body)
|
|
57
|
+
end
|
|
58
|
+
def list_inbox_conversations(path: nil, query: nil, body: nil)
|
|
59
|
+
call("listInboxConversations", path: path, query: query, body: body)
|
|
60
|
+
end
|
|
61
|
+
def search_inbox_conversations(path: nil, query: nil, body: nil)
|
|
62
|
+
call("searchInboxConversations", path: path, query: query, body: body)
|
|
63
|
+
end
|
|
64
|
+
def count_inbox_conversations(path: nil, query: nil, body: nil)
|
|
65
|
+
call("countInboxConversations", path: path, query: query, body: body)
|
|
66
|
+
end
|
|
67
|
+
def get_inbox_conversation(path: nil, query: nil, body: nil)
|
|
68
|
+
call("getInboxConversation", path: path, query: query, body: body)
|
|
69
|
+
end
|
|
70
|
+
def update_inbox_conversation_status(path: nil, query: nil, body: nil)
|
|
71
|
+
call("updateInboxConversationStatus", path: path, query: query, body: body)
|
|
72
|
+
end
|
|
73
|
+
def update_inbox_conversation_assignee(path: nil, query: nil, body: nil)
|
|
74
|
+
call("updateInboxConversationAssignee", path: path, query: query, body: body)
|
|
75
|
+
end
|
|
76
|
+
def list_inbox_conversation_messages(path: nil, query: nil, body: nil)
|
|
77
|
+
call("listInboxConversationMessages", path: path, query: query, body: body)
|
|
78
|
+
end
|
|
79
|
+
def block_inbox_contact(path: nil, query: nil, body: nil)
|
|
80
|
+
call("blockInboxContact", path: path, query: query, body: body)
|
|
81
|
+
end
|
|
82
|
+
def unblock_inbox_contact(path: nil, query: nil, body: nil)
|
|
83
|
+
call("unblockInboxContact", path: path, query: query, body: body)
|
|
84
|
+
end
|
|
85
|
+
def rename_inbox_conversation(path: nil, query: nil, body: nil)
|
|
86
|
+
call("renameInboxConversation", path: path, query: query, body: body)
|
|
87
|
+
end
|
|
88
|
+
def list_inbox_contacts(path: nil, query: nil, body: nil)
|
|
89
|
+
call("listInboxContacts", path: path, query: query, body: body)
|
|
90
|
+
end
|
|
91
|
+
def get_inbox_webhook(path: nil, query: nil, body: nil)
|
|
92
|
+
call("getInboxWebhook", path: path, query: query, body: body)
|
|
93
|
+
end
|
|
94
|
+
def set_inbox_webhook(path: nil, query: nil, body: nil)
|
|
95
|
+
call("setInboxWebhook", path: path, query: query, body: body)
|
|
96
|
+
end
|
|
97
|
+
def delete_inbox_webhook(path: nil, query: nil, body: nil)
|
|
98
|
+
call("deleteInboxWebhook", path: path, query: query, body: body)
|
|
99
|
+
end
|
|
100
|
+
def rotate_inbox_webhook_secret(path: nil, query: nil, body: nil)
|
|
101
|
+
call("rotateInboxWebhookSecret", path: path, query: query, body: body)
|
|
102
|
+
end
|
|
103
|
+
def list_campaign_segments(path: nil, query: nil, body: nil)
|
|
104
|
+
call("listCampaignSegments", path: path, query: query, body: body)
|
|
105
|
+
end
|
|
106
|
+
def create_campaign_segment(path: nil, query: nil, body: nil)
|
|
107
|
+
call("createCampaignSegment", path: path, query: query, body: body)
|
|
108
|
+
end
|
|
109
|
+
def get_campaign_segment(path: nil, query: nil, body: nil)
|
|
110
|
+
call("getCampaignSegment", path: path, query: query, body: body)
|
|
111
|
+
end
|
|
112
|
+
def update_campaign_segment(path: nil, query: nil, body: nil)
|
|
113
|
+
call("updateCampaignSegment", path: path, query: query, body: body)
|
|
114
|
+
end
|
|
115
|
+
def delete_campaign_segment(path: nil, query: nil, body: nil)
|
|
116
|
+
call("deleteCampaignSegment", path: path, query: query, body: body)
|
|
117
|
+
end
|
|
118
|
+
def list_campaign_segment_members(path: nil, query: nil, body: nil)
|
|
119
|
+
call("listCampaignSegmentMembers", path: path, query: query, body: body)
|
|
120
|
+
end
|
|
121
|
+
def add_campaign_segment_members(path: nil, query: nil, body: nil)
|
|
122
|
+
call("addCampaignSegmentMembers", path: path, query: query, body: body)
|
|
123
|
+
end
|
|
124
|
+
def replace_campaign_segment_members(path: nil, query: nil, body: nil)
|
|
125
|
+
call("replaceCampaignSegmentMembers", path: path, query: query, body: body)
|
|
126
|
+
end
|
|
127
|
+
def remove_campaign_segment_members(path: nil, query: nil, body: nil)
|
|
128
|
+
call("removeCampaignSegmentMembers", path: path, query: query, body: body)
|
|
129
|
+
end
|
|
130
|
+
def update_campaign_segment_member(path: nil, query: nil, body: nil)
|
|
131
|
+
call("updateCampaignSegmentMember", path: path, query: query, body: body)
|
|
132
|
+
end
|
|
133
|
+
def list_campaigns(path: nil, query: nil, body: nil)
|
|
134
|
+
call("listCampaigns", path: path, query: query, body: body)
|
|
135
|
+
end
|
|
136
|
+
def create_campaign(path: nil, query: nil, body: nil)
|
|
137
|
+
call("createCampaign", path: path, query: query, body: body)
|
|
138
|
+
end
|
|
139
|
+
def get_campaign(path: nil, query: nil, body: nil)
|
|
140
|
+
call("getCampaign", path: path, query: query, body: body)
|
|
141
|
+
end
|
|
142
|
+
def update_campaign(path: nil, query: nil, body: nil)
|
|
143
|
+
call("updateCampaign", path: path, query: query, body: body)
|
|
144
|
+
end
|
|
145
|
+
def preview_campaign(path: nil, query: nil, body: nil)
|
|
146
|
+
call("previewCampaign", path: path, query: query, body: body)
|
|
147
|
+
end
|
|
148
|
+
def send_campaign(path: nil, query: nil, body: nil)
|
|
149
|
+
call("sendCampaign", path: path, query: query, body: body)
|
|
150
|
+
end
|
|
151
|
+
def schedule_campaign(path: nil, query: nil, body: nil)
|
|
152
|
+
call("scheduleCampaign", path: path, query: query, body: body)
|
|
153
|
+
end
|
|
154
|
+
def unschedule_campaign(path: nil, query: nil, body: nil)
|
|
155
|
+
call("unscheduleCampaign", path: path, query: query, body: body)
|
|
156
|
+
end
|
|
157
|
+
def pause_campaign(path: nil, query: nil, body: nil)
|
|
158
|
+
call("pauseCampaign", path: path, query: query, body: body)
|
|
159
|
+
end
|
|
160
|
+
def resume_campaign(path: nil, query: nil, body: nil)
|
|
161
|
+
call("resumeCampaign", path: path, query: query, body: body)
|
|
162
|
+
end
|
|
163
|
+
def complete_campaign(path: nil, query: nil, body: nil)
|
|
164
|
+
call("completeCampaign", path: path, query: query, body: body)
|
|
165
|
+
end
|
|
166
|
+
def test_campaign(path: nil, query: nil, body: nil)
|
|
167
|
+
call("testCampaign", path: path, query: query, body: body)
|
|
168
|
+
end
|
|
169
|
+
def get_campaign_analytics(path: nil, query: nil, body: nil)
|
|
170
|
+
call("getCampaignAnalytics", path: path, query: query, body: body)
|
|
171
|
+
end
|
|
172
|
+
def list_campaign_analytics_recipients(path: nil, query: nil, body: nil)
|
|
173
|
+
call("listCampaignAnalyticsRecipients", path: path, query: query, body: body)
|
|
174
|
+
end
|
|
175
|
+
def list_campaign_analytics_replies(path: nil, query: nil, body: nil)
|
|
176
|
+
call("listCampaignAnalyticsReplies", path: path, query: query, body: body)
|
|
177
|
+
end
|
|
178
|
+
def list_campaign_analytics_errors(path: nil, query: nil, body: nil)
|
|
179
|
+
call("listCampaignAnalyticsErrors", path: path, query: query, body: body)
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
end
|
data/lib/one_msg_sdk/version.rb
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#1MSG WhatsApp Business API (Public)
|
|
3
3
|
|
|
4
|
-
#Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:**
|
|
4
|
+
#Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:** Pass the channel token in **one** place. The API checks JSON body (`token`), then query string (`?token=`), then `Authorization: Bearer` header (preferred in production). **Documentation:** https://help.1msg.io/platform-1msg/getting-start/quick-start **API Docs:** https://docs.1msg.io/
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document:
|
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
|
7
7
|
Contact: support@1msg.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.22.0
|
|
@@ -11,5 +11,5 @@ Generator version: 7.22.0
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
13
13
|
module OneMsgSdk
|
|
14
|
-
VERSION = '2.0.
|
|
14
|
+
VERSION = '2.0.3'
|
|
15
15
|
end
|
data/lib/one_msg_sdk.rb
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#1MSG WhatsApp Business API (Public)
|
|
3
3
|
|
|
4
|
-
#Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:**
|
|
4
|
+
#Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:** Pass the channel token in **one** place. The API checks JSON body (`token`), then query string (`?token=`), then `Authorization: Bearer` header (preferred in production). **Documentation:** https://help.1msg.io/platform-1msg/getting-start/quick-start **API Docs:** https://docs.1msg.io/
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document:
|
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
|
7
7
|
Contact: support@1msg.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.22.0
|
|
@@ -18,6 +18,7 @@ require 'one_msg_sdk/version'
|
|
|
18
18
|
require 'one_msg_sdk/configuration'
|
|
19
19
|
|
|
20
20
|
# Models
|
|
21
|
+
require 'one_msg_sdk/models/add_template200_response'
|
|
21
22
|
require 'one_msg_sdk/models/add_template_request'
|
|
22
23
|
require 'one_msg_sdk/models/block_user_request'
|
|
23
24
|
require 'one_msg_sdk/models/calling_settings'
|
|
@@ -32,17 +33,26 @@ require 'one_msg_sdk/models/conversational_automation_commands_inner'
|
|
|
32
33
|
require 'one_msg_sdk/models/create_commerce200_response'
|
|
33
34
|
require 'one_msg_sdk/models/create_commerce_request'
|
|
34
35
|
require 'one_msg_sdk/models/create_commerce_request_params'
|
|
36
|
+
require 'one_msg_sdk/models/create_flows_request'
|
|
35
37
|
require 'one_msg_sdk/models/create_groups200_response'
|
|
38
|
+
require 'one_msg_sdk/models/create_groups_group_id_request'
|
|
39
|
+
require 'one_msg_sdk/models/create_groups_request'
|
|
36
40
|
require 'one_msg_sdk/models/create_read_message200_response'
|
|
37
41
|
require 'one_msg_sdk/models/create_read_message401_response'
|
|
38
42
|
require 'one_msg_sdk/models/create_read_message_request'
|
|
43
|
+
require 'one_msg_sdk/models/create_settings_request'
|
|
44
|
+
require 'one_msg_sdk/models/create_settings_request_webhook_url'
|
|
45
|
+
require 'one_msg_sdk/models/create_upload_media200_response'
|
|
46
|
+
require 'one_msg_sdk/models/create_upload_media_request'
|
|
39
47
|
require 'one_msg_sdk/models/delete_flows_flow_id200_response'
|
|
40
48
|
require 'one_msg_sdk/models/delete_groups_group_id200_response'
|
|
41
49
|
require 'one_msg_sdk/models/delete_media_legacy_request'
|
|
42
50
|
require 'one_msg_sdk/models/error_response'
|
|
43
51
|
require 'one_msg_sdk/models/get_commerce200_response_inner'
|
|
44
52
|
require 'one_msg_sdk/models/get_mm_lite_status200_response'
|
|
53
|
+
require 'one_msg_sdk/models/get_status200_response'
|
|
45
54
|
require 'one_msg_sdk/models/get_webhook200_response'
|
|
55
|
+
require 'one_msg_sdk/models/get_webhook200_response_webhook_url'
|
|
46
56
|
require 'one_msg_sdk/models/get_whatsapp_business_encryption200_response'
|
|
47
57
|
require 'one_msg_sdk/models/initiate_call_request'
|
|
48
58
|
require 'one_msg_sdk/models/initiate_call_request_session'
|
|
@@ -52,17 +62,25 @@ require 'one_msg_sdk/models/initiate_call_response_response'
|
|
|
52
62
|
require 'one_msg_sdk/models/list_blocked_users200_response'
|
|
53
63
|
require 'one_msg_sdk/models/list_flows200_response'
|
|
54
64
|
require 'one_msg_sdk/models/list_messages200_response'
|
|
65
|
+
require 'one_msg_sdk/models/list_settings200_response'
|
|
66
|
+
require 'one_msg_sdk/models/list_settings200_response_webhook_url'
|
|
55
67
|
require 'one_msg_sdk/models/list_templates200_response'
|
|
56
68
|
require 'one_msg_sdk/models/message_sent_response'
|
|
57
69
|
require 'one_msg_sdk/models/patch_flows_flow_id_assets200_response'
|
|
70
|
+
require 'one_msg_sdk/models/patch_flows_flow_id_assets_request'
|
|
71
|
+
require 'one_msg_sdk/models/patch_flows_flow_id_metadata_request'
|
|
58
72
|
require 'one_msg_sdk/models/profile_info'
|
|
73
|
+
require 'one_msg_sdk/models/remove_template_request'
|
|
59
74
|
require 'one_msg_sdk/models/retrieve_media200_response'
|
|
60
75
|
require 'one_msg_sdk/models/send_address_message_request'
|
|
61
76
|
require 'one_msg_sdk/models/send_button_request'
|
|
62
77
|
require 'one_msg_sdk/models/send_button_request_sections_inner'
|
|
63
78
|
require 'one_msg_sdk/models/send_button_request_sections_inner_reply'
|
|
64
79
|
require 'one_msg_sdk/models/send_carousel_request1'
|
|
80
|
+
require 'one_msg_sdk/models/send_contact_info_request'
|
|
65
81
|
require 'one_msg_sdk/models/send_contact_request'
|
|
82
|
+
require 'one_msg_sdk/models/send_contact_request_contact'
|
|
83
|
+
require 'one_msg_sdk/models/send_contact_request_contact_name'
|
|
66
84
|
require 'one_msg_sdk/models/send_contact_request_contacts_inner'
|
|
67
85
|
require 'one_msg_sdk/models/send_contact_request_contacts_inner_name'
|
|
68
86
|
require 'one_msg_sdk/models/send_contact_request_contacts_inner_org'
|
|
@@ -78,21 +96,29 @@ require 'one_msg_sdk/models/send_list_request_sections_inner_rows_inner'
|
|
|
78
96
|
require 'one_msg_sdk/models/send_location_request1'
|
|
79
97
|
require 'one_msg_sdk/models/send_location_request_request'
|
|
80
98
|
require 'one_msg_sdk/models/send_message_request'
|
|
99
|
+
require 'one_msg_sdk/models/send_message_request_direct_send'
|
|
81
100
|
require 'one_msg_sdk/models/send_order_details_request'
|
|
82
101
|
require 'one_msg_sdk/models/send_order_details_request_language'
|
|
83
102
|
require 'one_msg_sdk/models/send_order_details_request_order'
|
|
84
103
|
require 'one_msg_sdk/models/send_order_details_request_order_items_inner'
|
|
85
104
|
require 'one_msg_sdk/models/send_order_details_request_order_items_inner_amount'
|
|
86
105
|
require 'one_msg_sdk/models/send_payment_request_request'
|
|
106
|
+
require 'one_msg_sdk/models/send_product_request'
|
|
87
107
|
require 'one_msg_sdk/models/send_reaction_request'
|
|
88
108
|
require 'one_msg_sdk/models/send_sticker_request'
|
|
89
109
|
require 'one_msg_sdk/models/send_template_request'
|
|
90
110
|
require 'one_msg_sdk/models/send_template_request_language'
|
|
111
|
+
require 'one_msg_sdk/models/set_webhook200_response'
|
|
112
|
+
require 'one_msg_sdk/models/set_webhook200_response_webhook_url'
|
|
113
|
+
require 'one_msg_sdk/models/set_webhook_request'
|
|
114
|
+
require 'one_msg_sdk/models/set_webhook_request_webhook_url'
|
|
91
115
|
require 'one_msg_sdk/models/set_whatsapp_business_encryption_request'
|
|
92
116
|
require 'one_msg_sdk/models/success_response'
|
|
93
117
|
require 'one_msg_sdk/models/update_calling_settings200_response'
|
|
94
118
|
require 'one_msg_sdk/models/update_calling_settings200_response_response'
|
|
119
|
+
require 'one_msg_sdk/models/update_me200_response'
|
|
95
120
|
require 'one_msg_sdk/models/update_me_request'
|
|
121
|
+
require 'one_msg_sdk/models/webhook_url_status'
|
|
96
122
|
|
|
97
123
|
# APIs
|
|
98
124
|
require 'one_msg_sdk/api/calling_api'
|
|
@@ -123,3 +149,5 @@ module OneMsgSdk
|
|
|
123
149
|
end
|
|
124
150
|
end
|
|
125
151
|
end
|
|
152
|
+
|
|
153
|
+
require 'one_msg_sdk/platform_client'
|
data/one_msg_sdk.gemspec
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
=begin
|
|
4
4
|
#1MSG WhatsApp Business API (Public)
|
|
5
5
|
|
|
6
|
-
#Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:**
|
|
6
|
+
#Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:** Pass the channel token in **one** place. The API checks JSON body (`token`), then query string (`?token=`), then `Authorization: Bearer` header (preferred in production). **Documentation:** https://help.1msg.io/platform-1msg/getting-start/quick-start **API Docs:** https://docs.1msg.io/
|
|
7
7
|
|
|
8
|
-
The version of the OpenAPI document:
|
|
8
|
+
The version of the OpenAPI document: 2.0.0
|
|
9
9
|
Contact: support@1msg.io
|
|
10
10
|
Generated by: https://openapi-generator.tech
|
|
11
11
|
Generator version: 7.22.0
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#1MSG WhatsApp Business API (Public)
|
|
3
3
|
|
|
4
|
-
#Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:**
|
|
4
|
+
#Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:** Pass the channel token in **one** place. The API checks JSON body (`token`), then query string (`?token=`), then `Authorization: Bearer` header (preferred in production). **Documentation:** https://help.1msg.io/platform-1msg/getting-start/quick-start **API Docs:** https://docs.1msg.io/
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document:
|
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
|
7
7
|
Contact: support@1msg.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.22.0
|
|
@@ -46,7 +46,7 @@ describe 'CallingApi' do
|
|
|
46
46
|
|
|
47
47
|
# unit tests for initiate_call
|
|
48
48
|
# Call action (connect / pre_accept / accept / reject / terminate)
|
|
49
|
-
# Perform a WhatsApp Calling action (beta). Proxies upstream `POST /calling/calls`. Despite the historical path name `/initiateCall`, this endpoint handles **all** call actions: | action | Use | Required | |--------|-----|----------| | `connect` | Outbound business → user | `to` + `session` (`sdp_type: offer`) | | `pre_accept` | Inbound (optional, reduces audio clipping) | `call_id` + `session` (`sdp_type: answer`) | | `accept` | Inbound answer | `call_id` + `session` (`sdp_type: answer`) | | `reject` | Decline inbound | `call_id` | | `terminate` | Hang up | `call_id` | **SDP / media (critical)** - `accept` / `pre_accept` require a **WebRTC-generated SDP answer**. - Do **not** send Meta's offer SDP back as the answer. - Postman (or curl) alone **cannot** establish real media — you need a WebRTC or SIP stack. 1msg only proxies signaling. Answer within ~**30–60 seconds** of an inbound `connect` webhook or Meta terminates as unanswered. Common Meta errors include Calling not enabled (`138000`), no permission (`138006`), SDP validation failures. **Outbound** requires a prior Call Permission Request (CPR) acceptance. See the **Calling** tag overview for the full outbound flow and CPR limits. Trial / `subscriptionBlocked` → **403** plain text. Upstream failures often return HTTP 200 with `{ \"response\": { \"error\": \"
|
|
49
|
+
# Perform a WhatsApp Calling action (beta). Proxies upstream `POST /calling/calls`. Despite the historical path name `/initiateCall`, this endpoint handles **all** call actions: | action | Use | Required | |--------|-----|----------| | `connect` | Outbound business → user | `to` + `session` (`sdp_type: offer`) | | `pre_accept` | Inbound (optional, reduces audio clipping) | `call_id` + `session` (`sdp_type: answer`) | | `accept` | Inbound answer | `call_id` + `session` (`sdp_type: answer`) | | `reject` | Decline inbound | `call_id` | | `terminate` | Hang up | `call_id` | **SDP / media (critical)** - `accept` / `pre_accept` require a **WebRTC-generated SDP answer**. - Do **not** send Meta's offer SDP back as the answer. - Postman (or curl) alone **cannot** establish real media — you need a WebRTC or SIP stack. 1msg only proxies signaling. Answer within ~**30–60 seconds** of an inbound `connect` webhook or Meta terminates as unanswered. Common Meta errors include Calling not enabled (`138000`), no permission (`138006`), SDP validation failures. **Outbound** requires a prior Call Permission Request (CPR) acceptance. See the **Calling** tag overview for the full outbound flow and CPR limits. Trial / `subscriptionBlocked` → **403** plain text. Upstream failures often return HTTP 200 with `{ \"response\": { \"error\": \"<upstream message>\" } }`. `Invalid API KEY` is used only when Meta/360 body actually indicates an invalid API key or token. Other upstream 401s (notably call permission `138006`) pass through `error.message` / `error_user_msg`.
|
|
50
50
|
# @param token JWT token or API key for authorization
|
|
51
51
|
# @param initiate_call_request
|
|
52
52
|
# @param [Hash] opts the optional parameters
|