twilio-ruby 5.39.2 → 5.40.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CHANGES.md +107 -1
  4. data/CONTRIBUTING.md +2 -2
  5. data/ISSUE_TEMPLATE.md +5 -1
  6. data/PULL_REQUEST_TEMPLATE.md +1 -1
  7. data/README.md +4 -3
  8. data/lib/twilio-ruby/framework/version.rb +4 -8
  9. data/lib/twilio-ruby/rest/api/v2010/account/application.rb +6 -4
  10. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/local.rb +12 -3
  11. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/machine_to_machine.rb +12 -3
  12. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/mobile.rb +12 -3
  13. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/national.rb +12 -3
  14. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/shared_cost.rb +12 -3
  15. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/toll_free.rb +12 -3
  16. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/voip.rb +12 -3
  17. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +2 -1
  18. data/lib/twilio-ruby/rest/api/v2010/account/call/payment.rb +85 -60
  19. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +5 -2
  20. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +14 -0
  21. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +14 -0
  22. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +14 -0
  23. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +8 -1
  24. data/lib/twilio-ruby/rest/api/v2010/account/message/feedback.rb +3 -1
  25. data/lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb +2 -1
  26. data/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type/field_value.rb +8 -4
  27. data/lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb +11 -4
  28. data/lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb +13 -6
  29. data/lib/twilio-ruby/rest/client.rb +7 -0
  30. data/lib/twilio-ruby/rest/conversations.rb +39 -3
  31. data/lib/twilio-ruby/rest/conversations/v1.rb +68 -5
  32. data/lib/twilio-ruby/rest/conversations/v1/configuration.rb +268 -0
  33. data/lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb +262 -0
  34. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +21 -10
  35. data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +13 -10
  36. data/lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb +34 -19
  37. data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +48 -32
  38. data/lib/twilio-ruby/rest/conversations/v1/conversation/webhook.rb +14 -11
  39. data/lib/twilio-ruby/rest/conversations/v1/credential.rb +427 -0
  40. data/lib/twilio-ruby/rest/conversations/v1/role.rb +374 -0
  41. data/lib/twilio-ruby/rest/conversations/v1/service.rb +442 -0
  42. data/lib/twilio-ruby/rest/conversations/v1/service/binding.rb +388 -0
  43. data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +271 -0
  44. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb +315 -0
  45. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +586 -0
  46. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +549 -0
  47. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb +394 -0
  48. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb +519 -0
  49. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb +457 -0
  50. data/lib/twilio-ruby/rest/conversations/v1/service/role.rb +395 -0
  51. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +419 -0
  52. data/lib/twilio-ruby/rest/conversations/v1/user.rb +398 -0
  53. data/lib/twilio-ruby/rest/events.rb +72 -0
  54. data/lib/twilio-ruby/rest/events/v1.rb +90 -0
  55. data/lib/twilio-ruby/rest/events/v1/event_type.rb +291 -0
  56. data/lib/twilio-ruby/rest/events/v1/schema.rb +226 -0
  57. data/lib/twilio-ruby/rest/events/v1/schema/schema_version.rb +290 -0
  58. data/lib/twilio-ruby/rest/events/v1/sink.rb +380 -0
  59. data/lib/twilio-ruby/rest/events/v1/sink/sink_test.rb +115 -0
  60. data/lib/twilio-ruby/rest/events/v1/sink/sink_validate.rb +119 -0
  61. data/lib/twilio-ruby/rest/events/v1/subscription.rb +383 -0
  62. data/lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb +216 -0
  63. data/lib/twilio-ruby/rest/fax/v1/fax.rb +2 -1
  64. data/lib/twilio-ruby/rest/messaging.rb +6 -0
  65. data/lib/twilio-ruby/rest/messaging/v1.rb +7 -0
  66. data/lib/twilio-ruby/rest/messaging/v1/deactivation.rb +164 -0
  67. data/lib/twilio-ruby/rest/messaging/v1/service.rb +6 -3
  68. data/lib/twilio-ruby/rest/notify/v1/credential.rb +12 -6
  69. data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +10 -2
  70. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance.rb +3 -3
  71. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/end_user.rb +16 -2
  72. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +18 -4
  73. data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb +10 -5
  74. data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.rb +6 -3
  75. data/lib/twilio-ruby/rest/preview/trusted_comms/business/insights.rb +1 -4
  76. data/lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb +3 -1
  77. data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +45 -4
  78. data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +14 -1
  79. data/lib/twilio-ruby/rest/serverless/v1/service.rb +13 -13
  80. data/lib/twilio-ruby/rest/serverless/v1/service/asset.rb +6 -6
  81. data/lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb +5 -5
  82. data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +8 -8
  83. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +6 -8
  84. data/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb +8 -8
  85. data/lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb +14 -14
  86. data/lib/twilio-ruby/rest/serverless/v1/service/function.rb +4 -4
  87. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb +7 -7
  88. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb +1 -1
  89. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +12 -11
  90. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +17 -7
  91. data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +75 -9
  92. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +2 -1
  93. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +6 -2
  94. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +1 -4
  95. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +6 -2
  96. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +38 -23
  97. data/lib/twilio-ruby/rest/trunking/v1/trunk/ip_access_control_list.rb +2 -1
  98. data/lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb +2 -1
  99. data/lib/twilio-ruby/rest/trunking/v1/trunk/recording.rb +201 -0
  100. data/lib/twilio-ruby/rest/verify/v2/service.rb +21 -9
  101. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +10 -2
  102. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +7 -2
  103. data/lib/twilio-ruby/rest/video/v1/composition.rb +7 -3
  104. data/lib/twilio-ruby/rest/video/v1/composition_hook.rb +18 -9
  105. data/lib/twilio-ruby/rest/video/v1/room.rb +2 -1
  106. data/lib/twilio-ruby/rest/video/v1/room/room_participant/room_participant_subscribe_rule.rb +0 -6
  107. data/lib/twilio-ruby/rest/voice/v1/dialing_permissions.rb +1 -4
  108. data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +2 -1
  109. data/lib/twilio-ruby/rest/wireless/v1/sim/data_session.rb +5 -19
  110. data/lib/twilio-ruby/version.rb +1 -1
  111. data/spec/framework/version_spec.rb +53 -0
  112. data/spec/holodeck/holodeck.rb +3 -3
  113. data/spec/integration/api/v2010/account/incoming_phone_number/local_spec.rb +35 -36
  114. data/spec/integration/api/v2010/account/incoming_phone_number/mobile_spec.rb +39 -40
  115. data/spec/integration/api/v2010/account/incoming_phone_number/toll_free_spec.rb +35 -36
  116. data/spec/integration/api/v2010/account/incoming_phone_number_spec.rb +25 -23
  117. data/spec/integration/api/v2010/account/message_spec.rb +37 -0
  118. data/spec/integration/bulkexports/v1/export/day_spec.rb +5 -5
  119. data/spec/integration/bulkexports/v1/export_configuration_spec.rb +4 -4
  120. data/spec/integration/bulkexports/v1/export_spec.rb +3 -3
  121. data/spec/integration/conversations/v1/{webhook_spec.rb → configuration/webhook_spec.rb} +12 -8
  122. data/spec/integration/conversations/v1/configuration_spec.rb +87 -0
  123. data/spec/integration/conversations/v1/conversation/message/delivery_receipt_spec.rb +4 -0
  124. data/spec/integration/conversations/v1/conversation/message_spec.rb +38 -0
  125. data/spec/integration/conversations/v1/conversation/participant_spec.rb +60 -4
  126. data/spec/integration/conversations/v1/conversation_spec.rb +35 -0
  127. data/spec/integration/conversations/v1/credential_spec.rb +219 -0
  128. data/spec/integration/conversations/v1/role_spec.rb +249 -0
  129. data/spec/integration/conversations/v1/service/binding_spec.rb +166 -0
  130. data/spec/integration/conversations/v1/service/configuration/notification_spec.rb +115 -0
  131. data/spec/integration/conversations/v1/service/configuration_spec.rb +87 -0
  132. data/spec/integration/conversations/v1/service/conversation/message/delivery_receipt_spec.rb +144 -0
  133. data/spec/integration/conversations/v1/service/conversation/message_spec.rb +429 -0
  134. data/spec/integration/conversations/v1/service/conversation/participant_spec.rb +407 -0
  135. data/spec/integration/conversations/v1/service/conversation/webhook_spec.rb +299 -0
  136. data/spec/integration/conversations/v1/service/conversation_spec.rb +289 -0
  137. data/spec/integration/conversations/v1/service/role_spec.rb +260 -0
  138. data/spec/integration/conversations/v1/service/user_spec.rb +230 -0
  139. data/spec/integration/conversations/v1/service_spec.rb +174 -0
  140. data/spec/integration/conversations/v1/user_spec.rb +220 -0
  141. data/spec/integration/events/v1/event_type_spec.rb +133 -0
  142. data/spec/integration/events/v1/schema/schema_version_spec.rb +126 -0
  143. data/spec/integration/events/v1/schema_spec.rb +46 -0
  144. data/spec/integration/events/v1/sink/sink_test_spec.rb +42 -0
  145. data/spec/integration/events/v1/sink/sink_validate_spec.rb +44 -0
  146. data/spec/integration/events/v1/sink_spec.rb +217 -0
  147. data/spec/integration/events/v1/subscription/subscribed_event_spec.rb +91 -0
  148. data/spec/integration/events/v1/subscription_spec.rb +243 -0
  149. data/spec/integration/messaging/v1/deactivation_spec.rb +40 -0
  150. data/spec/integration/numbers/v2/regulatory_compliance/end_user_spec.rb +27 -0
  151. data/spec/integration/numbers/v2/regulatory_compliance/supporting_document_spec.rb +27 -0
  152. data/spec/integration/studio/v1/flow/execution/execution_step_spec.rb +1 -0
  153. data/spec/integration/studio/v2/flow/execution/execution_step_spec.rb +1 -0
  154. data/spec/integration/supersim/v1/sim_spec.rb +23 -0
  155. data/spec/integration/supersim/v1/usage_record_spec.rb +463 -18
  156. data/spec/integration/trunking/v1/trunk/recording_spec.rb +79 -0
  157. data/spec/integration/trunking/v1/trunk_spec.rb +4 -0
  158. data/spec/integration/verify/v2/service/access_token_spec.rb +1 -1
  159. data/spec/integration/verify/v2/service/entity/challenge_spec.rb +8 -8
  160. data/spec/integration/video/v1/room_spec.rb +37 -0
  161. data/spec/integration/wireless/v1/sim/data_session_spec.rb +2 -2
  162. data/spec/spec_helper.rb +1 -1
  163. metadata +82 -5
  164. data/lib/twilio-ruby/rest/conversations/v1/webhook.rb +0 -262
