rcs 2.0.0.pre.rc.4 → 2.0.0
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/rcs/brands/client.rb +36 -24
- data/lib/rcs/campaigns/dlc/client.rb +44 -34
- data/lib/rcs/campaigns/rcs/client.rb +26 -22
- data/lib/rcs/campaigns/rcs/types/rcs_autofill_response.rb +6 -6
- data/lib/rcs/campaigns/rcs/types/upsert_rcs_agent.rb +4 -4
- data/lib/rcs/campaigns/toll_free/client.rb +32 -26
- data/lib/rcs/campaigns/toll_free/types/toll_free_autofill_response.rb +6 -6
- data/lib/rcs/contacts/client.rb +10 -8
- data/lib/rcs/conversations/client.rb +142 -14
- data/lib/rcs/conversations/types/conversations_list_messages_request_direction.rb +12 -0
- data/lib/rcs/conversations/types/conversations_list_messages_request_sort_order.rb +12 -0
- data/lib/rcs/conversations/types/conversations_list_messages_request_status.rb +17 -0
- data/lib/rcs/conversations/types/conversations_list_messages_request_type.rb +13 -0
- data/lib/rcs/messages/client.rb +12 -29
- data/lib/rcs/messages/mms/client.rb +2 -2
- data/lib/rcs/messages/rcs/client.rb +1 -1
- data/lib/rcs/messages/sms/client.rb +2 -2
- data/lib/rcs/phone_numbers/campaign/client.rb +20 -6
- data/lib/rcs/phone_numbers/client.rb +0 -14
- data/lib/rcs/phone_numbers/webhook/client.rb +12 -10
- data/lib/rcs/rcs/client.rb +330 -0
- data/lib/rcs/status/get/client.rb +34 -18
- data/lib/rcs/tools/contact_card/client.rb +18 -8
- data/lib/rcs/tools/file/client.rb +92 -2
- data/lib/rcs/tools/file/types/upload_file_options.rb +21 -3
- data/lib/rcs/tools/url/client.rb +4 -2
- data/lib/rcs/types/attach_webhook_by_id_params.rb +5 -5
- data/lib/rcs/types/attach_webhook_response_webhook.rb +5 -3
- data/lib/rcs/types/autofill_campaign_params.rb +15 -3
- data/lib/rcs/types/autofill_dlc_campaign_response.rb +10 -6
- data/lib/rcs/types/autofill_dlc_response_keywords.rb +8 -10
- data/lib/rcs/types/autofill_dlc_response_keywords_help.rb +3 -3
- data/lib/rcs/types/autofill_dlc_response_keywords_opt_in.rb +6 -4
- data/lib/rcs/types/autofill_dlc_response_keywords_opt_out.rb +3 -3
- data/lib/rcs/types/autofill_dlc_response_options.rb +12 -12
- data/lib/rcs/types/brand_status.rb +5 -3
- data/lib/rcs/types/{inbound_button.rb → button_clicked.rb} +7 -7
- data/lib/rcs/types/button_clicked_data.rb +80 -0
- data/lib/rcs/types/button_clicked_data_button.rb +118 -0
- data/lib/rcs/types/{click_action_data.rb → button_clicked_data_button_raw.rb} +10 -8
- data/lib/rcs/types/button_clicked_data_button_type.rb +15 -0
- data/lib/rcs/types/campaign_query.rb +10 -2
- data/lib/rcs/types/contact.rb +5 -3
- data/lib/rcs/types/contact_id.rb +5 -3
- data/lib/rcs/types/conversation.rb +16 -8
- data/lib/rcs/types/conversation_by_id_params.rb +7 -3
- data/lib/rcs/types/conversation_contact.rb +5 -3
- data/lib/rcs/types/create_url_options.rb +4 -2
- data/lib/rcs/types/detached_webhook_info.rb +5 -3
- data/lib/rcs/types/dlc_campaign_status.rb +7 -5
- data/lib/rcs/types/dlc_campaign_with_extended_brand_and_status.rb +21 -19
- data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords_help.rb +3 -3
- data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords_opt_in.rb +6 -4
- data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords_opt_out.rb +6 -4
- data/lib/rcs/types/extended_brand.rb +25 -13
- data/lib/rcs/types/extended_brand_with_vetting.rb +25 -13
- data/lib/rcs/types/extended_rcs_campaign.rb +25 -14
- data/lib/rcs/types/get_dlc_campaign_status_response_updates.rb +1 -1
- data/lib/rcs/types/link_click_event.rb +1 -17
- data/lib/rcs/types/message.rb +5 -3
- data/lib/rcs/types/message_content.rb +4 -4
- data/lib/rcs/types/message_event.rb +143 -0
- data/lib/rcs/types/message_event_content.rb +127 -0
- data/lib/rcs/types/message_event_conversation.rb +82 -0
- data/lib/rcs/types/message_event_direction.rb +11 -0
- data/lib/rcs/types/message_event_mms_content.rb +94 -0
- data/lib/rcs/types/message_event_rcs_button_data.rb +104 -0
- data/lib/rcs/types/message_event_rcs_cards_content.rb +99 -0
- data/lib/rcs/types/message_event_rcs_cards_content_cards_item.rb +94 -0
- data/lib/rcs/types/message_event_rcs_location_data.rb +91 -0
- data/lib/rcs/types/message_event_rcs_media_content.rb +94 -0
- data/lib/rcs/types/message_event_rcs_text_content.rb +92 -0
- data/lib/rcs/types/message_event_sms_content.rb +81 -0
- data/lib/rcs/types/message_list.rb +79 -0
- data/lib/rcs/types/message_schedule.rb +4 -5
- data/lib/rcs/types/message_with_reaction.rb +197 -0
- data/lib/rcs/types/message_with_reaction_direction.rb +11 -0
- data/lib/rcs/types/not_found_error_body.rb +59 -0
- data/lib/rcs/types/phone_number_campaign_attach_phone_numbers_item_campaign.rb +7 -3
- data/lib/rcs/types/phone_number_campaign_detach_phone_numbers_item_campaign.rb +7 -3
- data/lib/rcs/types/pinnacle_file_upload_metadata.rb +18 -2
- data/lib/rcs/types/profile_status_enum.rb +4 -4
- data/lib/rcs/types/rcs_base_options.rb +12 -1
- data/lib/rcs/types/rcs_button_call.rb +11 -2
- data/lib/rcs/types/rcs_button_open_url.rb +11 -2
- data/lib/rcs/types/rcs_button_request_user_location.rb +15 -3
- data/lib/rcs/types/rcs_button_schedule_event.rb +9 -1
- data/lib/rcs/types/rcs_button_send_location.rb +11 -2
- data/lib/rcs/types/rcs_button_trigger.rb +8 -6
- data/lib/rcs/types/rcs_campaign.rb +3 -3
- data/lib/rcs/types/rcs_campaign_schema_agent.rb +4 -4
- data/lib/rcs/types/rcs_campaign_schema_extra_agent.rb +12 -12
- data/lib/rcs/types/rcs_campaign_status.rb +5 -3
- data/lib/rcs/types/rcs_capabilities_result.rb +7 -0
- data/lib/rcs/types/rcs_capability.rb +82 -0
- data/lib/rcs/types/rcs_capability_actions.rb +105 -0
- data/lib/rcs/types/rcs_capability_cards.rb +67 -0
- data/lib/rcs/types/rcs_link_result.rb +75 -0
- data/lib/rcs/types/rcs_validate_content_media.rb +17 -3
- data/lib/rcs/types/rcs_whitelist_response.rb +58 -0
- data/lib/rcs/types/reaction_result.rb +10 -6
- data/lib/rcs/types/refreshed_file.rb +67 -0
- data/lib/rcs/types/{rcs.rb → rich_message.rb} +3 -3
- data/lib/rcs/types/scheduled_messaage.rb +5 -3
- data/lib/rcs/types/sent_mms_details.rb +4 -2
- data/lib/rcs/types/sent_rcs_details.rb +12 -13
- data/lib/rcs/types/sent_sms_details.rb +5 -3
- data/lib/rcs/types/toll_free_campaign.rb +3 -3
- data/lib/rcs/types/toll_free_campaign_status.rb +5 -3
- data/lib/rcs/types/toll_free_campaign_with_extended_brand_and_status.rb +3 -5
- data/lib/rcs/types/updated_contact_id.rb +5 -3
- data/lib/rcs/types/user_event.rb +83 -0
- data/lib/rcs/types/user_event_conversation.rb +78 -0
- data/lib/rcs/types/v_card_data.rb +5 -3
- data/lib/rcs/types/validate_campaign_params.rb +15 -3
- data/lib/rcs/types/vcard.rb +5 -3
- data/lib/rcs/types/vcard_content.rb +5 -3
- data/lib/rcs/types/vcard_resource.rb +5 -3
- data/lib/rcs/types/webhook_event_enum.rb +1 -0
- data/lib/rcs/types/webhooks.rb +5 -3
- data/lib/rcs.rb +7 -0
- data/lib/requests.rb +2 -2
- data/lib/types_export.rb +35 -5
- metadata +40 -9
- data/lib/rcs/types/click_action.rb +0 -73
- data/lib/rcs/types/click_action_data_metadata.rb +0 -69
data/lib/rcs/messages/client.rb
CHANGED
|
@@ -4,34 +4,23 @@ require_relative "../../requests"
|
|
|
4
4
|
require_relative "../types/message"
|
|
5
5
|
require_relative "types/react_message_options"
|
|
6
6
|
require_relative "../types/reaction_result"
|
|
7
|
-
require_relative "sms/client"
|
|
8
|
-
require_relative "mms/client"
|
|
9
|
-
require_relative "rcs/client"
|
|
10
7
|
require "async"
|
|
11
8
|
|
|
12
9
|
module Pinnacle
|
|
13
10
|
class MessagesClient
|
|
14
11
|
# @return [Pinnacle::RequestClient]
|
|
15
12
|
attr_reader :request_client
|
|
16
|
-
# @return [Pinnacle::Messages::SmsClient]
|
|
17
|
-
attr_reader :sms
|
|
18
|
-
# @return [Pinnacle::Messages::MmsClient]
|
|
19
|
-
attr_reader :mms
|
|
20
|
-
# @return [Pinnacle::Messages::RcsClient]
|
|
21
|
-
attr_reader :rcs
|
|
22
13
|
|
|
23
14
|
# @param request_client [Pinnacle::RequestClient]
|
|
24
15
|
# @return [Pinnacle::MessagesClient]
|
|
25
16
|
def initialize(request_client:)
|
|
26
17
|
@request_client = request_client
|
|
27
|
-
@sms = Pinnacle::Messages::SmsClient.new(request_client: request_client)
|
|
28
|
-
@mms = Pinnacle::Messages::MmsClient.new(request_client: request_client)
|
|
29
|
-
@rcs = Pinnacle::Messages::RcsClient.new(request_client: request_client)
|
|
30
18
|
end
|
|
31
19
|
|
|
32
20
|
# Retrieve a previously sent message.
|
|
33
21
|
#
|
|
34
|
-
# @param id [
|
|
22
|
+
# @param id [String] Unique identifier of the message. This identifier is a string that always begins
|
|
23
|
+
# with the prefix `msg_`, for example: `msg_1234567890`.
|
|
35
24
|
# @param request_options [Pinnacle::RequestOptions]
|
|
36
25
|
# @return [Pinnacle::Types::Message]
|
|
37
26
|
# @example
|
|
@@ -40,7 +29,7 @@ module Pinnacle
|
|
|
40
29
|
# environment: Pinnacle::Environment::DEFAULT,
|
|
41
30
|
# api_key: "YOUR_API_KEY"
|
|
42
31
|
# )
|
|
43
|
-
# api.messages.get(id:
|
|
32
|
+
# api.messages.get(id: "msg_1234567890")
|
|
44
33
|
def get(id:, request_options: nil)
|
|
45
34
|
response = @request_client.conn.get do |req|
|
|
46
35
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
@@ -63,7 +52,8 @@ module Pinnacle
|
|
|
63
52
|
|
|
64
53
|
# Add or remove an emoji reaction to a previously sent message.
|
|
65
54
|
#
|
|
66
|
-
# @param message_id [
|
|
55
|
+
# @param message_id [String] Unique identifier of the message. This identifier is a string that always begins
|
|
56
|
+
# with the prefix `msg_`, for example: `msg_1234567890`.
|
|
67
57
|
# @param options [Hash] Request of type Pinnacle::Messages::Types::ReactMessageOptions, as a Hash
|
|
68
58
|
# * :force (Boolean)
|
|
69
59
|
# @param reaction [String] Unicode emoji to add. <br>
|
|
@@ -77,7 +67,7 @@ module Pinnacle
|
|
|
77
67
|
# api_key: "YOUR_API_KEY"
|
|
78
68
|
# )
|
|
79
69
|
# api.messages.react(
|
|
80
|
-
# message_id:
|
|
70
|
+
# message_id: "msg_1234567890",
|
|
81
71
|
# options: { force: true },
|
|
82
72
|
# reaction: "👍"
|
|
83
73
|
# )
|
|
@@ -108,25 +98,17 @@ module Pinnacle
|
|
|
108
98
|
class AsyncMessagesClient
|
|
109
99
|
# @return [Pinnacle::AsyncRequestClient]
|
|
110
100
|
attr_reader :request_client
|
|
111
|
-
# @return [Pinnacle::Messages::AsyncSmsClient]
|
|
112
|
-
attr_reader :sms
|
|
113
|
-
# @return [Pinnacle::Messages::AsyncMmsClient]
|
|
114
|
-
attr_reader :mms
|
|
115
|
-
# @return [Pinnacle::Messages::AsyncRcsClient]
|
|
116
|
-
attr_reader :rcs
|
|
117
101
|
|
|
118
102
|
# @param request_client [Pinnacle::AsyncRequestClient]
|
|
119
103
|
# @return [Pinnacle::AsyncMessagesClient]
|
|
120
104
|
def initialize(request_client:)
|
|
121
105
|
@request_client = request_client
|
|
122
|
-
@sms = Pinnacle::Messages::AsyncSmsClient.new(request_client: request_client)
|
|
123
|
-
@mms = Pinnacle::Messages::AsyncMmsClient.new(request_client: request_client)
|
|
124
|
-
@rcs = Pinnacle::Messages::AsyncRcsClient.new(request_client: request_client)
|
|
125
106
|
end
|
|
126
107
|
|
|
127
108
|
# Retrieve a previously sent message.
|
|
128
109
|
#
|
|
129
|
-
# @param id [
|
|
110
|
+
# @param id [String] Unique identifier of the message. This identifier is a string that always begins
|
|
111
|
+
# with the prefix `msg_`, for example: `msg_1234567890`.
|
|
130
112
|
# @param request_options [Pinnacle::RequestOptions]
|
|
131
113
|
# @return [Pinnacle::Types::Message]
|
|
132
114
|
# @example
|
|
@@ -135,7 +117,7 @@ module Pinnacle
|
|
|
135
117
|
# environment: Pinnacle::Environment::DEFAULT,
|
|
136
118
|
# api_key: "YOUR_API_KEY"
|
|
137
119
|
# )
|
|
138
|
-
# api.messages.get(id:
|
|
120
|
+
# api.messages.get(id: "msg_1234567890")
|
|
139
121
|
def get(id:, request_options: nil)
|
|
140
122
|
Async do
|
|
141
123
|
response = @request_client.conn.get do |req|
|
|
@@ -160,7 +142,8 @@ module Pinnacle
|
|
|
160
142
|
|
|
161
143
|
# Add or remove an emoji reaction to a previously sent message.
|
|
162
144
|
#
|
|
163
|
-
# @param message_id [
|
|
145
|
+
# @param message_id [String] Unique identifier of the message. This identifier is a string that always begins
|
|
146
|
+
# with the prefix `msg_`, for example: `msg_1234567890`.
|
|
164
147
|
# @param options [Hash] Request of type Pinnacle::Messages::Types::ReactMessageOptions, as a Hash
|
|
165
148
|
# * :force (Boolean)
|
|
166
149
|
# @param reaction [String] Unicode emoji to add. <br>
|
|
@@ -174,7 +157,7 @@ module Pinnacle
|
|
|
174
157
|
# api_key: "YOUR_API_KEY"
|
|
175
158
|
# )
|
|
176
159
|
# api.messages.react(
|
|
177
|
-
# message_id:
|
|
160
|
+
# message_id: "msg_1234567890",
|
|
178
161
|
# options: { force: true },
|
|
179
162
|
# reaction: "👍"
|
|
180
163
|
# )
|
|
@@ -28,7 +28,7 @@ module Pinnacle
|
|
|
28
28
|
# @param options [Hash] Control how your MMS is processed and delivered.Request of type Pinnacle::Messages::Mms::Types::SendMmsOptions, as a Hash
|
|
29
29
|
# * :multiple_messages (Boolean)
|
|
30
30
|
# * :schedule (Hash)
|
|
31
|
-
# * :end_date (
|
|
31
|
+
# * :end_date (String)
|
|
32
32
|
# * :recurrence (String)
|
|
33
33
|
# * :send_at (String)
|
|
34
34
|
# * :timezone (String)
|
|
@@ -128,7 +128,7 @@ module Pinnacle
|
|
|
128
128
|
# @param options [Hash] Control how your MMS is processed and delivered.Request of type Pinnacle::Messages::Mms::Types::SendMmsOptions, as a Hash
|
|
129
129
|
# * :multiple_messages (Boolean)
|
|
130
130
|
# * :schedule (Hash)
|
|
131
|
-
# * :end_date (
|
|
131
|
+
# * :end_date (String)
|
|
132
132
|
# * :recurrence (String)
|
|
133
133
|
# * :send_at (String)
|
|
134
134
|
# * :timezone (String)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "../../../requests"
|
|
4
|
-
require_relative "../../types/
|
|
4
|
+
require_relative "../../types/rich_message"
|
|
5
5
|
require_relative "types/rcs_send_response"
|
|
6
6
|
require_relative "../../types/rcs_validate_content"
|
|
7
7
|
require_relative "../../types/rcs_validation_result"
|
|
@@ -24,7 +24,7 @@ module Pinnacle
|
|
|
24
24
|
# @param from [String] Phone number that sends the message in E.164 format.
|
|
25
25
|
# @param options [Hash] Additional settings to customize SMS delivery.Request of type Pinnacle::Messages::Sms::Types::SendSmsOptions, as a Hash
|
|
26
26
|
# * :schedule (Hash)
|
|
27
|
-
# * :end_date (
|
|
27
|
+
# * :end_date (String)
|
|
28
28
|
# * :recurrence (String)
|
|
29
29
|
# * :send_at (String)
|
|
30
30
|
# * :timezone (String)
|
|
@@ -115,7 +115,7 @@ module Pinnacle
|
|
|
115
115
|
# @param from [String] Phone number that sends the message in E.164 format.
|
|
116
116
|
# @param options [Hash] Additional settings to customize SMS delivery.Request of type Pinnacle::Messages::Sms::Types::SendSmsOptions, as a Hash
|
|
117
117
|
# * :schedule (Hash)
|
|
118
|
-
# * :end_date (
|
|
118
|
+
# * :end_date (String)
|
|
119
119
|
# * :recurrence (String)
|
|
120
120
|
# * :send_at (String)
|
|
121
121
|
# * :timezone (String)
|
|
@@ -18,11 +18,18 @@ module Pinnacle
|
|
|
18
18
|
@request_client = request_client
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
# Link a phone number to a specific campaign.
|
|
21
|
+
# Link a phone number to a specific campaign. Phone numbers must be linked to a
|
|
22
|
+
# campaign to send messages.
|
|
22
23
|
#
|
|
23
24
|
# @param phones [Array<String>] List of phone number (E.164 format).
|
|
24
25
|
# @param campaign_type [Pinnacle::Types::MessagingProfileEnum]
|
|
25
|
-
# @param campaign_id [
|
|
26
|
+
# @param campaign_id [String] Unique identifier for the campaign. <br>
|
|
27
|
+
# - **TOLL_FREE** campaigns:
|
|
28
|
+
# - Must begin with the prefix `tf_`
|
|
29
|
+
# - Example: `tf_1234567890`
|
|
30
|
+
# - **10DLC** campaigns:
|
|
31
|
+
# - Must begin with the prefix `dlc_`
|
|
32
|
+
# - Example: `dlc_1234567890`
|
|
26
33
|
# @param request_options [Pinnacle::RequestOptions]
|
|
27
34
|
# @return [Pinnacle::Types::AttachedPhoneNumberResult]
|
|
28
35
|
# @example
|
|
@@ -34,7 +41,7 @@ module Pinnacle
|
|
|
34
41
|
# api.phone_numbers.campaign.attach(
|
|
35
42
|
# phones: ["+14155550123", "+14155559876", "+14155550111"],
|
|
36
43
|
# campaign_type: TOLL_FREE,
|
|
37
|
-
# campaign_id:
|
|
44
|
+
# campaign_id: "tf_1234567890"
|
|
38
45
|
# )
|
|
39
46
|
def attach(phones:, campaign_type:, campaign_id:, request_options: nil)
|
|
40
47
|
response = @request_client.conn.post do |req|
|
|
@@ -100,11 +107,18 @@ module Pinnacle
|
|
|
100
107
|
@request_client = request_client
|
|
101
108
|
end
|
|
102
109
|
|
|
103
|
-
# Link a phone number to a specific campaign.
|
|
110
|
+
# Link a phone number to a specific campaign. Phone numbers must be linked to a
|
|
111
|
+
# campaign to send messages.
|
|
104
112
|
#
|
|
105
113
|
# @param phones [Array<String>] List of phone number (E.164 format).
|
|
106
114
|
# @param campaign_type [Pinnacle::Types::MessagingProfileEnum]
|
|
107
|
-
# @param campaign_id [
|
|
115
|
+
# @param campaign_id [String] Unique identifier for the campaign. <br>
|
|
116
|
+
# - **TOLL_FREE** campaigns:
|
|
117
|
+
# - Must begin with the prefix `tf_`
|
|
118
|
+
# - Example: `tf_1234567890`
|
|
119
|
+
# - **10DLC** campaigns:
|
|
120
|
+
# - Must begin with the prefix `dlc_`
|
|
121
|
+
# - Example: `dlc_1234567890`
|
|
108
122
|
# @param request_options [Pinnacle::RequestOptions]
|
|
109
123
|
# @return [Pinnacle::Types::AttachedPhoneNumberResult]
|
|
110
124
|
# @example
|
|
@@ -116,7 +130,7 @@ module Pinnacle
|
|
|
116
130
|
# api.phone_numbers.campaign.attach(
|
|
117
131
|
# phones: ["+14155550123", "+14155559876", "+14155550111"],
|
|
118
132
|
# campaign_type: TOLL_FREE,
|
|
119
|
-
# campaign_id:
|
|
133
|
+
# campaign_id: "tf_1234567890"
|
|
120
134
|
# )
|
|
121
135
|
def attach(phones:, campaign_type:, campaign_id:, request_options: nil)
|
|
122
136
|
Async do
|
|
@@ -12,25 +12,17 @@ require_relative "../types/purchased_number"
|
|
|
12
12
|
require_relative "types/phone_details_schema_level"
|
|
13
13
|
require_relative "types/retrieve_phone_number_details_options"
|
|
14
14
|
require_relative "types/phone_numbers_get_response"
|
|
15
|
-
require_relative "campaign/client"
|
|
16
|
-
require_relative "webhook/client"
|
|
17
15
|
require "async"
|
|
18
16
|
|
|
19
17
|
module Pinnacle
|
|
20
18
|
class PhoneNumbersClient
|
|
21
19
|
# @return [Pinnacle::RequestClient]
|
|
22
20
|
attr_reader :request_client
|
|
23
|
-
# @return [Pinnacle::PhoneNumbers::CampaignClient]
|
|
24
|
-
attr_reader :campaign
|
|
25
|
-
# @return [Pinnacle::PhoneNumbers::WebhookClient]
|
|
26
|
-
attr_reader :webhook
|
|
27
21
|
|
|
28
22
|
# @param request_client [Pinnacle::RequestClient]
|
|
29
23
|
# @return [Pinnacle::PhoneNumbersClient]
|
|
30
24
|
def initialize(request_client:)
|
|
31
25
|
@request_client = request_client
|
|
32
|
-
@campaign = Pinnacle::PhoneNumbers::CampaignClient.new(request_client: request_client)
|
|
33
|
-
@webhook = Pinnacle::PhoneNumbers::WebhookClient.new(request_client: request_client)
|
|
34
26
|
end
|
|
35
27
|
|
|
36
28
|
# Search for available phone numbers that match your exact criteria.
|
|
@@ -187,17 +179,11 @@ module Pinnacle
|
|
|
187
179
|
class AsyncPhoneNumbersClient
|
|
188
180
|
# @return [Pinnacle::AsyncRequestClient]
|
|
189
181
|
attr_reader :request_client
|
|
190
|
-
# @return [Pinnacle::PhoneNumbers::AsyncCampaignClient]
|
|
191
|
-
attr_reader :campaign
|
|
192
|
-
# @return [Pinnacle::PhoneNumbers::AsyncWebhookClient]
|
|
193
|
-
attr_reader :webhook
|
|
194
182
|
|
|
195
183
|
# @param request_client [Pinnacle::AsyncRequestClient]
|
|
196
184
|
# @return [Pinnacle::AsyncPhoneNumbersClient]
|
|
197
185
|
def initialize(request_client:)
|
|
198
186
|
@request_client = request_client
|
|
199
|
-
@campaign = Pinnacle::PhoneNumbers::AsyncCampaignClient.new(request_client: request_client)
|
|
200
|
-
@webhook = Pinnacle::PhoneNumbers::AsyncWebhookClient.new(request_client: request_client)
|
|
201
187
|
end
|
|
202
188
|
|
|
203
189
|
# Search for available phone numbers that match your exact criteria.
|
|
@@ -24,7 +24,7 @@ module Pinnacle
|
|
|
24
24
|
# @param phone [String] The phone number you want to attach the webhook to in E.164 format. Make sure it
|
|
25
25
|
# is url encoded (i.e. replace the leading + with %2B). <br>
|
|
26
26
|
# Must be a phone number that you own and have already [purchased](./buy) through
|
|
27
|
-
# the API.
|
|
27
|
+
# the API. A phone number can have multiple webhooks attached to it.
|
|
28
28
|
# @param request [Pinnacle::Types::AttachWebhookByIdParams, Pinnacle::Types::CreateAndAttachWebhookByUrlParams]
|
|
29
29
|
# @param request_options [Pinnacle::RequestOptions]
|
|
30
30
|
# @return [Pinnacle::Types::ConfiguredWebhook]
|
|
@@ -34,7 +34,7 @@ module Pinnacle
|
|
|
34
34
|
# environment: Pinnacle::Environment::DEFAULT,
|
|
35
35
|
# api_key: "YOUR_API_KEY"
|
|
36
36
|
# )
|
|
37
|
-
# api.phone_numbers.webhook.attach(phone: "%2B14155551234", request: { webhook_id:
|
|
37
|
+
# api.phone_numbers.webhook.attach(phone: "%2B14155551234", request: { webhook_id: "wh_1234567890", event: MESSAGE_STATUS })
|
|
38
38
|
def attach(phone:, request:, request_options: nil)
|
|
39
39
|
response = @request_client.conn.post do |req|
|
|
40
40
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
@@ -62,10 +62,11 @@ module Pinnacle
|
|
|
62
62
|
# is url encoded (i.e. replace the leading + with %2B). <br>
|
|
63
63
|
# Must be a phone number that you own and currently has the specified webhook
|
|
64
64
|
# attached.
|
|
65
|
-
# @param webhook_id [
|
|
65
|
+
# @param webhook_id [String] The unique identifier of the webhook you want to detach from the phone number.
|
|
66
66
|
# <br>
|
|
67
67
|
# This must be a valid webhook ID that is currently attached to the specified
|
|
68
|
-
# phone number.
|
|
68
|
+
# phone number. This identifier is a string that always begins with the prefix
|
|
69
|
+
# `wh_`, for example: `wh_1234567890`.
|
|
69
70
|
# @param request_options [Pinnacle::RequestOptions]
|
|
70
71
|
# @return [Pinnacle::Types::DetachedWebhookInfo]
|
|
71
72
|
# @example
|
|
@@ -74,7 +75,7 @@ module Pinnacle
|
|
|
74
75
|
# environment: Pinnacle::Environment::DEFAULT,
|
|
75
76
|
# api_key: "YOUR_API_KEY"
|
|
76
77
|
# )
|
|
77
|
-
# api.phone_numbers.webhook.detach(phone: "+14155551234", webhook_id:
|
|
78
|
+
# api.phone_numbers.webhook.detach(phone: "+14155551234", webhook_id: "wh_1234567890")
|
|
78
79
|
def detach(phone:, webhook_id:, request_options: nil)
|
|
79
80
|
response = @request_client.conn.delete do |req|
|
|
80
81
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
@@ -112,7 +113,7 @@ module Pinnacle
|
|
|
112
113
|
# @param phone [String] The phone number you want to attach the webhook to in E.164 format. Make sure it
|
|
113
114
|
# is url encoded (i.e. replace the leading + with %2B). <br>
|
|
114
115
|
# Must be a phone number that you own and have already [purchased](./buy) through
|
|
115
|
-
# the API.
|
|
116
|
+
# the API. A phone number can have multiple webhooks attached to it.
|
|
116
117
|
# @param request [Pinnacle::Types::AttachWebhookByIdParams, Pinnacle::Types::CreateAndAttachWebhookByUrlParams]
|
|
117
118
|
# @param request_options [Pinnacle::RequestOptions]
|
|
118
119
|
# @return [Pinnacle::Types::ConfiguredWebhook]
|
|
@@ -122,7 +123,7 @@ module Pinnacle
|
|
|
122
123
|
# environment: Pinnacle::Environment::DEFAULT,
|
|
123
124
|
# api_key: "YOUR_API_KEY"
|
|
124
125
|
# )
|
|
125
|
-
# api.phone_numbers.webhook.attach(phone: "%2B14155551234", request: { webhook_id:
|
|
126
|
+
# api.phone_numbers.webhook.attach(phone: "%2B14155551234", request: { webhook_id: "wh_1234567890", event: MESSAGE_STATUS })
|
|
126
127
|
def attach(phone:, request:, request_options: nil)
|
|
127
128
|
Async do
|
|
128
129
|
response = @request_client.conn.post do |req|
|
|
@@ -152,10 +153,11 @@ module Pinnacle
|
|
|
152
153
|
# is url encoded (i.e. replace the leading + with %2B). <br>
|
|
153
154
|
# Must be a phone number that you own and currently has the specified webhook
|
|
154
155
|
# attached.
|
|
155
|
-
# @param webhook_id [
|
|
156
|
+
# @param webhook_id [String] The unique identifier of the webhook you want to detach from the phone number.
|
|
156
157
|
# <br>
|
|
157
158
|
# This must be a valid webhook ID that is currently attached to the specified
|
|
158
|
-
# phone number.
|
|
159
|
+
# phone number. This identifier is a string that always begins with the prefix
|
|
160
|
+
# `wh_`, for example: `wh_1234567890`.
|
|
159
161
|
# @param request_options [Pinnacle::RequestOptions]
|
|
160
162
|
# @return [Pinnacle::Types::DetachedWebhookInfo]
|
|
161
163
|
# @example
|
|
@@ -164,7 +166,7 @@ module Pinnacle
|
|
|
164
166
|
# environment: Pinnacle::Environment::DEFAULT,
|
|
165
167
|
# api_key: "YOUR_API_KEY"
|
|
166
168
|
# )
|
|
167
|
-
# api.phone_numbers.webhook.detach(phone: "+14155551234", webhook_id:
|
|
169
|
+
# api.phone_numbers.webhook.detach(phone: "+14155551234", webhook_id: "wh_1234567890")
|
|
168
170
|
def detach(phone:, webhook_id:, request_options: nil)
|
|
169
171
|
Async do
|
|
170
172
|
response = @request_client.conn.delete do |req|
|