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
@@ -16,8 +16,11 @@ module Twilio
16
16
  ##
17
17
  # Initialize the MemberList
18
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
19
+ # @param [String] service_sid The unique id of the
20
+ # [Service](https://www.twilio.com/docs/api/chat/rest/services) this member
21
+ # belongs to.
22
+ # @param [String] channel_sid The unique id of the
23
+ # [Channel](https://www.twilio.com/docs/api/chat/rest/channels) for this member.
21
24
  # @return [MemberList] MemberList
22
25
  def initialize(version, service_sid: nil, channel_sid: nil)
23
26
  super(version)
@@ -234,11 +237,17 @@ module Twilio
234
237
 
235
238
  ##
236
239
  # Update the MemberInstance
237
- # @param [String] role_sid The role_sid
238
- # @param [String] last_consumed_message_index The last_consumed_message_index
239
- # @param [Time] last_consumption_timestamp The last_consumption_timestamp
240
- # @param [Time] date_created The date_created
241
- # @param [Time] date_updated The date_updated
240
+ # @param [String] role_sid The role to be assigned to this member. Defaults to the
241
+ # roles specified on the
242
+ # [Service](https://www.twilio.com/docs/api/chat/rest/services).
243
+ # @param [String] last_consumed_message_index Optional field used to specify the
244
+ # last consumed Message index for the Channel for this Member.
245
+ # @param [Time] last_consumption_timestamp Optional ISO8601 time indicating the
246
+ # last datetime the Member consumed a Message in the Channel.
247
+ # @param [Time] date_created The optional ISO8601 time specifying the datetime the
248
+ # Members should be set as being created.
249
+ # @param [Time] date_updated The optional ISO8601 time specifying the datetime the
250
+ # Member should be set as having been last updated.
242
251
  # @return [MemberInstance] Updated MemberInstance
243
252
  def update(role_sid: :unset, last_consumed_message_index: :unset, last_consumption_timestamp: :unset, date_created: :unset, date_updated: :unset)