@@ -0,0 +1,394 @@
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 ConversationContext < InstanceContext
15
+ class MessageContext < InstanceContext
16
+ ##
17
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
18
+ class DeliveryReceiptList < ListResource
19
+ ##
20
+ # Initialize the DeliveryReceiptList
21
+ # @param [Version] version Version that contains the resource
22
+ # @param [String] chat_service_sid The SID of the [Conversation
23
+ # Service](https://www.twilio.com/docs/conversations/api/service-resource) the
24
+ # Message resource is associated with.
25
+ # @param [String] conversation_sid The unique ID of the
26
+ # [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource)
27
+ # for this message.
28
+ # @param [String] message_sid The SID of the message within a
29
+ # [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource)
30
+ # the delivery receipt belongs to
31
+ # @return [DeliveryReceiptList] DeliveryReceiptList
32
+ def initialize(version, chat_service_sid: nil, conversation_sid: nil, message_sid: nil)
33
+ super(version)
34
+
35
+ # Path Solution
36
+ @solution = {
37
+ chat_service_sid: chat_service_sid,
38
+ conversation_sid: conversation_sid,
39
+ message_sid: message_sid
40
+ }
41
+ @uri = "/Services/#{@solution[:chat_service_sid]}/Conversations/#{@solution[:conversation_sid]}/Messages/#{@solution[:message_sid]}/Receipts"
42
+ end
43
+
44
+ ##
45
+ # Lists DeliveryReceiptInstance records from the API as a list.
46
+ # Unlike stream(), this operation is eager and will load `limit` records into
47
+ # memory before returning.
48
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
49
+ # guarantees to never return more than limit. Default is no limit
50
+ # @param [Integer] page_size Number of records to fetch per request, when
51
+ # not set will use the default value of 50 records. If no page_size is defined
52
+ # but a limit is defined, stream() will attempt to read the limit with the most
53
+ # efficient page size, i.e. min(limit, 1000)
54
+ # @return [Array] Array of up to limit results
55
+ def list(limit: nil, page_size: nil)
56
+ self.stream(limit: limit, page_size: page_size).entries
57
+ end
58
+
59
+ ##
60
+ # Streams DeliveryReceiptInstance records from the API as an Enumerable.
61
+ # This operation lazily loads records as efficiently as possible until the limit
62
+ # is reached.
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(limit: nil, page_size: nil)
71
+ limits = @version.read_limits(limit, page_size)
72
+
73
+ page = self.page(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 DeliveryReceiptInstance 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 DeliveryReceiptInstance records from the API.
94
+ # Request is executed immediately.
95
+ # @param [String] page_token PageToken provided by the API
96
+ # @param [Integer] page_number Page Number, this value is simply for client state
97
+ # @param [Integer] page_size Number of records to return, defaults to 50
98
+ # @return [Page] Page of DeliveryReceiptInstance
99
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
100
+ params = Twilio::Values.of({
101
+ 'PageToken' => page_token,
102
+ 'Page' => page_number,
103
+ 'PageSize' => page_size,
104
+ })
105
+
106
+ response = @version.page('GET', @uri, params: params)
107
+
108
+ DeliveryReceiptPage.new(@version, response, @solution)
109
+ end
110
+
111
+ ##
112
+ # Retrieve a single page of DeliveryReceiptInstance records from the API.
113
+ # Request is executed immediately.
114
+ # @param [String] target_url API-generated URL for the requested results page
115
+ # @return [Page] Page of DeliveryReceiptInstance
116
+ def get_page(target_url)
117
+ response = @version.domain.request(
118
+ 'GET',
119
+ target_url
120
+ )
121
+ DeliveryReceiptPage.new(@version, response, @solution)
122
+ end
123
+
124
+ ##
125
+ # Provide a user friendly representation
126
+ def to_s
127
+ '#<Twilio.Conversations.V1.DeliveryReceiptList>'
128
+ end
129
+ end
130
+
131
+ ##
132
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
133
+ class DeliveryReceiptPage < Page
134
+ ##
135
+ # Initialize the DeliveryReceiptPage
136
+ # @param [Version] version Version that contains the resource
137
+ # @param [Response] response Response from the API
138
+ # @param [Hash] solution Path solution for the resource
139
+ # @return [DeliveryReceiptPage] DeliveryReceiptPage
140
+ def initialize(version, response, solution)
141
+ super(version, response)
142
+
143
+ # Path Solution
144
+ @solution = solution
145
+ end
146
+
147
+ ##
148
+ # Build an instance of DeliveryReceiptInstance
149
+ # @param [Hash] payload Payload response from the API
150
+ # @return [DeliveryReceiptInstance] DeliveryReceiptInstance
151
+ def get_instance(payload)
152
+ DeliveryReceiptInstance.new(
153
+ @version,
154
+ payload,
155
+ chat_service_sid: @solution[:chat_service_sid],
156
+ conversation_sid: @solution[:conversation_sid],
157
+ message_sid: @solution[:message_sid],
158
+ )
159
+ end
160
+
161
+ ##
162
+ # Provide a user friendly representation
163
+ def to_s
164
+ '<Twilio.Conversations.V1.DeliveryReceiptPage>'
165
+ end
166
+ end
167
+
168
+ ##
169
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
170
+ class DeliveryReceiptContext < InstanceContext
171
+ ##
172
+ # Initialize the DeliveryReceiptContext
173
+ # @param [Version] version Version that contains the resource
174
+ # @param [String] chat_service_sid The SID of the [Conversation
175
+ # Service](https://www.twilio.com/docs/conversations/api/service-resource) the
176
+ # Message resource is associated with.
177
+ # @param [String] conversation_sid The unique ID of the
178
+ # [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource)
179
+ # for this message.
180
+ # @param [String] message_sid The SID of the message within a
181
+ # [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource)
182
+ # the delivery receipt belongs to.
183
+ # @param [String] sid A 34 character string that uniquely identifies this
184
+ # resource.
185
+ # @return [DeliveryReceiptContext] DeliveryReceiptContext
186
+ def initialize(version, chat_service_sid, conversation_sid, message_sid, sid)
187
+ super(version)
188
+
189
+ # Path Solution
190
+ @solution = {
191
+ chat_service_sid: chat_service_sid,
192
+ conversation_sid: conversation_sid,
193
+ message_sid: message_sid,
194
+ sid: sid,
195
+ }
196
+ @uri = "/Services/#{@solution[:chat_service_sid]}/Conversations/#{@solution[:conversation_sid]}/Messages/#{@solution[:message_sid]}/Receipts/#{@solution[:sid]}"
197
+ end
198
+
199
+ ##
200
+ # Fetch the DeliveryReceiptInstance
201
+ # @return [DeliveryReceiptInstance] Fetched DeliveryReceiptInstance
202
+ def fetch
203
+ payload = @version.fetch('GET', @uri)
204
+
205
+ DeliveryReceiptInstance.new(
206
+ @version,
207
+ payload,
208
+ chat_service_sid: @solution[:chat_service_sid],
209
+ conversation_sid: @solution[:conversation_sid],
210
+ message_sid: @solution[:message_sid],
211
+ sid: @solution[:sid],
212
+ )
213
+ end
214
+
215
+ ##
216
+ # Provide a user friendly representation
217
+ def to_s
218
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
219
+ "#<Twilio.Conversations.V1.DeliveryReceiptContext #{context}>"
220
+ end
221
+
222
+ ##
223
+ # Provide a detailed, user friendly representation
224
+ def inspect
225
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
226
+ "#<Twilio.Conversations.V1.DeliveryReceiptContext #{context}>"
227
+ end
228
+ end
229
+
230
+ ##
231
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
232
+ class DeliveryReceiptInstance < InstanceResource
233
+ ##
234
+ # Initialize the DeliveryReceiptInstance
235
+ # @param [Version] version Version that contains the resource
236
+ # @param [Hash] payload payload that contains response from Twilio
237
+ # @param [String] chat_service_sid The SID of the [Conversation
238
+ # Service](https://www.twilio.com/docs/conversations/api/service-resource) the
239
+ # Message resource is associated with.
240
+ # @param [String] conversation_sid The unique ID of the
241
+ # [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource)
242
+ # for this message.
243
+ # @param [String] message_sid The SID of the message within a
244
+ # [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource)
245
+ # the delivery receipt belongs to
246
+ # @param [String] sid A 34 character string that uniquely identifies this
247
+ # resource.
248
+ # @return [DeliveryReceiptInstance] DeliveryReceiptInstance
249
+ def initialize(version, payload, chat_service_sid: nil, conversation_sid: nil, message_sid: nil, sid: nil)
250
+ super(version)
251
+
252
+ # Marshaled Properties
253
+ @properties = {
254
+ 'account_sid' => payload['account_sid'],
255
+ 'chat_service_sid' => payload['chat_service_sid'],
256
+ 'conversation_sid' => payload['conversation_sid'],
257
+ 'message_sid' => payload['message_sid'],
258
+ 'sid' => payload['sid'],
259
+ 'channel_message_sid' => payload['channel_message_sid'],
260
+ 'participant_sid' => payload['participant_sid'],
261
+ 'status' => payload['status'],
262
+ 'error_code' => payload['error_code'].to_i,
263
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
264
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
265
+ 'url' => payload['url'],
266
+ }
267
+
268
+ # Context
269
+ @instance_context = nil
270
+ @params = {
271
+ 'chat_service_sid' => chat_service_sid,
272
+ 'conversation_sid' => conversation_sid,
273
+ 'message_sid' => message_sid,
274
+ 'sid' => sid || @properties['sid'],
275
+ }
276
+ end
277
+
278
+ ##
279
+ # Generate an instance context for the instance, the context is capable of
280
+ # performing various actions. All instance actions are proxied to the context
281
+ # @return [DeliveryReceiptContext] DeliveryReceiptContext for this DeliveryReceiptInstance
282
+ def context
283
+ unless @instance_context
284
+ @instance_context = DeliveryReceiptContext.new(
285
+ @version,
286
+ @params['chat_service_sid'],
287
+ @params['conversation_sid'],
288
+ @params['message_sid'],
289
+ @params['sid'],
290
+ )
291
+ end
292
+ @instance_context
293
+ end
294
+
295
+ ##
296
+ # @return [String] The unique ID of the Account responsible for this participant.
297
+ def account_sid
298
+ @properties['account_sid']
299
+ end
300
+
301
+ ##
302
+ # @return [String] The SID of the Conversation Service that the resource is associated with.
303
+ def chat_service_sid
304
+ @properties['chat_service_sid']
305
+ end
306
+
307
+ ##
308
+ # @return [String] The unique ID of the Conversation for this message.
309
+ def conversation_sid
310
+ @properties['conversation_sid']
311
+ end
312
+
313
+ ##
314
+ # @return [String] The SID of the message the delivery receipt belongs to
315
+ def message_sid
316
+ @properties['message_sid']
317
+ end
318
+
319
+ ##
320
+ # @return [String] A 34 character string that uniquely identifies this resource.
321
+ def sid
322
+ @properties['sid']
323
+ end
324
+
325
+ ##
326
+ # @return [String] A messaging channel-specific identifier for the message delivered to participant
327
+ def channel_message_sid
328
+ @properties['channel_message_sid']
329
+ end
330
+
331
+ ##
332
+ # @return [String] The unique ID of the participant the delivery receipt belongs to.
333
+ def participant_sid
334
+ @properties['participant_sid']
335
+ end
336
+
337
+ ##
338
+ # @return [delivery_receipt.DeliveryStatus] The message delivery status
339
+ def status
340
+ @properties['status']
341
+ end
342
+
343
+ ##
344
+ # @return [String] The message [delivery error code](https://www.twilio.com/docs/sms/api/message-resource#delivery-related-errors) for a `failed` status
345
+ def error_code
346
+ @properties['error_code']
347
+ end
348
+
349
+ ##
350
+ # @return [Time] The date that this resource was created.
351
+ def date_created
352
+ @properties['date_created']
353
+ end
354
+
355
+ ##
356
+ # @return [Time] The date that this resource was last updated.
357
+ def date_updated
358
+ @properties['date_updated']
359
+ end
360
+
361
+ ##
362
+ # @return [String] An absolute URL for this delivery receipt.
363
+ def url
364
+ @properties['url']
365
+ end
366
+
367
+ ##
368
+ # Fetch the DeliveryReceiptInstance
369
+ # @return [DeliveryReceiptInstance] Fetched DeliveryReceiptInstance
370
+ def fetch
371
+ context.fetch
372
+ end
373
+
374
+ ##
375
+ # Provide a user friendly representation
376
+ def to_s
377
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
378
+ "<Twilio.Conversations.V1.DeliveryReceiptInstance #{values}>"
379
+ end
380
+
381
+ ##
382
+ # Provide a detailed, user friendly representation
383
+ def inspect
384
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
385
+ "<Twilio.Conversations.V1.DeliveryReceiptInstance #{values}>"
386
+ end
387
+ end
388
+ end
389
+ end
390
+ end
391
+ end
392
+ end
393
+ end
394
+ end
@@ -0,0 +1,519 @@
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 ConversationContext < InstanceContext
15
+ ##
16
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
17
+ class ParticipantList < ListResource
18
+ ##
19
+ # Initialize the ParticipantList
20
+ # @param [Version] version Version that contains the resource
21
+ # @param [String] chat_service_sid The SID of the [Conversation
22
+ # Service](https://www.twilio.com/docs/conversations/api/service-resource) the
23
+ # Participant resource is associated with.
24
+ # @param [String] conversation_sid The unique ID of the
25
+ # [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource)
26
+ # for this participant.
27
+ # @return [ParticipantList] ParticipantList
28
+ def initialize(version, chat_service_sid: nil, conversation_sid: nil)
29
+ super(version)
30
+
31
+ # Path Solution
32
+ @solution = {chat_service_sid: chat_service_sid, conversation_sid: conversation_sid}
33
+ @uri = "/Services/#{@solution[:chat_service_sid]}/Conversations/#{@solution[:conversation_sid]}/Participants"
34
+ end
35
+
36
+ ##
37
+ # Create the ParticipantInstance
38
+ # @param [String] identity A unique string identifier for the conversation
39
+ # participant as [Conversation
40
+ # User](https://www.twilio.com/docs/conversations/api/user-resource). This
41
+ # parameter is non-null if (and only if) the participant is using the Conversation
42
+ # SDK to communicate. Limited to 256 characters.
43
+ # @param [String] messaging_binding_address The address of the participant's
44
+ # device, e.g. a phone or WhatsApp number. Together with the Proxy address, this
45
+ # determines a participant uniquely. This field (with proxy_address) is only null
46
+ # when the participant is interacting from an SDK endpoint (see the 'identity'
47
+ # field).
48
+ # @param [String] messaging_binding_proxy_address The address of the Twilio phone
49
+ # number (or WhatsApp number) that the participant is in contact with. This field,
50
+ # together with participant address, is only null when the participant is
51
+ # interacting from an SDK endpoint (see the 'identity' field).
52
+ # @param [Time] date_created The date that this resource was created.
53
+ # @param [Time] date_updated The date that this resource was last updated.
54
+ # @param [String] attributes An optional string metadata field you can use to
55
+ # store any data you wish. The string value must contain structurally valid JSON
56
+ # if specified. **Note** that if the attributes are not set "{}" will be
57
+ # returned.
58
+ # @param [String] messaging_binding_projected_address The address of the Twilio
59
+ # phone number that is used in Group MMS. Communication mask for the Conversation
60
+ # participant with Identity.
61
+ # @param [String] role_sid The SID of a conversation-level
62
+ # [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to
63
+ # the participant.
64
+ # @param [participant.WebhookEnabledType] x_twilio_webhook_enabled The
65
+ # X-Twilio-Webhook-Enabled HTTP request header
66
+ # @return [ParticipantInstance] Created ParticipantInstance
67
+ def create(identity: :unset, messaging_binding_address: :unset, messaging_binding_proxy_address: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, messaging_binding_projected_address: :unset, role_sid: :unset, x_twilio_webhook_enabled: :unset)
68
+ data = Twilio::Values.of({
69
+ 'Identity' => identity,
70
+ 'MessagingBinding.Address' => messaging_binding_address,
71
+ 'MessagingBinding.ProxyAddress' => messaging_binding_proxy_address,
72
+ 'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
73
+ 'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
74
+ 'Attributes' => attributes,
75
+ 'MessagingBinding.ProjectedAddress' => messaging_binding_projected_address,
76
+ 'RoleSid' => role_sid,
77
+ })
78
+ headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
79
+
80
+ payload = @version.create('POST', @uri, data: data, headers: headers)
81
+
82
+ ParticipantInstance.new(
83
+ @version,
84
+ payload,
85
+ chat_service_sid: @solution[:chat_service_sid],
86
+ conversation_sid: @solution[:conversation_sid],
87
+ )
88
+ end
89
+
90
+ ##
91
+ # Lists ParticipantInstance records from the API as a list.
92
+ # Unlike stream(), this operation is eager and will load `limit` records into
93
+ # memory before returning.
94
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
95
+ # guarantees to never return more than limit. Default is no limit
96
+ # @param [Integer] page_size Number of records to fetch per request, when
97
+ # not set will use the default value of 50 records. If no page_size is defined
98
+ # but a limit is defined, stream() will attempt to read the limit with the most
99
+ # efficient page size, i.e. min(limit, 1000)
100
+ # @return [Array] Array of up to limit results
101
+ def list(limit: nil, page_size: nil)
102
+ self.stream(limit: limit, page_size: page_size).entries
103
+ end
104
+
105
+ ##
106
+ # Streams ParticipantInstance records from the API as an Enumerable.
107
+ # This operation lazily loads records as efficiently as possible until the limit
108
+ # is reached.
109
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
110
+ # guarantees to never return more than limit. Default is no limit.
111
+ # @param [Integer] page_size Number of records to fetch per request, when
112
+ # not set will use the default value of 50 records. If no page_size is defined
113
+ # but a limit is defined, stream() will attempt to read the limit with the most
114
+ # efficient page size, i.e. min(limit, 1000)
115
+ # @return [Enumerable] Enumerable that will yield up to limit results
116
+ def stream(limit: nil, page_size: nil)
117
+ limits = @version.read_limits(limit, page_size)
118
+
119
+ page = self.page(page_size: limits[:page_size], )
120
+
121
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
122
+ end
123
+
124
+ ##
125
+ # When passed a block, yields ParticipantInstance records from the API.
126
+ # This operation lazily loads records as efficiently as possible until the limit
127
+ # is reached.
128
+ def each
129
+ limits = @version.read_limits
130
+
131
+ page = self.page(page_size: limits[:page_size], )
132
+
133
+ @version.stream(page,
134
+ limit: limits[:limit],
135
+ page_limit: limits[:page_limit]).each {|x| yield x}
136
+ end
137
+
138
+ ##
139
+ # Retrieve a single page of ParticipantInstance records from the API.
140
+ # Request is executed immediately.
141
+ # @param [String] page_token PageToken provided by the API
142
+ # @param [Integer] page_number Page Number, this value is simply for client state
143
+ # @param [Integer] page_size Number of records to return, defaults to 50
144
+ # @return [Page] Page of ParticipantInstance
145
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
146
+ params = Twilio::Values.of({
147
+ 'PageToken' => page_token,
148
+ 'Page' => page_number,
149
+ 'PageSize' => page_size,
150
+ })
151
+
152
+ response = @version.page('GET', @uri, params: params)
153
+
154
+ ParticipantPage.new(@version, response, @solution)
155
+ end
156
+
157
+ ##
158
+ # Retrieve a single page of ParticipantInstance records from the API.
159
+ # Request is executed immediately.
160
+ # @param [String] target_url API-generated URL for the requested results page
161
+ # @return [Page] Page of ParticipantInstance
162
+ def get_page(target_url)
163
+ response = @version.domain.request(
164
+ 'GET',
165
+ target_url
166
+ )
167
+ ParticipantPage.new(@version, response, @solution)
168
+ end
169
+
170
+ ##
171
+ # Provide a user friendly representation
172
+ def to_s
173
+ '#<Twilio.Conversations.V1.ParticipantList>'
174
+ end
175
+ end
176
+
177
+ ##
178
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
179
+ class ParticipantPage < Page
180
+ ##
181
+ # Initialize the ParticipantPage
182
+ # @param [Version] version Version that contains the resource
183
+ # @param [Response] response Response from the API
184
+ # @param [Hash] solution Path solution for the resource
185
+ # @return [ParticipantPage] ParticipantPage
186
+ def initialize(version, response, solution)
187
+ super(version, response)
188
+
189
+ # Path Solution
190
+ @solution = solution
191
+ end
192
+
193
+ ##
194
+ # Build an instance of ParticipantInstance
195
+ # @param [Hash] payload Payload response from the API
196
+ # @return [ParticipantInstance] ParticipantInstance
197
+ def get_instance(payload)
198
+ ParticipantInstance.new(
199
+ @version,
200
+ payload,
201
+ chat_service_sid: @solution[:chat_service_sid],
202
+ conversation_sid: @solution[:conversation_sid],
203
+ )
204
+ end
205
+
206
+ ##
207
+ # Provide a user friendly representation
208
+ def to_s
209
+ '<Twilio.Conversations.V1.ParticipantPage>'
210
+ end
211
+ end
212
+
213
+ ##
214
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
215
+ class ParticipantContext < InstanceContext
216
+ ##
217
+ # Initialize the ParticipantContext
218
+ # @param [Version] version Version that contains the resource
219
+ # @param [String] chat_service_sid The SID of the [Conversation
220
+ # Service](https://www.twilio.com/docs/conversations/api/service-resource) the
221
+ # Participant resource is associated with.
222
+ # @param [String] conversation_sid The unique ID of the
223
+ # [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource)
224
+ # for this participant.
225
+ # @param [String] sid A 34 character string that uniquely identifies this
226
+ # resource.
227
+ # @return [ParticipantContext] ParticipantContext
228
+ def initialize(version, chat_service_sid, conversation_sid, sid)
229
+ super(version)
230
+
231
+ # Path Solution
232
+ @solution = {chat_service_sid: chat_service_sid, conversation_sid: conversation_sid, sid: sid, }
233
+ @uri = "/Services/#{@solution[:chat_service_sid]}/Conversations/#{@solution[:conversation_sid]}/Participants/#{@solution[:sid]}"
234
+ end
235
+
236
+ ##
237
+ # Update the ParticipantInstance
238
+ # @param [Time] date_created The date that this resource was created.
239
+ # @param [Time] date_updated The date that this resource was last updated.
240
+ # @param [String] identity A unique string identifier for the conversation
241
+ # participant as [Conversation
242
+ # User](https://www.twilio.com/docs/conversations/api/user-resource). This
243
+ # parameter is non-null if (and only if) the participant is using the Conversation
244
+ # SDK to communicate. Limited to 256 characters.
245
+ # @param [String] attributes An optional string metadata field you can use to
246
+ # store any data you wish. The string value must contain structurally valid JSON
247
+ # if specified. **Note** that if the attributes are not set "{}" will be
248
+ # returned.
249
+ # @param [String] role_sid The SID of a conversation-level
250
+ # [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to
251
+ # the participant.
252
+ # @param [String] messaging_binding_proxy_address The address of the Twilio phone
253
+ # number that the participant is in contact with. 'null' value will remove it.
254
+ # @param [String] messaging_binding_projected_address The address of the Twilio
255
+ # phone number that is used in Group MMS. 'null' value will remove it.
256
+ # @param [participant.WebhookEnabledType] x_twilio_webhook_enabled The
257
+ # X-Twilio-Webhook-Enabled HTTP request header
258
+ # @return [ParticipantInstance] Updated ParticipantInstance
259
+ def update(date_created: :unset, date_updated: :unset, identity: :unset, attributes: :unset, role_sid: :unset, messaging_binding_proxy_address: :unset, messaging_binding_projected_address: :unset, x_twilio_webhook_enabled: :unset)
260
+ data = Twilio::Values.of({
261
+ 'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
262
+ 'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
263
+ 'Identity' => identity,
264
+ 'Attributes' => attributes,
265
+ 'RoleSid' => role_sid,
266
+ 'MessagingBinding.ProxyAddress' => messaging_binding_proxy_address,
267
+ 'MessagingBinding.ProjectedAddress' => messaging_binding_projected_address,
268
+ })
269
+ headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
270
+
271
+ payload = @version.update('POST', @uri, data: data, headers: headers)
272
+
273
+ ParticipantInstance.new(
274
+ @version,
275
+ payload,
276
+ chat_service_sid: @solution[:chat_service_sid],
277
+ conversation_sid: @solution[:conversation_sid],
278
+ sid: @solution[:sid],
279
+ )
280
+ end
281
+
282
+ ##
283
+ # Delete the ParticipantInstance
284
+ # @param [participant.WebhookEnabledType] x_twilio_webhook_enabled The
285
+ # X-Twilio-Webhook-Enabled HTTP request header
286
+ # @return [Boolean] true if delete succeeds, false otherwise
287
+ def delete(x_twilio_webhook_enabled: :unset)
288
+ headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
289
+
290
+ @version.delete('DELETE', @uri, headers: headers)
291
+ end
292
+
293
+ ##
294
+ # Fetch the ParticipantInstance
295
+ # @return [ParticipantInstance] Fetched ParticipantInstance
296
+ def fetch
297
+ payload = @version.fetch('GET', @uri)
298
+
299
+ ParticipantInstance.new(
300
+ @version,
301
+ payload,
302
+ chat_service_sid: @solution[:chat_service_sid],
303
+ conversation_sid: @solution[:conversation_sid],
304
+ sid: @solution[:sid],
305
+ )
306
+ end
307
+
308
+ ##
309
+ # Provide a user friendly representation
310
+ def to_s
311
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
312
+ "#<Twilio.Conversations.V1.ParticipantContext #{context}>"
313
+ end
314
+
315
+ ##
316
+ # Provide a detailed, user friendly representation
317
+ def inspect
318
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
319
+ "#<Twilio.Conversations.V1.ParticipantContext #{context}>"
320
+ end
321
+ end
322
+
323
+ ##
324
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
325
+ class ParticipantInstance < InstanceResource
326
+ ##
327
+ # Initialize the ParticipantInstance
328
+ # @param [Version] version Version that contains the resource
329
+ # @param [Hash] payload payload that contains response from Twilio
330
+ # @param [String] chat_service_sid The SID of the [Conversation
331
+ # Service](https://www.twilio.com/docs/conversations/api/service-resource) the
332
+ # Participant resource is associated with.
333
+ # @param [String] conversation_sid The unique ID of the
334
+ # [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource)
335
+ # for this participant.
336
+ # @param [String] sid A 34 character string that uniquely identifies this
337
+ # resource.
338
+ # @return [ParticipantInstance] ParticipantInstance
339
+ def initialize(version, payload, chat_service_sid: nil, conversation_sid: nil, sid: nil)
340
+ super(version)
341
+
342
+ # Marshaled Properties
343
+ @properties = {
344
+ 'account_sid' => payload['account_sid'],
345
+ 'chat_service_sid' => payload['chat_service_sid'],
346
+ 'conversation_sid' => payload['conversation_sid'],
347
+ 'sid' => payload['sid'],
348
+ 'identity' => payload['identity'],
349
+ 'attributes' => payload['attributes'],
350
+ 'messaging_binding' => payload['messaging_binding'],
351
+ 'role_sid' => payload['role_sid'],
352
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
353
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
354
+ 'url' => payload['url'],
355
+ }
356
+
357
+ # Context
358
+ @instance_context = nil
359
+ @params = {
360
+ 'chat_service_sid' => chat_service_sid,
361
+ 'conversation_sid' => conversation_sid,
362
+ 'sid' => sid || @properties['sid'],
363
+ }
364
+ end
365
+
366
+ ##
367
+ # Generate an instance context for the instance, the context is capable of
368
+ # performing various actions. All instance actions are proxied to the context
369
+ # @return [ParticipantContext] ParticipantContext for this ParticipantInstance
370
+ def context
371
+ unless @instance_context
372
+ @instance_context = ParticipantContext.new(
373
+ @version,
374
+ @params['chat_service_sid'],
375
+ @params['conversation_sid'],
376
+ @params['sid'],
377
+ )
378
+ end
379
+ @instance_context
380
+ end
381
+
382
+ ##
383
+ # @return [String] The unique ID of the Account responsible for this participant.
384
+ def account_sid
385
+ @properties['account_sid']
386
+ end
387
+
388
+ ##
389
+ # @return [String] The SID of the Conversation Service that the resource is associated with.
390
+ def chat_service_sid
391
+ @properties['chat_service_sid']
392
+ end
393
+
394
+ ##
395
+ # @return [String] The unique ID of the Conversation for this participant.
396
+ def conversation_sid
397
+ @properties['conversation_sid']
398
+ end
399
+
400
+ ##
401
+ # @return [String] A 34 character string that uniquely identifies this resource.
402
+ def sid
403
+ @properties['sid']
404
+ end
405
+
406
+ ##
407
+ # @return [String] A unique string identifier for the conversation participant as Conversation User.
408
+ def identity
409
+ @properties['identity']
410
+ end
411
+
412
+ ##
413
+ # @return [String] An optional string metadata field you can use to store any data you wish.
414
+ def attributes
415
+ @properties['attributes']
416
+ end
417
+
418
+ ##
419
+ # @return [Hash] Information about how this participant exchanges messages with the conversation.
420
+ def messaging_binding
421
+ @properties['messaging_binding']
422
+ end
423
+
424
+ ##
425
+ # @return [String] The SID of a conversation-level Role to assign to the participant
426
+ def role_sid
427
+ @properties['role_sid']
428
+ end
429
+
430
+ ##
431
+ # @return [Time] The date that this resource was created.
432
+ def date_created
433
+ @properties['date_created']
434
+ end
435
+
436
+ ##
437
+ # @return [Time] The date that this resource was last updated.
438
+ def date_updated
439
+ @properties['date_updated']
440
+ end
441
+
442
+ ##
443
+ # @return [String] An absolute URL for this participant.
444
+ def url
445
+ @properties['url']
446
+ end
447
+
448
+ ##
449
+ # Update the ParticipantInstance
450
+ # @param [Time] date_created The date that this resource was created.
451
+ # @param [Time] date_updated The date that this resource was last updated.
452
+ # @param [String] identity A unique string identifier for the conversation
453
+ # participant as [Conversation
454
+ # User](https://www.twilio.com/docs/conversations/api/user-resource). This
455
+ # parameter is non-null if (and only if) the participant is using the Conversation
456
+ # SDK to communicate. Limited to 256 characters.
457
+ # @param [String] attributes An optional string metadata field you can use to
458
+ # store any data you wish. The string value must contain structurally valid JSON
459
+ # if specified. **Note** that if the attributes are not set "{}" will be
460
+ # returned.
461
+ # @param [String] role_sid The SID of a conversation-level
462
+ # [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to
463
+ # the participant.
464
+ # @param [String] messaging_binding_proxy_address The address of the Twilio phone
465
+ # number that the participant is in contact with. 'null' value will remove it.
466
+ # @param [String] messaging_binding_projected_address The address of the Twilio
467
+ # phone number that is used in Group MMS. 'null' value will remove it.
468
+ # @param [participant.WebhookEnabledType] x_twilio_webhook_enabled The
469
+ # X-Twilio-Webhook-Enabled HTTP request header
470
+ # @return [ParticipantInstance] Updated ParticipantInstance
471
+ def update(date_created: :unset, date_updated: :unset, identity: :unset, attributes: :unset, role_sid: :unset, messaging_binding_proxy_address: :unset, messaging_binding_projected_address: :unset, x_twilio_webhook_enabled: :unset)
472
+ context.update(
473
+ date_created: date_created,
474
+ date_updated: date_updated,
475
+ identity: identity,
476
+ attributes: attributes,
477
+ role_sid: role_sid,
478
+ messaging_binding_proxy_address: messaging_binding_proxy_address,
479
+ messaging_binding_projected_address: messaging_binding_projected_address,
480
+ x_twilio_webhook_enabled: x_twilio_webhook_enabled,
481
+ )
482
+ end
483
+
484
+ ##
485
+ # Delete the ParticipantInstance
486
+ # @param [participant.WebhookEnabledType] x_twilio_webhook_enabled The
487
+ # X-Twilio-Webhook-Enabled HTTP request header
488
+ # @return [Boolean] true if delete succeeds, false otherwise
489
+ def delete(x_twilio_webhook_enabled: :unset)
490
+ context.delete(x_twilio_webhook_enabled: x_twilio_webhook_enabled, )
491
+ end
492
+
493
+ ##
494
+ # Fetch the ParticipantInstance
495
+ # @return [ParticipantInstance] Fetched ParticipantInstance
496
+ def fetch
497
+ context.fetch
498
+ end
499
+
500
+ ##
501
+ # Provide a user friendly representation
502
+ def to_s
503
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
504
+ "<Twilio.Conversations.V1.ParticipantInstance #{values}>"
505
+ end
506
+
507
+ ##
508
+ # Provide a detailed, user friendly representation
509
+ def inspect
510
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
511
+ "<Twilio.Conversations.V1.ParticipantInstance #{values}>"
512
+ end
513
+ end
514
+ end
515
+ end
516
+ end
517
+ end
518
+ end
519
+ end