twilio-ruby 5.9.0 → 5.10.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.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +12 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/local.rb +36 -24
  5. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/mobile.rb +34 -25
  6. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/toll_free.rb +30 -21
  7. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb +1 -1
  8. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +10 -4
  9. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +2 -2
  10. data/lib/twilio-ruby/rest/api/v2010/account/key.rb +2 -4
  11. data/lib/twilio-ruby/rest/api/v2010/account/message/feedback.rb +1 -1
  12. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +6 -4
  13. data/lib/twilio-ruby/rest/api/v2010/account/new_key.rb +6 -7
  14. data/lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result/payload.rb +1 -1
  15. data/lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result.rb +1 -1
  16. data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb +12 -4
  17. data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb +11 -6
  18. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb +10 -8
  19. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb +10 -8
  20. data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb +11 -9
  21. data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb +0 -1
  22. data/lib/twilio-ruby/rest/api/v2010/account/sip.rb +2 -1
  23. data/lib/twilio-ruby/rest/api/v2010/account/usage/record/last_month.rb +9 -6
  24. data/lib/twilio-ruby/rest/api/v2010/account/usage/record.rb +9 -3
  25. data/lib/twilio-ruby/rest/api/v2010/account.rb +13 -9
  26. data/lib/twilio-ruby/rest/chat/v1/credential.rb +42 -24
  27. data/lib/twilio-ruby/rest/chat/v1/service/channel/invite.rb +38 -18
  28. data/lib/twilio-ruby/rest/chat/v1/service/channel/member.rb +60 -24
  29. data/lib/twilio-ruby/rest/chat/v1/service/channel/message.rb +28 -18
  30. data/lib/twilio-ruby/rest/chat/v1/service/channel.rb +33 -24
  31. data/lib/twilio-ruby/rest/chat/v1/service/role.rb +26 -16
  32. data/lib/twilio-ruby/rest/chat/v1/service/user/user_channel.rb +4 -2
  33. data/lib/twilio-ruby/rest/chat/v1/service/user.rb +43 -24
  34. data/lib/twilio-ruby/rest/chat/v1/service.rb +74 -44
  35. data/lib/twilio-ruby/rest/chat/v2/credential.rb +61 -27
  36. data/lib/twilio-ruby/rest/chat/v2/service/channel/invite.rb +41 -18
  37. data/lib/twilio-ruby/rest/chat/v2/service/channel/member.rb +43 -25
  38. data/lib/twilio-ruby/rest/chat/v2/service/channel/message.rb +76 -37
  39. data/lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb +432 -0
  40. data/lib/twilio-ruby/rest/chat/v2/service/channel.rb +90 -35
  41. data/lib/twilio-ruby/rest/chat/v2/service/role.rb +23 -16
  42. data/lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb +4 -2
  43. data/lib/twilio-ruby/rest/chat/v2/service/user.rb +43 -25
  44. data/lib/twilio-ruby/rest/chat/v2/service.rb +93 -53
  45. data/lib/twilio-ruby/rest/chat.rb +4 -2
  46. data/lib/twilio-ruby/rest/ip_messaging/v1/credential.rb +42 -24
  47. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/invite.rb +38 -18
  48. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb +60 -24
  49. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb +28 -18
  50. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +33 -24
  51. data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +26 -16
  52. data/lib/twilio-ruby/rest/ip_messaging/v1/service/user/user_channel.rb +4 -2
  53. data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +43 -24
  54. data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +74 -44
  55. data/lib/twilio-ruby/rest/ip_messaging/v2/credential.rb +61 -27
  56. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb +41 -18
  57. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/member.rb +43 -25
  58. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb +76 -37
  59. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/webhook.rb +432 -0
  60. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +90 -35
  61. data/lib/twilio-ruby/rest/ip_messaging/v2/service/role.rb +23 -16
  62. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb +4 -2
  63. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb +43 -25
  64. data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +93 -53
  65. data/lib/twilio-ruby/rest/ip_messaging.rb +4 -2
  66. data/lib/twilio-ruby/rest/messaging/v1/service/short_code.rb +12 -11
  67. data/lib/twilio-ruby/rest/monitor/v1/event.rb +11 -11
  68. data/lib/twilio-ruby/rest/monitor.rb +1 -1
  69. data/lib/twilio-ruby/rest/notify/v1/credential.rb +47 -22
  70. data/lib/twilio-ruby/rest/notify/v1/service/binding.rb +59 -26
  71. data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +104 -29
  72. data/lib/twilio-ruby/rest/notify/v1/service.rb +86 -48
  73. data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb +2 -2
  74. data/lib/twilio-ruby/rest/preview/marketplace.rb +13 -13
  75. data/lib/twilio-ruby/rest/preview/understand/assistant/field_type/field_value.rb +22 -16
  76. data/lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb +21 -15
  77. data/lib/twilio-ruby/rest/preview/understand/assistant/intent/field.rb +17 -14
  78. data/lib/twilio-ruby/rest/preview/understand/assistant/intent/sample.rb +36 -25
  79. data/lib/twilio-ruby/rest/preview/understand/assistant/intent.rb +21 -15
  80. data/lib/twilio-ruby/rest/preview/understand/assistant/model_build.rb +19 -13
  81. data/lib/twilio-ruby/rest/preview/understand/assistant/query.rb +42 -28
  82. data/lib/twilio-ruby/rest/preview/understand/assistant.rb +39 -21
  83. data/lib/twilio-ruby/rest/preview.rb +10 -9
  84. data/lib/twilio-ruby/rest/pricing/v1/messaging/country.rb +5 -5
  85. data/lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb +4 -4
  86. data/lib/twilio-ruby/rest/pricing/v1/voice/country.rb +3 -3
  87. data/lib/twilio-ruby/rest/pricing/v1/voice/number.rb +5 -5
  88. data/lib/twilio-ruby/rest/sync/v1/service/document.rb +12 -13
  89. data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb +28 -22
  90. data/lib/twilio-ruby/rest/sync/v1/service/sync_list.rb +7 -5
  91. data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb +31 -14
  92. data/lib/twilio-ruby/rest/sync/v1/service/sync_map.rb +3 -3
  93. data/lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb +2 -2
  94. data/lib/twilio-ruby/rest/sync/v1/service.rb +24 -27
  95. data/lib/twilio-ruby/rest/video/v1/composition.rb +1 -1
  96. data/lib/twilio-ruby/rest/video/v1/recording.rb +45 -31
  97. data/lib/twilio-ruby/rest/video/v1/room/recording.rb +1 -1
  98. data/lib/twilio-ruby/rest/video/v1/room/room_participant.rb +18 -6
  99. data/lib/twilio-ruby/rest/video/v1.rb +13 -12
  100. data/lib/twilio-ruby/rest/video.rb +9 -8
  101. data/lib/twilio-ruby/rest/wireless/v1/command.rb +43 -33
  102. data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +48 -35
  103. data/lib/twilio-ruby/rest/wireless/v1/sim/data_session.rb +21 -23
  104. data/lib/twilio-ruby/rest/wireless/v1/sim/usage_record.rb +32 -22
  105. data/lib/twilio-ruby/rest/wireless/v1/sim.rb +121 -70
  106. data/lib/twilio-ruby/rest/wireless.rb +6 -3
  107. data/lib/twilio-ruby/version.rb +1 -1
  108. data/spec/integration/chat/v2/service/channel/webhook_spec.rb +307 -0
  109. data/spec/integration/chat/v2/service/channel_spec.rb +4 -0
  110. data/spec/integration/ip_messaging/v2/service/channel/webhook_spec.rb +307 -0
  111. data/spec/integration/ip_messaging/v2/service/channel_spec.rb +4 -0
  112. metadata +9 -3
