twilio-ruby 5.52.0 → 5.67.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.
Files changed (163) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/pr-lint.yml +15 -0
  3. data/.github/workflows/test-and-deploy.yml +129 -0
  4. data/.gitignore +5 -1
  5. data/.rubocop.yml +1 -1
  6. data/.rubocop_todo.yml +91 -28
  7. data/CHANGES.md +563 -0
  8. data/Gemfile +1 -0
  9. data/Makefile +8 -11
  10. data/README.md +13 -6
  11. data/examples/examples.rb +1 -1
  12. data/lib/rack/twilio_webhook_authentication.rb +25 -1
  13. data/lib/twilio-ruby/http/http_client.rb +20 -4
  14. data/lib/twilio-ruby/http.rb +5 -0
  15. data/lib/twilio-ruby/jwt/access_token.rb +13 -0
  16. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +23 -23
  17. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback_summary.rb +5 -5
  18. data/lib/twilio-ruby/rest/api/v2010/account/call/payment.rb +8 -8
  19. data/lib/twilio-ruby/rest/api/v2010/account/call/siprec.rb +674 -0
  20. data/lib/twilio-ruby/rest/api/v2010/account/call/stream.rb +674 -0
  21. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +68 -14
  22. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +12 -8
  23. data/lib/twilio-ruby/rest/api/v2010/account/conference/recording.rb +1 -1
  24. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +11 -4
  25. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +11 -4
  26. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +11 -4
  27. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +17 -10
  28. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +18 -5
  29. data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +34 -7
  30. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb +11 -11
  31. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb +11 -11
  32. data/lib/twilio-ruby/rest/bulkexports/v1/export/day.rb +0 -8
  33. data/lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb +0 -6
  34. data/lib/twilio-ruby/rest/bulkexports/v1/export/job.rb +0 -8
  35. data/lib/twilio-ruby/rest/bulkexports/v1/export.rb +0 -8
  36. data/lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb +0 -8
  37. data/lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb +10 -4
  38. data/lib/twilio-ruby/rest/chat/v3/channel.rb +275 -0
  39. data/lib/twilio-ruby/rest/chat/v3.rb +48 -0
  40. data/lib/twilio-ruby/rest/chat.rb +16 -0
  41. data/lib/twilio-ruby/rest/client.rb +21 -12
  42. data/lib/twilio-ruby/rest/conversations/v1/address_configuration.rb +454 -0
  43. data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +12 -5
  44. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +7 -0
  45. data/lib/twilio-ruby/rest/conversations/v1/participant_conversation.rb +312 -0
  46. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb +18 -2
  47. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb +269 -0
  48. data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +8 -0
  49. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +12 -5
  50. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +7 -0
  51. data/lib/twilio-ruby/rest/conversations/v1/service/participant_conversation.rb +324 -0
  52. data/lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb +466 -0
  53. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +44 -0
  54. data/lib/twilio-ruby/rest/conversations/v1/service.rb +23 -0
  55. data/lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb +442 -0
  56. data/lib/twilio-ruby/rest/conversations/v1/user.rb +35 -0
  57. data/lib/twilio-ruby/rest/conversations/v1.rb +24 -0
  58. data/lib/twilio-ruby/rest/conversations.rb +15 -0
  59. data/lib/twilio-ruby/rest/events/v1/event_type.rb +12 -5
  60. data/lib/twilio-ruby/rest/events/v1/sink.rb +41 -5
  61. data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +28 -0
  62. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +55 -34
  63. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.rb +236 -0
  64. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.rb +330 -0
  65. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb +384 -0
  66. data/lib/twilio-ruby/rest/flex_api/v1/interaction.rb +233 -0
  67. data/lib/twilio-ruby/rest/flex_api/v1.rb +16 -0
  68. data/lib/twilio-ruby/rest/flex_api.rb +9 -0
  69. data/lib/twilio-ruby/rest/frontline_api/v1/user.rb +258 -0
  70. data/lib/twilio-ruby/rest/{fax → frontline_api}/v1.rb +11 -11
  71. data/lib/twilio-ruby/rest/{fax.rb → frontline_api.rb} +11 -11
  72. data/lib/twilio-ruby/rest/insights/v1/annotation.rb +271 -0
  73. data/lib/twilio-ruby/rest/insights/v1/call_summaries.rb +434 -0
  74. data/lib/twilio-ruby/rest/insights/v1/conference/conference_participant.rb +474 -0
  75. data/lib/twilio-ruby/rest/insights/v1/conference.rb +512 -0
  76. data/lib/twilio-ruby/rest/insights/v1/setting.rb +215 -0
  77. data/lib/twilio-ruby/rest/insights/v1.rb +46 -0
  78. data/lib/twilio-ruby/rest/insights.rb +28 -0
  79. data/lib/twilio-ruby/rest/lookups/v2/phone_number.rb +268 -0
  80. data/lib/twilio-ruby/rest/lookups/v2.rb +45 -0
  81. data/lib/twilio-ruby/rest/lookups.rb +7 -0
  82. data/lib/twilio-ruby/rest/media/v1/media_processor.rb +397 -0
  83. data/lib/twilio-ruby/rest/media/v1/media_recording.rb +406 -0
  84. data/lib/twilio-ruby/rest/media/v1/player_streamer/playback_grant.rb +221 -0
  85. data/lib/twilio-ruby/rest/media/v1/player_streamer.rb +403 -0
  86. data/lib/twilio-ruby/rest/media/v1.rb +76 -0
  87. data/lib/twilio-ruby/rest/media.rb +65 -0
  88. data/lib/twilio-ruby/rest/{fax/v1/fax/fax_media.rb → messaging/v1/brand_registration/brand_vetting.rb} +134 -95
  89. data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +127 -2
  90. data/lib/twilio-ruby/rest/messaging/v1/external_campaign.rb +7 -0
  91. data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb +187 -20
  92. data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person_usecase.rb +6 -2
  93. data/lib/twilio-ruby/rest/messaging/v1/service.rb +37 -5
  94. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.rb +268 -0
  95. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/replace_items.rb +188 -0
  96. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +128 -26
  97. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +7 -0
  98. data/lib/twilio-ruby/rest/pricing/v2/country.rb +280 -0
  99. data/lib/twilio-ruby/rest/pricing/v2/number.rb +225 -0
  100. data/lib/twilio-ruby/rest/pricing/v2.rb +37 -0
  101. data/lib/twilio-ruby/rest/pricing.rb +19 -0
  102. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +1 -1
  103. data/lib/twilio-ruby/rest/serverless/v1/service.rb +7 -0
  104. data/lib/twilio-ruby/rest/studio/v1/flow/execution.rb +1 -1
  105. data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +1 -1
  106. data/lib/twilio-ruby/rest/supersim/v1/esim_profile.rb +372 -0
  107. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +44 -55
  108. data/lib/twilio-ruby/rest/supersim/v1/{command.rb → ip_command.rb} +132 -84
  109. data/lib/twilio-ruby/rest/supersim/v1/sim/billing_period.rb +231 -0
  110. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +30 -1
  111. data/lib/twilio-ruby/rest/supersim/v1/sms_command.rb +1 -1
  112. data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +23 -9
  113. data/lib/twilio-ruby/rest/supersim/v1.rb +23 -7
  114. data/lib/twilio-ruby/rest/supersim.rb +15 -6
  115. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +7 -0
  116. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +7 -3
  117. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.rb +6 -2
  118. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +7 -3
  119. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +23 -11
  120. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb +4 -2
  121. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb +4 -2
  122. data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +38 -22
  123. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +19 -3
  124. data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +155 -10
  125. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge/notification.rb +12 -9
  126. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +74 -22
  127. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +34 -15
  128. data/lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb +66 -31
  129. data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +7 -3
  130. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +25 -7
  131. data/lib/twilio-ruby/rest/verify/v2/service/webhook.rb +24 -5
  132. data/lib/twilio-ruby/rest/verify/v2/service.rb +40 -11
  133. data/lib/twilio-ruby/rest/verify/v2/template.rb +206 -0
  134. data/lib/twilio-ruby/rest/verify/v2/verification_attempt.rb +89 -21
  135. data/lib/twilio-ruby/rest/verify/v2/verification_attempts_summary.rb +234 -0
  136. data/lib/twilio-ruby/rest/verify/v2.rb +14 -0
  137. data/lib/twilio-ruby/rest/verify.rb +14 -2
  138. data/lib/twilio-ruby/rest/video/v1/composition.rb +21 -8
  139. data/lib/twilio-ruby/rest/video/v1/composition_hook.rb +0 -8
  140. data/lib/twilio-ruby/rest/video/v1/recording.rb +21 -0
  141. data/lib/twilio-ruby/rest/video/v1/room/recording.rb +7 -0
  142. data/lib/twilio-ruby/rest/video/v1/room.rb +62 -5
  143. data/lib/twilio-ruby/rest/voice/v1/archived_call.rb +184 -0
  144. data/lib/twilio-ruby/rest/voice/v1.rb +21 -0
  145. data/lib/twilio-ruby/rest/voice.rb +8 -0
  146. data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +3 -3
  147. data/lib/twilio-ruby/rest/wireless/v1/sim.rb +16 -26
  148. data/lib/twilio-ruby/rest.rb +13 -0
  149. data/lib/twilio-ruby/twiml/voice_response.rb +727 -87
  150. data/lib/twilio-ruby/version.rb +1 -1
  151. data/lib/twilio-ruby.rb +6 -16
  152. data/sonar-project.properties +13 -0
  153. data/twilio-ruby.gemspec +1 -2
  154. metadata +59 -32
  155. data/.travis.yml +0 -45
  156. data/lib/twilio-ruby/rest/fax/v1/fax.rb +0 -536
  157. /data/lib/twilio-ruby/framework/{domain.rb → rest/domain.rb} +0 -0
  158. /data/lib/twilio-ruby/framework/{error.rb → rest/error.rb} +0 -0
  159. /data/lib/twilio-ruby/framework/{helper.rb → rest/helper.rb} +0 -0
  160. /data/lib/twilio-ruby/framework/{obsolete_client.rb → rest/obsolete_client.rb} +0 -0
  161. /data/lib/twilio-ruby/framework/{page.rb → rest/page.rb} +0 -0
  162. /data/lib/twilio-ruby/framework/{resource.rb → rest/resource.rb} +0 -0
  163. /data/lib/twilio-ruby/framework/{version.rb → rest/version.rb} +0 -0