244
253
  data = Twilio::Values.of({
@@ -277,8 +286,11 @@ module Twilio
277
286
  # Initialize the MemberInstance
278
287
  # @param [Version] version Version that contains the resource
279
288
  # @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
289
+ # @param [String] service_sid The unique id of the
290
+ # [Service](https://www.twilio.com/docs/api/chat/rest/services) this member
291
+ # belongs to.
292
+ # @param [String] channel_sid The unique id of the
293
+ # [Channel](https://www.twilio.com/docs/api/chat/rest/channels) for this member.
282
294
  # @param [String] sid The sid
283
295
  # @return [MemberInstance] MemberInstance
284
296
  def initialize(version, payload, service_sid: nil, channel_sid: nil, sid: nil)
@@ -325,67 +337,67 @@ module Twilio
325
337
  end
326
338
 
327
339
  ##
328
- # @return [String] The sid
340
+ # @return [String] A 34 character string that uniquely identifies this resource.
329
341
  def sid
330
342
  @properties['sid']
331
343
  end
332
344
 
333
345
  ##
334
- # @return [String] The account_sid
346
+ # @return [String] The unique id of the Account responsible for this member.
335
347
  def account_sid
336
348
  @properties['account_sid']
337
349
  end
338
350
 
339
351
  ##
340
- # @return [String] The channel_sid
352
+ # @return [String] The unique id of the Channel for this member.
341
353
  def channel_sid
342
354
  @properties['channel_sid']
343
355
  end
344
356
 
345
357
  ##
346
- # @return [String] The service_sid
358
+ # @return [String] The unique id of the Service this member belongs to.
347
359
  def service_sid
348
360
  @properties['service_sid']
349
361
  end
350
362
 
351
363
  ##
352
- # @return [String] The identity
364
+ # @return [String] A unique string identifier for this User in this Service.
353
365
  def identity
354
366
  @properties['identity']
355
367
  end
356
368
 
357
369
  ##
358
- # @return [Time] The date_created
370
+ # @return [Time] The date that this resource was created.
359
371
  def date_created
360
372
  @properties['date_created']
361
373
  end
362
374
 
363
375
  ##
364
- # @return [Time] The date_updated
376
+ # @return [Time] The date that this resource was last updated.
365
377
  def date_updated
366
378
  @properties['date_updated']
367
379
  end
368
380
 
369
381
  ##
370
- # @return [String] The role_sid
382
+ # @return [String] The Role assigned to this member.
371
383
  def role_sid
372
384
  @properties['role_sid']
373
385
  end
374
386
 
375
387
  ##
376
- # @return [String] The last_consumed_message_index
388
+ # @return [String] An Integer representing index of the last Message this Member has read within this Channel
377
389
  def last_consumed_message_index
378
390
  @properties['last_consumed_message_index']
379
391
  end
380
392
 
381
393
  ##
382
- # @return [Time] The last_consumption_timestamp
394
+ # @return [Time] An ISO8601 based timestamp string representing the datetime of the last Message read event for this Member within this Channel
383
395
  def last_consumption_timestamp
384
396
  @properties['last_consumption_timestamp']
385
397
  end
386
398
 
387
399
  ##
388
- # @return [String] The url
400
+ # @return [String] An absolute URL for this member.
389
401
  def url
390
402
  @properties['url']
391
403
  end
@@ -406,11 +418,17 @@ module Twilio
406
418
 
407
419
  ##
408
420
  # Update the MemberInstance
409
- # @param [String] role_sid The role_sid
410
- # @param [String] last_consumed_message_index The last_consumed_message_index
411
- # @param [Time] last_consumption_timestamp The last_consumption_timestamp
412
- # @param [Time] date_created The date_created
413
- # @param [Time] date_updated The date_updated
421
+ # @param [String] role_sid The role to be assigned to this member. Defaults to the
422
+ # roles specified on the
423
+ # [Service](https://www.twilio.com/docs/api/chat/rest/services).
424
+ # @param [String] last_consumed_message_index Optional field used to specify the
425
+ # last consumed Message index for the Channel for this Member.
426
+ # @param [Time] last_consumption_timestamp Optional ISO8601 time indicating the
427
+ # last datetime the Member consumed a Message in the Channel.
428
+ # @param [Time] date_created The optional ISO8601 time specifying the datetime the
429
+ # Members should be set as being created.
430
+ # @param [Time] date_updated The optional ISO8601 time specifying the datetime the
431
+ # Member should be set as having been last updated.
414
432
  # @return [MemberInstance] Updated MemberInstance
415
433
  def update(role_sid: :unset, last_consumed_message_index: :unset, last_consumption_timestamp: :unset, date_created: :unset, date_updated: :unset)
416
434
  context.update(
@@ -16,7 +16,9 @@ module Twilio
16
16
  ##
17
17
  # Initialize the MessageList
18
18
  # @param [Version] version Version that contains the resource
19
- # @param [String] service_sid The service_sid
19
+ # @param [String] service_sid The unique id of the
20
+ # [Service](https://www.twilio.com/docs/api/chat/rest/services) this message
21
+ # belongs to.
20
22
  # @param [String] channel_sid The channel_sid
21
23
  # @return [MessageList] MessageList
22
24
  def initialize(version, service_sid: nil, channel_sid: nil)
@@ -30,13 +32,28 @@ module Twilio
30
32
  ##
31
33
  # Retrieve a single page of MessageInstance records from the API.
32
34
  # Request is executed immediately.
33
- # @param [String] from The from
34
- # @param [String] attributes The attributes
35
- # @param [Time] date_created The date_created
36
- # @param [Time] date_updated The date_updated
37
- # @param [String] last_updated_by The last_updated_by
38
- # @param [String] body The body
39
- # @param [String] media_sid The media_sid
35
+ # @param [String] from The
36
+ # [identity](https://www.twilio.com/docs/api/chat/guides/identity) of the
37
+ # message's author. Defaults to `system` if not specified.
38
+ # @param [String] attributes A metadata field you can use to store any data you
39
+ # wish. The string value must contain structurally valid JSON if specified.
40
+ # @param [Time] date_created The ISO8601 time specifying the datetime the Message
41
+ # should be set as being created. Will be set to the current time by the Chat
42
+ # service if not specified. Note that this should only be used in cases where a
43
+ # Chat's history is being recreated from a backup/separate source.
44
+ # @param [Time] date_updated The ISO8601 time specifying the datetime the Message
45
+ # should be set as having been last updated. Will be set to the `null` by the Chat
46
+ # service if not specified. Note that this should only be used in cases where a
47
+ # Chat's history is being recreated from a backup/separate source and where a
48
+ # Message was previously updated.
49
+ # @param [String] last_updated_by Specify the Identity of the User that last
50
+ # updated the Message (if relevant)
51
+ # @param [String] body A string message to send to this channel. You can also send
52
+ # structured data by serializing it into a string. May be empty string or `null`,
53
+ # will be set as empty string as a result in this cases.
54
+ # @param [String] media_sid The
55
+ # [Media](https://www.twilio.com/docs/api/chat/rest/media) Sid to be attached to
56
+ # this Message.
40
57
  # @return [MessageInstance] Newly created MessageInstance
41
58
  def create(from: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, last_updated_by: :unset, body: :unset, media_sid: :unset)
42
59
  data = Twilio::Values.of({
@@ -67,7 +84,9 @@ module Twilio
67
84
  # Lists MessageInstance records from the API as a list.
68
85
  # Unlike stream(), this operation is eager and will load `limit` records into
69
86
  # memory before returning.
70
- # @param [message.OrderType] order The order
87
+ # @param [message.OrderType] order Specifies sorting order for messages list,
88
+ # possible values are: `asc` or `desc`. If no value is specified, then `asc` is
89
+ # used as the default.
71
90
  # @param [Integer] limit Upper limit for the number of records to return. stream()
72
91
  # guarantees to never return more than limit. Default is no limit
73
92
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -83,7 +102,9 @@ module Twilio
83
102
  # Streams MessageInstance records from the API as an Enumerable.
84
103
  # This operation lazily loads records as efficiently as possible until the limit
85
104
  # is reached.
86
- # @param [message.OrderType] order The order
105
+ # @param [message.OrderType] order Specifies sorting order for messages list,
106
+ # possible values are: `asc` or `desc`. If no value is specified, then `asc` is
107
+ # used as the default.
87
108
  # @param [Integer] limit Upper limit for the number of records to return. stream()
88
109
  # guarantees to never return more than limit. Default is no limit.
89
110
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -116,7 +137,9 @@ module Twilio
116
137
  ##
117
138
  # Retrieve a single page of MessageInstance records from the API.
118
139
  # Request is executed immediately.
119
- # @param [message.OrderType] order The order
140
+ # @param [message.OrderType] order Specifies sorting order for messages list,
141
+ # possible values are: `asc` or `desc`. If no value is specified, then `asc` is
142
+ # used as the default.
120
143
  # @param [String] page_token PageToken provided by the API
121
144
  # @param [Integer] page_number Page Number, this value is simply for client state
122
145
  # @param [Integer] page_size Number of records to return, defaults to 50
@@ -236,11 +259,18 @@ module Twilio
236
259
 
237
260
  ##
238
261
  # Update the MessageInstance
239
- # @param [String] body The body
240
- # @param [String] attributes The attributes
241
- # @param [Time] date_created The date_created
242
- # @param [Time] date_updated The date_updated
243
- # @param [String] last_updated_by The last_updated_by
262
+ # @param [String] body The message body string. You can also send structured data
263
+ # by serializing it into a string. May be updated to empty string or `null`, will
264
+ # be set as empty string as a result in this cases.
265
+ # @param [String] attributes The attributes metadata field you can use to store
266
+ # any data you wish. The string value must contain structurally valid JSON if
267
+ # specified.
268
+ # @param [Time] date_created The ISO8601 time specifying the datetime the Message
269
+ # should be set as being created.
270
+ # @param [Time] date_updated The ISO8601 time specifying the datetime the Message
271
+ # should be set as having been last updated.
272
+ # @param [String] last_updated_by Specify the Identity of the User that last
273
+ # updated the Message (if relevant)
244
274
  # @return [MessageInstance] Updated MessageInstance
245
275
  def update(body: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, last_updated_by: :unset)
246
276
  data = Twilio::Values.of({
@@ -279,7 +309,9 @@ module Twilio
279
309
  # Initialize the MessageInstance
280
310
  # @param [Version] version Version that contains the resource
281
311
  # @param [Hash] payload payload that contains response from Twilio
282
- # @param [String] service_sid The service_sid
312
+ # @param [String] service_sid The unique id of the
313
+ # [Service](https://www.twilio.com/docs/api/chat/rest/services) this message
314
+ # belongs to.
283
315
  # @param [String] channel_sid The channel_sid
284
316
  # @param [String] sid The sid
285
317
  # @return [MessageInstance] MessageInstance
@@ -332,31 +364,31 @@ module Twilio
332
364
  end
333
365
 
334
366
  ##
335
- # @return [String] The sid
367
+ # @return [String] A 34 character string that uniquely identifies this resource.
336
368
  def sid
337
369
  @properties['sid']
338
370
  end
339
371
 
340
372
  ##
341
- # @return [String] The account_sid
373
+ # @return [String] The unique id of the Account responsible for this message.
342
374
  def account_sid
343
375
  @properties['account_sid']
344
376
  end
345
377
 
346
378
  ##
347
- # @return [String] The attributes
379
+ # @return [String] An optional string metadata field you can use to store any data you wish.
348
380
  def attributes
349
381
  @properties['attributes']
350
382
  end
351
383
 
352
384
  ##
353
- # @return [String] The service_sid
385
+ # @return [String] The unique id of the Service this message belongs to.
354
386
  def service_sid
355
387
  @properties['service_sid']
356
388
  end
357
389
 
358
390
  ##
359
- # @return [String] The to
391
+ # @return [String] The unique id of the Channel this message was sent to.
360
392
  def to
361
393
  @properties['to']
362
394
  end
@@ -368,61 +400,61 @@ module Twilio
368
400
  end
369
401
 
370
402
  ##
371
- # @return [Time] The date_created
403
+ # @return [Time] The date that this resource was created.
372
404
  def date_created
373
405
  @properties['date_created']
374
406
  end
375
407
 
376
408
  ##
377
- # @return [Time] The date_updated
409
+ # @return [Time] The date that this resource was last updated.
378
410
  def date_updated
379
411
  @properties['date_updated']
380
412
  end
381
413
 
382
414
  ##
383
- # @return [String] The last_updated_by
415
+ # @return [String] Optional field to specify the Identity of the User that last updated the Message
384
416
  def last_updated_by
385
417
  @properties['last_updated_by']
386
418
  end
387
419
 
388
420
  ##
389
- # @return [Boolean] The was_edited
421
+ # @return [Boolean] true if the message has been updated since it was created.
390
422
  def was_edited
391
423
  @properties['was_edited']
392
424
  end
393
425
 
394
426
  ##
395
- # @return [String] The from
427
+ # @return [String] The identity of the message's author.
396
428
  def from
397
429
  @properties['from']
398
430
  end
399
431
 
400
432
  ##
401
- # @return [String] The body
433
+ # @return [String] Optional — the contents of the message.
402
434
  def body
403
435
  @properties['body']
404
436
  end
405
437
 
406
438
  ##
407
- # @return [String] The index
439
+ # @return [String] The index of the message within the Channel
408
440
  def index
409
441
  @properties['index']
410
442
  end
411
443
 
412
444
  ##
413
- # @return [String] The type
445
+ # @return [String] Message type.
414
446
  def type
415
447
  @properties['type']
416
448
  end
417
449
 
418
450
  ##
419
- # @return [Hash] The media
451
+ # @return [Hash] Optional — if a Media resource instance is attached to the Message, this will contain the Media object for the attached Media.
420
452
  def media
421
453
  @properties['media']
422
454
  end
423
455
 
424
456
  ##
425
- # @return [String] The url
457
+ # @return [String] An absolute URL for this message.
426
458
  def url
427
459
  @properties['url']
428
460
  end
@@ -443,11 +475,18 @@ module Twilio
443
475
 
444
476
  ##
445
477
  # Update the MessageInstance
446
- # @param [String] body The body
447
- # @param [String] attributes The attributes
448
- # @param [Time] date_created The date_created
449
- # @param [Time] date_updated The date_updated
450
- # @param [String] last_updated_by The last_updated_by
478
+ # @param [String] body The message body string. You can also send structured data
479
+ # by serializing it into a string. May be updated to empty string or `null`, will
480
+ # be set as empty string as a result in this cases.
481
+ # @param [String] attributes The attributes metadata field you can use to store
482
+ # any data you wish. The string value must contain structurally valid JSON if
483
+ # specified.
484
+ # @param [Time] date_created The ISO8601 time specifying the datetime the Message
485
+ # should be set as being created.
486
+ # @param [Time] date_updated The ISO8601 time specifying the datetime the Message
487
+ # should be set as having been last updated.
488
+ # @param [String] last_updated_by Specify the Identity of the User that last
489
+ # updated the Message (if relevant)
451
490
  # @return [MessageInstance] Updated MessageInstance
452
491
  def update(body: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, last_updated_by: :unset)
453
492
  context.update(
@@ -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 Chat < 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.Chat.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.Chat.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.Chat.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.Chat.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.Chat.V2.WebhookInstance #{values}>"
425
+ end
426
+ end
427
+ end
428
+ end
429
+ end
430
+ end
431
+ end
432
+ end