@@ -0,0 +1,432 @@
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 IpMessaging < Domain
12
+ class V2 < Version
13
+ class ServiceContext < InstanceContext
14
+ class ChannelContext < InstanceContext
15
+ class WebhookList < ListResource
16
+ ##
17
+ # Initialize the WebhookList
18
+ # @param [Version] version Version that contains the resource
19
+ # @param [String] service_sid The service_sid
20
+ # @param [String] channel_sid The channel_sid
21
+ # @return [WebhookList] WebhookList
22
+ def initialize(version, service_sid: nil, channel_sid: nil)
23
+ super(version)
24
+
25
+ # Path Solution
26
+ @solution = {service_sid: service_sid, channel_sid: channel_sid}
27
+ @uri = "/Services/#{@solution[:service_sid]}/Channels/#{@solution[:channel_sid]}/Webhooks"
28
+ end
29
+
30
+ ##
31
+ # Lists WebhookInstance records from the API as a list.
32
+ # Unlike stream(), this operation is eager and will load `limit` records into
33
+ # memory before returning.
34
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
35
+ # guarantees to never return more than limit. Default is no limit
36
+ # @param [Integer] page_size Number of records to fetch per request, when
37
+ # not set will use the default value of 50 records. If no page_size is defined
38
+ # but a limit is defined, stream() will attempt to read the limit with the most
39
+ # efficient page size, i.e. min(limit, 1000)
40
+ # @return [Array] Array of up to limit results
41
+ def list(limit: nil, page_size: nil)
42
+ self.stream(limit: limit, page_size: page_size).entries
43
+ end
44
+
45
+ ##
46
+ # Streams WebhookInstance records from the API as an Enumerable.
47
+ # This operation lazily loads records as efficiently as possible until the limit
48
+ # is reached.
49
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
50
+ # guarantees to never return more than limit. Default is no limit.
51
+ # @param [Integer] page_size Number of records to fetch per request, when
52
+ # not set will use the default value of 50 records. If no page_size is defined
53
+ # but a limit is defined, stream() will attempt to read the limit with the most
54
+ # efficient page size, i.e. min(limit, 1000)
55
+ # @return [Enumerable] Enumerable that will yield up to limit results
56
+ def stream(limit: nil, page_size: nil)
57
+ limits = @version.read_limits(limit, page_size)
58
+
59
+ page = self.page(page_size: limits[:page_size], )
60
+
61
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
62
+ end
63
+
64
+ ##
65
+ # When passed a block, yields WebhookInstance records from the API.
66
+ # This operation lazily loads records as efficiently as possible until the limit
67
+ # is reached.
68
+ def each
69
+ limits = @version.read_limits
70
+
71
+ page = self.page(page_size: limits[:page_size], )
72
+
73
+ @version.stream(page,
74
+ limit: limits[:limit],
75
+ page_limit: limits[:page_limit]).each {|x| yield x}
76
+ end
77
+
78
+ ##
79
+ # Retrieve a single page of WebhookInstance records from the API.
80
+ # Request is executed immediately.
81
+ # @param [String] page_token PageToken provided by the API
82
+ # @param [Integer] page_number Page Number, this value is simply for client state
83
+ # @param [Integer] page_size Number of records to return, defaults to 50
84
+ # @return [Page] Page of WebhookInstance
85
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
86
+ params = Twilio::Values.of({
87
+ 'PageToken' => page_token,
88
+ 'Page' => page_number,
89
+ 'PageSize' => page_size,
90
+ })
91
+ response = @version.page(
92
+ 'GET',
93
+ @uri,
94
+ params
95
+ )
96
+ WebhookPage.new(@version, response, @solution)
97
+ end
98
+
99
+ ##
100
+ # Retrieve a single page of WebhookInstance records from the API.
101
+ # Request is executed immediately.
102
+ # @param [String] target_url API-generated URL for the requested results page
103
+ # @return [Page] Page of WebhookInstance
104
+ def get_page(target_url)
105
+ response = @version.domain.request(
106
+ 'GET',
107
+ target_url
108
+ )
109
+ WebhookPage.new(@version, response, @solution)
110
+ end
111
+
112
+ ##
113
+ # Retrieve a single page of WebhookInstance records from the API.
114
+ # Request is executed immediately.
115
+ # @param [webhook.Type] type The type
116
+ # @param [String] configuration_url The configuration.url
117
+ # @param [webhook.Method] configuration_method The configuration.method
118
+ # @param [String] configuration_filters The configuration.filters
119
+ # @param [String] configuration_triggers The configuration.triggers
120
+ # @param [String] configuration_flow_sid The configuration.flow_sid
121
+ # @param [String] configuration_retry_count The configuration.retry_count
122
+ # @return [WebhookInstance] Newly created WebhookInstance
123
+ def create(type: nil, configuration_url: :unset, configuration_method: :unset, configuration_filters: :unset, configuration_triggers: :unset, configuration_flow_sid: :unset, configuration_retry_count: :unset)
124
+ data = Twilio::Values.of({
125
+ 'Type' => type,
126
+ 'Configuration.Url' => configuration_url,
127
+ 'Configuration.Method' => configuration_method,
128
+ 'Configuration.Filters' => Twilio.serialize_list(configuration_filters) { |e| e },
129
+ 'Configuration.Triggers' => Twilio.serialize_list(configuration_triggers) { |e| e },
130
+ 'Configuration.FlowSid' => configuration_flow_sid,
131
+ 'Configuration.RetryCount' => configuration_retry_count,
132
+ })
133
+
134
+ payload = @version.create(
135
+ 'POST',
136
+ @uri,
137
+ data: data
138
+ )
139
+
140
+ WebhookInstance.new(
141
+ @version,
142
+ payload,
143
+ service_sid: @solution[:service_sid],
144
+ channel_sid: @solution[:channel_sid],
145
+ )
146
+ end
147
+
148
+ ##
149
+ # Provide a user friendly representation
150
+ def to_s
151
+ '#<Twilio.IpMessaging.V2.WebhookList>'
152
+ end
153
+ end
154
+
155
+ class WebhookPage < Page
156
+ ##
157
+ # Initialize the WebhookPage
158
+ # @param [Version] version Version that contains the resource
159
+ # @param [Response] response Response from the API
160
+ # @param [Hash] solution Path solution for the resource
161
+ # @return [WebhookPage] WebhookPage
162
+ def initialize(version, response, solution)
163
+ super(version, response)
164
+
165
+ # Path Solution
166
+ @solution = solution
167
+ end
168
+
169
+ ##
170
+ # Build an instance of WebhookInstance
171
+ # @param [Hash] payload Payload response from the API
172
+ # @return [WebhookInstance] WebhookInstance
173
+ def get_instance(payload)
174
+ WebhookInstance.new(
175
+ @version,
176
+ payload,
177
+ service_sid: @solution[:service_sid],
178
+ channel_sid: @solution[:channel_sid],
179
+ )
180
+ end
181
+
182
+ ##
183
+ # Provide a user friendly representation
184
+ def to_s
185
+ '<Twilio.IpMessaging.V2.WebhookPage>'
186
+ end
187
+ end
188
+
189
+ class WebhookContext < InstanceContext
190
+ ##
191
+ # Initialize the WebhookContext
192
+ # @param [Version] version Version that contains the resource
193
+ # @param [String] service_sid The service_sid
194
+ # @param [String] channel_sid The channel_sid
195
+ # @param [String] sid The sid
196
+ # @return [WebhookContext] WebhookContext
197
+ def initialize(version, service_sid, channel_sid, sid)
198
+ super(version)
199
+
200
+ # Path Solution
201
+ @solution = {service_sid: service_sid, channel_sid: channel_sid, sid: sid, }
202
+ @uri = "/Services/#{@solution[:service_sid]}/Channels/#{@solution[:channel_sid]}/Webhooks/#{@solution[:sid]}"
203
+ end
204
+
205
+ ##
206
+ # Fetch a WebhookInstance
207
+ # @return [WebhookInstance] Fetched WebhookInstance
208
+ def fetch
209
+ params = Twilio::Values.of({})
210
+
211
+ payload = @version.fetch(
212
+ 'GET',
213
+ @uri,
214
+ params,
215
+ )
216
+
217
+ WebhookInstance.new(
218
+ @version,
219
+ payload,
220
+ service_sid: @solution[:service_sid],
221
+ channel_sid: @solution[:channel_sid],
222
+ sid: @solution[:sid],
223
+ )
224
+ end
225
+
226
+ ##
227
+ # Update the WebhookInstance
228
+ # @param [String] configuration_url The configuration.url
229
+ # @param [webhook.Method] configuration_method The configuration.method
230
+ # @param [String] configuration_filters The configuration.filters
231
+ # @param [String] configuration_triggers The configuration.triggers
232
+ # @param [String] configuration_flow_sid The configuration.flow_sid
233
+ # @param [String] configuration_retry_count The configuration.retry_count
234
+ # @return [WebhookInstance] Updated WebhookInstance
235
+ def update(configuration_url: :unset, configuration_method: :unset, configuration_filters: :unset, configuration_triggers: :unset, configuration_flow_sid: :unset, configuration_retry_count: :unset)
236
+ data = Twilio::Values.of({
237
+ 'Configuration.Url' => configuration_url,
238
+ 'Configuration.Method' => configuration_method,
239
+ 'Configuration.Filters' => Twilio.serialize_list(configuration_filters) { |e| e },
240
+ 'Configuration.Triggers' => Twilio.serialize_list(configuration_triggers) { |e| e },
241
+ 'Configuration.FlowSid' => configuration_flow_sid,
242
+ 'Configuration.RetryCount' => configuration_retry_count,
243
+ })
244
+
245
+ payload = @version.update(
246
+ 'POST',
247
+ @uri,
248
+ data: data,
249
+ )
250
+
251
+ WebhookInstance.new(
252
+ @version,
253
+ payload,
254
+ service_sid: @solution[:service_sid],
255
+ channel_sid: @solution[:channel_sid],
256
+ sid: @solution[:sid],
257
+ )
258
+ end
259
+
260
+ ##
261
+ # Deletes the WebhookInstance
262
+ # @return [Boolean] true if delete succeeds, true otherwise
263
+ def delete
264
+ @version.delete('delete', @uri)
265
+ end
266
+
267
+ ##
268
+ # Provide a user friendly representation
269
+ def to_s
270
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
271
+ "#<Twilio.IpMessaging.V2.WebhookContext #{context}>"
272
+ end
273
+ end
274
+
275
+ class WebhookInstance < InstanceResource
276
+ ##
277
+ # Initialize the WebhookInstance
278
+ # @param [Version] version Version that contains the resource
279
+ # @param [Hash] payload payload that contains response from Twilio
280
+ # @param [String] service_sid The service_sid
281
+ # @param [String] channel_sid The channel_sid
282
+ # @param [String] sid The sid
283
+ # @return [WebhookInstance] WebhookInstance
284
+ def initialize(version, payload, service_sid: nil, channel_sid: nil, sid: nil)
285
+ super(version)
286
+
287
+ # Marshaled Properties
288
+ @properties = {
289
+ 'sid' => payload['sid'],
290
+ 'account_sid' => payload['account_sid'],
291
+ 'service_sid' => payload['service_sid'],
292
+ 'channel_sid' => payload['channel_sid'],
293
+ 'type' => payload['type'],
294
+ 'url' => payload['url'],
295
+ 'configuration' => payload['configuration'],
296
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
297
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
298
+ }
299
+
300
+ # Context
301
+ @instance_context = nil
302
+ @params = {
303
+ 'service_sid' => service_sid,
304
+ 'channel_sid' => channel_sid,
305
+ 'sid' => sid || @properties['sid'],
306
+ }
307
+ end
308
+
309
+ ##
310
+ # Generate an instance context for the instance, the context is capable of
311
+ # performing various actions. All instance actions are proxied to the context
312
+ # @return [WebhookContext] WebhookContext for this WebhookInstance
313
+ def context
314
+ unless @instance_context
315
+ @instance_context = WebhookContext.new(
316
+ @version,
317
+ @params['service_sid'],
318
+ @params['channel_sid'],
319
+ @params['sid'],
320
+ )
321
+ end
322
+ @instance_context
323
+ end
324
+
325
+ ##
326
+ # @return [String] The sid
327
+ def sid
328
+ @properties['sid']
329
+ end
330
+
331
+ ##
332
+ # @return [String] The account_sid
333
+ def account_sid
334
+ @properties['account_sid']
335
+ end
336
+
337
+ ##
338
+ # @return [String] The service_sid
339
+ def service_sid
340
+ @properties['service_sid']
341
+ end
342
+
343
+ ##
344
+ # @return [String] The channel_sid
345
+ def channel_sid
346
+ @properties['channel_sid']
347
+ end
348
+
349
+ ##
350
+ # @return [String] The type
351
+ def type
352
+ @properties['type']
353
+ end
354
+
355
+ ##
356
+ # @return [String] The url
357
+ def url
358
+ @properties['url']
359
+ end
360
+
361
+ ##
362
+ # @return [Hash] The configuration
363
+ def configuration
364
+ @properties['configuration']
365
+ end
366
+
367
+ ##
368
+ # @return [Time] The date_created
369
+ def date_created
370
+ @properties['date_created']
371
+ end
372
+
373
+ ##
374
+ # @return [Time] The date_updated
375
+ def date_updated
376
+ @properties['date_updated']
377
+ end
378
+
379
+ ##
380
+ # Fetch a WebhookInstance
381
+ # @return [WebhookInstance] Fetched WebhookInstance
382
+ def fetch
383
+ context.fetch
384
+ end
385
+
386
+ ##
387
+ # Update the WebhookInstance
388
+ # @param [String] configuration_url The configuration.url
389
+ # @param [webhook.Method] configuration_method The configuration.method
390
+ # @param [String] configuration_filters The configuration.filters
391
+ # @param [String] configuration_triggers The configuration.triggers
392
+ # @param [String] configuration_flow_sid The configuration.flow_sid
393
+ # @param [String] configuration_retry_count The configuration.retry_count
394
+ # @return [WebhookInstance] Updated WebhookInstance
395
+ def update(configuration_url: :unset, configuration_method: :unset, configuration_filters: :unset, configuration_triggers: :unset, configuration_flow_sid: :unset, configuration_retry_count: :unset)
396
+ context.update(
397
+ configuration_url: configuration_url,
398
+ configuration_method: configuration_method,
399
+ configuration_filters: configuration_filters,
400
+ configuration_triggers: configuration_triggers,
401
+ configuration_flow_sid: configuration_flow_sid,
402
+ configuration_retry_count: configuration_retry_count,
403
+ )
404
+ end
405
+
406
+ ##
407
+ # Deletes the WebhookInstance
408
+ # @return [Boolean] true if delete succeeds, true otherwise
409
+ def delete
410
+ context.delete
411
+ end
412
+
413
+ ##
414
+ # Provide a user friendly representation
415
+ def to_s
416
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
417
+ "<Twilio.IpMessaging.V2.WebhookInstance #{values}>"
418
+ end
419
+
420
+ ##
421
+ # Provide a detailed, user friendly representation
422
+ def inspect
423
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
424
+ "<Twilio.IpMessaging.V2.WebhookInstance #{values}>"
425
+ end
426
+ end
427
+ end
428
+ end
429
+ end
430
+ end
431
+ end
432
+ end
@@ -15,7 +15,9 @@ module Twilio
15
15
  ##