@@ -0,0 +1,312 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Conversations < Domain
12
+ class V1 < Version
13
+ class ParticipantConversationList < ListResource
14
+ ##
15
+ # Initialize the ParticipantConversationList
16
+ # @param [Version] version Version that contains the resource
17
+ # @return [ParticipantConversationList] ParticipantConversationList
18
+ def initialize(version)
19
+ super(version)
20
+
21
+ # Path Solution
22
+ @solution = {}
23
+ @uri = "/ParticipantConversations"
24
+ end
25
+
26
+ ##
27
+ # Lists ParticipantConversationInstance records from the API as a list.
28
+ # Unlike stream(), this operation is eager and will load `limit` records into
29
+ # memory before returning.
30
+ # @param [String] identity A unique string identifier for the conversation
31
+ # participant as {Conversation
32
+ # User}[https://www.twilio.com/docs/conversations/api/user-resource]. This
33
+ # parameter is non-null if (and only if) the participant is using the
34
+ # Conversations SDK to communicate. Limited to 256 characters.
35
+ # @param [String] address A unique string identifier for the conversation
36
+ # participant who's not a Conversation User. This parameter could be found in
37
+ # messaging_binding.address field of Participant resource. It should be
38
+ # url-encoded.
39
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
40
+ # guarantees to never return more than limit. Default is no limit
41
+ # @param [Integer] page_size Number of records to fetch per request, when
42
+ # not set will use the default value of 50 records. If no page_size is defined
43
+ # but a limit is defined, stream() will attempt to read the limit with the most
44
+ # efficient page size, i.e. min(limit, 1000)
45
+ # @return [Array] Array of up to limit results
46
+ def list(identity: :unset, address: :unset, limit: nil, page_size: nil)
47
+ self.stream(identity: identity, address: address, limit: limit, page_size: page_size).entries
48
+ end
49
+
50
+ ##
51
+ # Streams ParticipantConversationInstance records from the API as an Enumerable.
52
+ # This operation lazily loads records as efficiently as possible until the limit
53
+ # is reached.
54
+ # @param [String] identity A unique string identifier for the conversation
55
+ # participant as {Conversation
56
+ # User}[https://www.twilio.com/docs/conversations/api/user-resource]. This
57
+ # parameter is non-null if (and only if) the participant is using the
58
+ # Conversations SDK to communicate. Limited to 256 characters.
59
+ # @param [String] address A unique string identifier for the conversation
60
+ # participant who's not a Conversation User. This parameter could be found in
61
+ # messaging_binding.address field of Participant resource. It should be
62
+ # url-encoded.
63
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
64
+ # guarantees to never return more than limit. Default is no limit.
65
+ # @param [Integer] page_size Number of records to fetch per request, when
66
+ # not set will use the default value of 50 records. If no page_size is defined
67
+ # but a limit is defined, stream() will attempt to read the limit with the most
68
+ # efficient page size, i.e. min(limit, 1000)
69
+ # @return [Enumerable] Enumerable that will yield up to limit results
70
+ def stream(identity: :unset, address: :unset, limit: nil, page_size: nil)
71
+ limits = @version.read_limits(limit, page_size)
72
+
73
+ page = self.page(identity: identity, address: address, page_size: limits[:page_size], )
74
+
75
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
76
+ end
77
+
78
+ ##
79
+ # When passed a block, yields ParticipantConversationInstance records from the API.
80
+ # This operation lazily loads records as efficiently as possible until the limit
81
+ # is reached.
82
+ def each
83
+ limits = @version.read_limits
84
+
85
+ page = self.page(page_size: limits[:page_size], )
86
+
87
+ @version.stream(page,
88
+ limit: limits[:limit],
89
+ page_limit: limits[:page_limit]).each {|x| yield x}
90
+ end
91
+
92
+ ##
93
+ # Retrieve a single page of ParticipantConversationInstance records from the API.
94
+ # Request is executed immediately.
95
+ # @param [String] identity A unique string identifier for the conversation
96
+ # participant as {Conversation
97
+ # User}[https://www.twilio.com/docs/conversations/api/user-resource]. This
98
+ # parameter is non-null if (and only if) the participant is using the
99
+ # Conversations SDK to communicate. Limited to 256 characters.
100
+ # @param [String] address A unique string identifier for the conversation
101
+ # participant who's not a Conversation User. This parameter could be found in
102
+ # messaging_binding.address field of Participant resource. It should be
103
+ # url-encoded.
104
+ # @param [String] page_token PageToken provided by the API
105
+ # @param [Integer] page_number Page Number, this value is simply for client state
106
+ # @param [Integer] page_size Number of records to return, defaults to 50
107
+ # @return [Page] Page of ParticipantConversationInstance
108
+ def page(identity: :unset, address: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
109
+ params = Twilio::Values.of({
110
+ 'Identity' => identity,
111
+ 'Address' => address,
112
+ 'PageToken' => page_token,
113
+ 'Page' => page_number,
114
+ 'PageSize' => page_size,
115
+ })
116
+
117
+ response = @version.page('GET', @uri, params: params)
118
+
119
+ ParticipantConversationPage.new(@version, response, @solution)
120
+ end
121
+
122
+ ##
123
+ # Retrieve a single page of ParticipantConversationInstance records from the API.
124
+ # Request is executed immediately.
125
+ # @param [String] target_url API-generated URL for the requested results page
126
+ # @return [Page] Page of ParticipantConversationInstance
127
+ def get_page(target_url)
128
+ response = @version.domain.request(
129
+ 'GET',
130
+ target_url
131
+ )
132
+ ParticipantConversationPage.new(@version, response, @solution)
133
+ end
134
+
135
+ ##
136
+ # Provide a user friendly representation
137
+ def to_s
138
+ '#<Twilio.Conversations.V1.ParticipantConversationList>'
139
+ end
140
+ end
141
+
142
+ class ParticipantConversationPage < Page
143
+ ##
144
+ # Initialize the ParticipantConversationPage
145
+ # @param [Version] version Version that contains the resource
146
+ # @param [Response] response Response from the API
147
+ # @param [Hash] solution Path solution for the resource
148
+ # @return [ParticipantConversationPage] ParticipantConversationPage
149
+ def initialize(version, response, solution)
150
+ super(version, response)
151
+
152
+ # Path Solution
153
+ @solution = solution
154
+ end
155
+
156
+ ##
157
+ # Build an instance of ParticipantConversationInstance
158
+ # @param [Hash] payload Payload response from the API
159
+ # @return [ParticipantConversationInstance] ParticipantConversationInstance
160
+ def get_instance(payload)
161
+ ParticipantConversationInstance.new(@version, payload, )
162
+ end
163
+
164
+ ##
165
+ # Provide a user friendly representation
166
+ def to_s
167
+ '<Twilio.Conversations.V1.ParticipantConversationPage>'
168
+ end
169
+ end
170
+
171
+ class ParticipantConversationInstance < InstanceResource
172
+ ##
173
+ # Initialize the ParticipantConversationInstance
174
+ # @param [Version] version Version that contains the resource
175
+ # @param [Hash] payload payload that contains response from Twilio
176
+ # @return [ParticipantConversationInstance] ParticipantConversationInstance
177
+ def initialize(version, payload)
178
+ super(version)
179
+
180
+ # Marshaled Properties
181
+ @properties = {
182
+ 'account_sid' => payload['account_sid'],
183
+ 'chat_service_sid' => payload['chat_service_sid'],
184
+ 'participant_sid' => payload['participant_sid'],
185
+ 'participant_user_sid' => payload['participant_user_sid'],
186
+ 'participant_identity' => payload['participant_identity'],
187
+ 'participant_messaging_binding' => payload['participant_messaging_binding'],
188
+ 'conversation_sid' => payload['conversation_sid'],
189
+ 'conversation_unique_name' => payload['conversation_unique_name'],
190
+ 'conversation_friendly_name' => payload['conversation_friendly_name'],
191
+ 'conversation_attributes' => payload['conversation_attributes'],
192
+ 'conversation_date_created' => Twilio.deserialize_iso8601_datetime(payload['conversation_date_created']),
193
+ 'conversation_date_updated' => Twilio.deserialize_iso8601_datetime(payload['conversation_date_updated']),
194
+ 'conversation_created_by' => payload['conversation_created_by'],
195
+ 'conversation_state' => payload['conversation_state'],
196
+ 'conversation_timers' => payload['conversation_timers'],
197
+ 'links' => payload['links'],
198
+ }
199
+ end
200
+
201
+ ##
202
+ # @return [String] The unique ID of the Account responsible for this conversation.
203
+ def account_sid
204
+ @properties['account_sid']
205
+ end
206
+
207
+ ##
208
+ # @return [String] The unique ID of the Conversation Service this conversation belongs to.
209
+ def chat_service_sid
210
+ @properties['chat_service_sid']
211
+ end
212
+
213
+ ##
214
+ # @return [String] The unique ID of the Participant.
215
+ def participant_sid
216
+ @properties['participant_sid']
217
+ end
218
+
219
+ ##
220
+ # @return [String] The unique ID for the conversation participant as Conversation User.
221
+ def participant_user_sid
222
+ @properties['participant_user_sid']
223
+ end
224
+
225
+ ##
226
+ # @return [String] A unique string identifier for the conversation participant as Conversation User.
227
+ def participant_identity
228
+ @properties['participant_identity']
229
+ end
230
+
231
+ ##
232
+ # @return [Hash] Information about how this participant exchanges messages with the conversation.
233
+ def participant_messaging_binding
234
+ @properties['participant_messaging_binding']
235
+ end
236
+
237
+ ##
238
+ # @return [String] The unique ID of the Conversation this Participant belongs to.
239
+ def conversation_sid
240
+ @properties['conversation_sid']
241
+ end
242
+
243
+ ##
244
+ # @return [String] An application-defined string that uniquely identifies the Conversation resource
245
+ def conversation_unique_name
246
+ @properties['conversation_unique_name']
247
+ end
248
+
249
+ ##
250
+ # @return [String] The human-readable name of this conversation.
251
+ def conversation_friendly_name
252
+ @properties['conversation_friendly_name']
253
+ end
254
+
255
+ ##
256
+ # @return [String] An optional string metadata field you can use to store any data you wish.
257
+ def conversation_attributes
258
+ @properties['conversation_attributes']
259
+ end
260
+
261
+ ##
262
+ # @return [Time] The date that this conversation was created.
263
+ def conversation_date_created
264
+ @properties['conversation_date_created']
265
+ end
266
+
267
+ ##
268
+ # @return [Time] The date that this conversation was last updated.
269
+ def conversation_date_updated
270
+ @properties['conversation_date_updated']
271
+ end
272
+
273
+ ##
274
+ # @return [String] Creator of this conversation.
275
+ def conversation_created_by
276
+ @properties['conversation_created_by']
277
+ end
278
+
279
+ ##
280
+ # @return [participant_conversation.State] The current state of this User Conversation
281
+ def conversation_state
282
+ @properties['conversation_state']
283
+ end
284
+
285
+ ##
286
+ # @return [Hash] Timer date values for this conversation.
287
+ def conversation_timers
288
+ @properties['conversation_timers']
289
+ end
290
+
291
+ ##
292
+ # @return [String] Absolute URLs to access the participant and conversation of this Participant Conversation.
293
+ def links
294
+ @properties['links']
295
+ end
296
+
297
+ ##
298
+ # Provide a user friendly representation
299
+ def to_s
300
+ "<Twilio.Conversations.V1.ParticipantConversationInstance>"
301
+ end
302
+
303
+ ##
304
+ # Provide a detailed, user friendly representation
305
+ def inspect
306
+ "<Twilio.Conversations.V1.ParticipantConversationInstance>"
307
+ end
308
+ end
309
+ end
310
+ end
311
+ end
312
+ end
@@ -107,8 +107,14 @@ module Twilio
107
107
  # @param [String] removed_from_conversation_sound The name of the sound to play to
108
108
  # a user when they are removed from a conversation and
109
109
  # `removed_from_conversation.enabled` is `true`.
110
+ # @param [Boolean] new_message_with_media_enabled Whether to send a notification
111
+ # when a new message with media/file attachments is added to a conversation. The
112
+ # default is `false`.
113
+ # @param [String] new_message_with_media_template The template to use to create
114
+ # the notification text displayed when a new message with media/file attachments
115
+ # is added to a conversation and `new_message.attachments.enabled` is `true`.
110
116
  # @return [NotificationInstance] Updated NotificationInstance
111
- def update(log_enabled: :unset, new_message_enabled: :unset, new_message_template: :unset, new_message_sound: :unset, new_message_badge_count_enabled: :unset, added_to_conversation_enabled: :unset, added_to_conversation_template: :unset, added_to_conversation_sound: :unset, removed_from_conversation_enabled: :unset, removed_from_conversation_template: :unset, removed_from_conversation_sound: :unset)
117
+ def update(log_enabled: :unset, new_message_enabled: :unset, new_message_template: :unset, new_message_sound: :unset, new_message_badge_count_enabled: :unset, added_to_conversation_enabled: :unset, added_to_conversation_template: :unset, added_to_conversation_sound: :unset, removed_from_conversation_enabled: :unset, removed_from_conversation_template: :unset, removed_from_conversation_sound: :unset, new_message_with_media_enabled: :unset, new_message_with_media_template: :unset)
112
118
  data = Twilio::Values.of({
113
119
  'LogEnabled' => log_enabled,
114
120
  'NewMessage.Enabled' => new_message_enabled,
@@ -121,6 +127,8 @@ module Twilio
121
127
  'RemovedFromConversation.Enabled' => removed_from_conversation_enabled,
122
128
  'RemovedFromConversation.Template' => removed_from_conversation_template,
123
129
  'RemovedFromConversation.Sound' => removed_from_conversation_sound,
130
+ 'NewMessage.WithMedia.Enabled' => new_message_with_media_enabled,
131
+ 'NewMessage.WithMedia.Template' => new_message_with_media_template,
124
132
  })
125
133
 
126
134
  payload = @version.update('POST', @uri, data: data)
@@ -261,8 +269,14 @@ module Twilio
261
269
  # @param [String] removed_from_conversation_sound The name of the sound to play to
262
270
  # a user when they are removed from a conversation and
263
271
  # `removed_from_conversation.enabled` is `true`.
272
+ # @param [Boolean] new_message_with_media_enabled Whether to send a notification
273
+ # when a new message with media/file attachments is added to a conversation. The
274
+ # default is `false`.
275
+ # @param [String] new_message_with_media_template The template to use to create
276
+ # the notification text displayed when a new message with media/file attachments
277
+ # is added to a conversation and `new_message.attachments.enabled` is `true`.
264
278
  # @return [NotificationInstance] Updated NotificationInstance
265
- def update(log_enabled: :unset, new_message_enabled: :unset, new_message_template: :unset, new_message_sound: :unset, new_message_badge_count_enabled: :unset, added_to_conversation_enabled: :unset, added_to_conversation_template: :unset, added_to_conversation_sound: :unset, removed_from_conversation_enabled: :unset, removed_from_conversation_template: :unset, removed_from_conversation_sound: :unset)
279
+ def update(log_enabled: :unset, new_message_enabled: :unset, new_message_template: :unset, new_message_sound: :unset, new_message_badge_count_enabled: :unset, added_to_conversation_enabled: :unset, added_to_conversation_template: :unset, added_to_conversation_sound: :unset, removed_from_conversation_enabled: :unset, removed_from_conversation_template: :unset, removed_from_conversation_sound: :unset, new_message_with_media_enabled: :unset, new_message_with_media_template: :unset)
266
280
  context.update(
267
281
  log_enabled: log_enabled,
268
282
  new_message_enabled: new_message_enabled,
@@ -275,6 +289,8 @@ module Twilio
275
289
  removed_from_conversation_enabled: removed_from_conversation_enabled,
276
290
  removed_from_conversation_template: removed_from_conversation_template,
277
291
  removed_from_conversation_sound: removed_from_conversation_sound,
292
+ new_message_with_media_enabled: new_message_with_media_enabled,
293
+ new_message_with_media_template: new_message_with_media_template,
278
294
  )
279
295
  end
280
296
 
@@ -0,0 +1,269 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Conversations < Domain
12
+ class V1 < Version
13
+ class ServiceContext < InstanceContext
14
+ class ConfigurationContext < InstanceContext
15
+ class WebhookList < ListResource
16
+ ##
17
+ # Initialize the WebhookList
18
+ # @param [Version] version Version that contains the resource
19
+ # @param [String] chat_service_sid The unique string that we created to identify
20
+ # the Service configuration resource.
21
+ # @return [WebhookList] WebhookList
22
+ def initialize(version, chat_service_sid: nil)
23
+ super(version)
24
+
25
+ # Path Solution
26
+ @solution = {chat_service_sid: chat_service_sid}
27
+ end
28
+
29
+ ##
30
+ # Provide a user friendly representation
31
+ def to_s
32
+ '#<Twilio.Conversations.V1.WebhookList>'
33
+ end
34
+ end
35
+
36
+ class WebhookPage < Page
37
+ ##
38
+ # Initialize the WebhookPage
39
+ # @param [Version] version Version that contains the resource
40
+ # @param [Response] response Response from the API
41
+ # @param [Hash] solution Path solution for the resource
42
+ # @return [WebhookPage] WebhookPage
43
+ def initialize(version, response, solution)
44
+ super(version, response)
45
+
46
+ # Path Solution
47
+ @solution = solution
48
+ end
49
+
50
+ ##
51
+ # Build an instance of WebhookInstance
52
+ # @param [Hash] payload Payload response from the API
53
+ # @return [WebhookInstance] WebhookInstance
54
+ def get_instance(payload)
55
+ WebhookInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
56
+ end
57
+
58
+ ##
59
+ # Provide a user friendly representation
60
+ def to_s
61
+ '<Twilio.Conversations.V1.WebhookPage>'
62
+ end
63
+ end
64
+
65
+ class WebhookContext < InstanceContext
66
+ ##
67
+ # Initialize the WebhookContext
68
+ # @param [Version] version Version that contains the resource
69
+ # @param [String] chat_service_sid The unique ID of the {Conversation
70
+ # Service}[https://www.twilio.com/docs/conversations/api/service-resource] this
71
+ # conversation belongs to.
72
+ # @return [WebhookContext] WebhookContext
73
+ def initialize(version, chat_service_sid)
74
+ super(version)
75
+
76
+ # Path Solution
77
+ @solution = {chat_service_sid: chat_service_sid, }
78
+ @uri = "/Services/#{@solution[:chat_service_sid]}/Configuration/Webhooks"
79
+ end
80
+
81
+ ##
82
+ # Update the WebhookInstance
83
+ # @param [String] pre_webhook_url The absolute url the pre-event webhook request
84
+ # should be sent to.
85
+ # @param [String] post_webhook_url The absolute url the post-event webhook request
86
+ # should be sent to.
87
+ # @param [Array[String]] filters The list of events that your configured webhook
88
+ # targets will receive. Events not configured here will not fire. Possible values
89
+ # are `onParticipantAdd`, `onParticipantAdded`, `onDeliveryUpdated`,
90
+ # `onConversationUpdated`, `onConversationRemove`, `onParticipantRemove`,
91
+ # `onConversationUpdate`, `onMessageAdd`, `onMessageRemoved`,
92
+ # `onParticipantUpdated`, `onConversationAdded`, `onMessageAdded`,
93
+ # `onConversationAdd`, `onConversationRemoved`, `onParticipantUpdate`,
94
+ # `onMessageRemove`, `onMessageUpdated`, `onParticipantRemoved`, `onMessageUpdate`
95
+ # or `onConversationStateUpdated`.
96
+ # @param [String] method The HTTP method to be used when sending a webhook
97
+ # request. One of `GET` or `POST`.
98
+ # @return [WebhookInstance] Updated WebhookInstance
99
+ def update(pre_webhook_url: :unset, post_webhook_url: :unset, filters: :unset, method: :unset)
100
+ data = Twilio::Values.of({
101
+ 'PreWebhookUrl' => pre_webhook_url,
102
+ 'PostWebhookUrl' => post_webhook_url,
103
+ 'Filters' => Twilio.serialize_list(filters) { |e| e },
104
+ 'Method' => method,
105
+ })
106
+
107
+ payload = @version.update('POST', @uri, data: data)
108
+
109
+ WebhookInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
110
+ end
111
+
112
+ ##
113
+ # Fetch the WebhookInstance
114
+ # @return [WebhookInstance] Fetched WebhookInstance
115
+ def fetch
116
+ payload = @version.fetch('GET', @uri)
117
+
118
+ WebhookInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
119
+ end
120
+
121
+ ##
122
+ # Provide a user friendly representation
123
+ def to_s
124
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
125
+ "#<Twilio.Conversations.V1.WebhookContext #{context}>"
126
+ end
127
+
128
+ ##
129
+ # Provide a detailed, user friendly representation
130
+ def inspect
131
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
132
+ "#<Twilio.Conversations.V1.WebhookContext #{context}>"
133
+ end
134
+ end
135
+
136
+ class WebhookInstance < InstanceResource
137
+ ##
138
+ # Initialize the WebhookInstance
139
+ # @param [Version] version Version that contains the resource
140
+ # @param [Hash] payload payload that contains response from Twilio
141
+ # @param [String] chat_service_sid The unique string that we created to identify
142
+ # the Service configuration resource.
143
+ # @return [WebhookInstance] WebhookInstance
144
+ def initialize(version, payload, chat_service_sid: nil)
145
+ super(version)
146
+
147
+ # Marshaled Properties
148
+ @properties = {
149
+ 'account_sid' => payload['account_sid'],
150
+ 'chat_service_sid' => payload['chat_service_sid'],
151
+ 'pre_webhook_url' => payload['pre_webhook_url'],
152
+ 'post_webhook_url' => payload['post_webhook_url'],
153
+ 'filters' => payload['filters'],
154
+ 'method' => payload['method'],
155
+ 'url' => payload['url'],
156
+ }
157
+
158
+ # Context
159
+ @instance_context = nil
160
+ @params = {'chat_service_sid' => chat_service_sid, }
161
+ end
162
+
163
+ ##
164
+ # Generate an instance context for the instance, the context is capable of
165
+ # performing various actions. All instance actions are proxied to the context
166
+ # @return [WebhookContext] WebhookContext for this WebhookInstance
167
+ def context
168
+ unless @instance_context
169
+ @instance_context = WebhookContext.new(@version, @params['chat_service_sid'], )
170
+ end
171
+ @instance_context
172
+ end
173
+
174
+ ##
175
+ # @return [String] The unique ID of the Account responsible for this service.
176
+ def account_sid
177
+ @properties['account_sid']
178
+ end
179
+
180
+ ##
181
+ # @return [String] The unique ID of the {Conversation Service}[https://www.twilio.com/docs/conversations/api/service-resource] this conversation belongs to.
182
+ def chat_service_sid
183
+ @properties['chat_service_sid']
184
+ end
185
+
186
+ ##
187
+ # @return [String] The absolute url the pre-event webhook request should be sent to.
188
+ def pre_webhook_url
189
+ @properties['pre_webhook_url']
190
+ end
191
+
192
+ ##
193
+ # @return [String] The absolute url the post-event webhook request should be sent to.
194
+ def post_webhook_url
195
+ @properties['post_webhook_url']
196
+ end
197
+
198
+ ##
199
+ # @return [Array[String]] The list of events that your configured webhook targets will receive. Events not configured here will not fire.
200
+ def filters
201
+ @properties['filters']
202
+ end
203
+
204
+ ##
205
+ # @return [webhook.Method] The HTTP method to be used when sending a webhook request
206
+ def method
207
+ @properties['method']
208
+ end
209
+
210
+ ##
211
+ # @return [String] An absolute URL for this webhook.
212
+ def url
213
+ @properties['url']
214
+ end
215
+
216
+ ##
217
+ # Update the WebhookInstance
218
+ # @param [String] pre_webhook_url The absolute url the pre-event webhook request
219
+ # should be sent to.
220
+ # @param [String] post_webhook_url The absolute url the post-event webhook request
221
+ # should be sent to.
222
+ # @param [Array[String]] filters The list of events that your configured webhook
223
+ # targets will receive. Events not configured here will not fire. Possible values
224
+ # are `onParticipantAdd`, `onParticipantAdded`, `onDeliveryUpdated`,
225
+ # `onConversationUpdated`, `onConversationRemove`, `onParticipantRemove`,
226
+ # `onConversationUpdate`, `onMessageAdd`, `onMessageRemoved`,
227
+ # `onParticipantUpdated`, `onConversationAdded`, `onMessageAdded`,
228
+ # `onConversationAdd`, `onConversationRemoved`, `onParticipantUpdate`,
229
+ # `onMessageRemove`, `onMessageUpdated`, `onParticipantRemoved`, `onMessageUpdate`
230
+ # or `onConversationStateUpdated`.
231
+ # @param [String] method The HTTP method to be used when sending a webhook
232
+ # request. One of `GET` or `POST`.
233
+ # @return [WebhookInstance] Updated WebhookInstance
234
+ def update(pre_webhook_url: :unset, post_webhook_url: :unset, filters: :unset, method: :unset)
235
+ context.update(
236
+ pre_webhook_url: pre_webhook_url,
237
+ post_webhook_url: post_webhook_url,
238
+ filters: filters,
239
+ method: method,
240
+ )
241
+ end
242
+
243
+ ##
244
+ # Fetch the WebhookInstance
245
+ # @return [WebhookInstance] Fetched WebhookInstance
246
+ def fetch
247
+ context.fetch
248
+ end
249
+
250
+ ##
251
+ # Provide a user friendly representation
252
+ def to_s
253
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
254
+ "<Twilio.Conversations.V1.WebhookInstance #{values}>"
255
+ end
256
+
257
+ ##
258
+ # Provide a detailed, user friendly representation
259
+ def inspect
260
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
261
+ "<Twilio.Conversations.V1.WebhookInstance #{values}>"
262
+ end
263
+ end
264
+ end
265
+ end
266
+ end
267
+ end
268
+ end
269
+ end
@@ -77,6 +77,7 @@ module Twilio
77
77
 
78
78
  # Components
79
79
  @notifications = nil
80
+ @webhooks = nil
80
81
  end
81
82
 
82
83
  ##
@@ -127,6 +128,13 @@ module Twilio
127
128
  return NotificationContext.new(@version, @solution[:chat_service_sid], )
128
129
  end
129
130
 
131
+ ##
132
+ # Access the webhooks
133
+ # @return [WebhookContext] WebhookContext
134
+ def webhooks
135
+ return WebhookContext.new(@version, @solution[:chat_service_sid], )
136
+ end
137
+
130
138
  ##
131
139
  # Provide a user friendly representation
132
140
  def to_s