16
16
  # Initialize the ChannelList
17
17
  # @param [Version] version Version that contains the resource
18
- # @param [String] service_sid The service_sid
18
+ # @param [String] service_sid The unique id of the
19
+ # [Service](https://www.twilio.com/docs/chat/api/services) this channel belongs
20
+ # to.
19
21
  # @return [ChannelList] ChannelList
20
22
  def initialize(version, service_sid: nil)
21
23
  super(version)
@@ -28,13 +30,24 @@ module Twilio
28
30
  ##
29
31
  # Retrieve a single page of ChannelInstance records from the API.
30
32
  # Request is executed immediately.
31
- # @param [String] friendly_name The friendly_name
32
- # @param [String] unique_name The unique_name
33
- # @param [String] attributes The attributes
34
- # @param [channel.ChannelType] type The type
35
- # @param [Time] date_created The date_created
36
- # @param [Time] date_updated The date_updated
37
- # @param [String] created_by The created_by
33
+ # @param [String] friendly_name A human-readable name for the Channel. Optional.
34
+ # @param [String] unique_name A unique, addressable name for the Channel.
35
+ # Optional.
36
+ # @param [String] attributes An optional metadata field you can use to store any
37
+ # data you wish. No processing or validation is done on this field.
38
+ # @param [channel.ChannelType] type The visibility of the channel - `public` or
39
+ # `private`. Defaults to `public`.
40
+ # @param [Time] date_created The optional ISO8601 time specifying the datetime the
41
+ # Channel should be set as being created. Will be set to the current time by the
42
+ # Chat service if not specified. Note that this should only be used in cases
43
+ # where a a Channel is being recreated from a backup/separate source
44
+ # @param [Time] date_updated The optional ISO8601 time specifying the datetime the
45
+ # Channel should be set as having been last updated. Will be set to the `null` by
46
+ # the Chat service if not specified. Note that this should only be used in cases
47
+ # where a Channel is being recreated from a backup/separate source and where a
48
+ # Message was previously updated.
49
+ # @param [String] created_by Optional field to specify the Identity of the User
50
+ # that created the Channel. Will be set to "system" if not specified.
38
51
  # @return [ChannelInstance] Newly created ChannelInstance
39
52
  def create(friendly_name: :unset, unique_name: :unset, attributes: :unset, type: :unset, date_created: :unset, date_updated: :unset, created_by: :unset)
40
53
  data = Twilio::Values.of({
@@ -196,6 +209,7 @@ module Twilio
196
209
  @members = nil
197
210
  @messages = nil
198
211
  @invites = nil
212
+ @webhooks = nil
199
213
  end
200
214
 
201
215
  ##
@@ -222,12 +236,17 @@ module Twilio
222
236
 
223
237
  ##
224
238
  # Update the ChannelInstance
225
- # @param [String] friendly_name The friendly_name
226
- # @param [String] unique_name The unique_name
227
- # @param [String] attributes The attributes
228
- # @param [Time] date_created The date_created
229
- # @param [Time] date_updated The date_updated
230
- # @param [String] created_by The created_by
239
+ # @param [String] friendly_name A human-readable name for the Channel. Optional.
240
+ # @param [String] unique_name A unique, addressable name for the Channel.
241
+ # Optional.
242
+ # @param [String] attributes An optional metadata field you can use to store any
243
+ # data you wish. No processing or validation is done on this field.
244
+ # @param [Time] date_created The optional ISO8601 time specifying the datetime the
245
+ # Channel should be set as being created.
246
+ # @param [Time] date_updated The optional ISO8601 time specifying the datetime the
247
+ # Channel should be set as having been last updated.
248
+ # @param [String] created_by Optional field to specify the Identity of the User
249
+ # that created the Channel.
231
250
  # @return [ChannelInstance] Updated ChannelInstance
232
251
  def update(friendly_name: :unset, unique_name: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, created_by: :unset)
233
252
  data = Twilio::Values.of({
@@ -314,6 +333,28 @@ module Twilio
314
333
  @invites
315
334
  end
316
335
 
336
+ ##
337
+ # Access the webhooks
338
+ # @return [WebhookList]
339
+ # @return [WebhookContext] if sid was passed.
340
+ def webhooks(sid=:unset)
341
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
342
+
343
+ if sid != :unset
344
+ return WebhookContext.new(@version, @solution[:service_sid], @solution[:sid], sid, )
345
+ end
346
+
347
+ unless @webhooks
348
+ @webhooks = WebhookList.new(
349
+ @version,
350
+ service_sid: @solution[:service_sid],
351
+ channel_sid: @solution[:sid],
352
+ )
353
+ end
354
+
355
+ @webhooks
356
+ end
357
+
317
358
  ##
318
359
  # Provide a user friendly representation
319
360
  def to_s
@@ -327,7 +368,9 @@ module Twilio
327
368
  # Initialize the ChannelInstance
328
369
  # @param [Version] version Version that contains the resource
329
370
  # @param [Hash] payload payload that contains response from Twilio
330
- # @param [String] service_sid The service_sid
371
+ # @param [String] service_sid The unique id of the
372
+ # [Service](https://www.twilio.com/docs/chat/api/services) this channel belongs
373
+ # to.
331
374
  # @param [String] sid The sid
332
375
  # @return [ChannelInstance] ChannelInstance
333
376
  def initialize(version, payload, service_sid: nil, sid: nil)
@@ -368,85 +411,85 @@ module Twilio
368
411
  end
369
412
 
370
413
  ##
371
- # @return [String] The sid
414
+ # @return [String] A 34 character string that uniquely identifies this resource.
372
415
  def sid
373
416
  @properties['sid']
374
417
  end
375
418
 
376
419
  ##
377
- # @return [String] The account_sid
420
+ # @return [String] The unique id of the Account responsible for this channel.
378
421
  def account_sid
379
422
  @properties['account_sid']
380
423
  end
381
424
 
382
425
  ##
383
- # @return [String] The service_sid
426
+ # @return [String] The unique id of the Service this channel belongs to.
384
427
  def service_sid
385
428
  @properties['service_sid']
386
429
  end
387
430
 
388
431
  ##
389
- # @return [String] The friendly_name
432
+ # @return [String] The human-readable name of this channel.
390
433
  def friendly_name
391
434
  @properties['friendly_name']
392
435
  end
393
436
 
394
437
  ##
395
- # @return [String] The unique_name
438
+ # @return [String] The unique, addressable name of this channel.
396
439
  def unique_name
397
440
  @properties['unique_name']
398
441
  end
399
442
 
400
443
  ##
401
- # @return [String] The attributes
444
+ # @return [String] An optional string metadata field you can use to store any data you wish.
402
445
  def attributes
403
446
  @properties['attributes']
404
447
  end
405
448
 
406
449
  ##
407
- # @return [channel.ChannelType] The type
450
+ # @return [channel.ChannelType] The visibility of this channel - either public or private
408
451
  def type
409
452
  @properties['type']
410
453
  end
411
454
 
412
455
  ##
413
- # @return [Time] The date_created
456
+ # @return [Time] The date that this resource was created.
414
457
  def date_created
415
458
  @properties['date_created']
416
459
  end
417
460
 
418
461
  ##
419
- # @return [Time] The date_updated
462
+ # @return [Time] The date that this resource was last updated.
420
463
  def date_updated
421
464
  @properties['date_updated']
422
465
  end
423
466
 
424
467
  ##
425
- # @return [String] The created_by
468
+ # @return [String] Identity of the channel's creator.
426
469
  def created_by
427
470
  @properties['created_by']
428
471
  end
429
472
 
430
473
  ##
431
- # @return [String] The members_count
474
+ # @return [String] The number of Members in the Channel
432
475
  def members_count
433
476
  @properties['members_count']
434
477
  end
435
478
 
436
479
  ##
437
- # @return [String] The messages_count
480
+ # @return [String] The number of Messages in the Channel
438
481
  def messages_count
439
482
  @properties['messages_count']
440
483
  end
441
484
 
442
485
  ##
443
- # @return [String] The url
486
+ # @return [String] An absolute URL for this channel.
444
487
  def url
445
488
  @properties['url']
446
489
  end
447
490
 
448
491
  ##
449
- # @return [String] The links
492
+ # @return [String] Absolute URLs to access the Members, Messages , Invites and, if it exists the last Message for this Channel.
450
493
  def links
451
494
  @properties['links']
452
495
  end
@@ -467,12 +510,17 @@ module Twilio
467
510
 
468
511
  ##
469
512
  # Update the ChannelInstance
470
- # @param [String] friendly_name The friendly_name
471
- # @param [String] unique_name The unique_name
472
- # @param [String] attributes The attributes
473
- # @param [Time] date_created The date_created
474
- # @param [Time] date_updated The date_updated
475
- # @param [String] created_by The created_by
513
+ # @param [String] friendly_name A human-readable name for the Channel. Optional.
514
+ # @param [String] unique_name A unique, addressable name for the Channel.
515
+ # Optional.
516
+ # @param [String] attributes An optional metadata field you can use to store any
517
+ # data you wish. No processing or validation is done on this field.
518
+ # @param [Time] date_created The optional ISO8601 time specifying the datetime the
519
+ # Channel should be set as being created.
520
+ # @param [Time] date_updated The optional ISO8601 time specifying the datetime the
521
+ # Channel should be set as having been last updated.
522
+ # @param [String] created_by Optional field to specify the Identity of the User
523
+ # that created the Channel.
476
524
  # @return [ChannelInstance] Updated ChannelInstance
477
525
  def update(friendly_name: :unset, unique_name: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, created_by: :unset)
478
526
  context.update(
@@ -506,6 +554,13 @@ module Twilio
506
554
  context.invites
507
555
  end
508
556
 
557
+ ##
558
+ # Access the webhooks
559
+ # @return [webhooks] webhooks
560
+ def webhooks
561
+ context.webhooks
562
+ end
563
+
509
564
  ##
510
565
  # Provide a user friendly representation
511
566
  def to_s