twilio-ruby 5.52.0 → 5.67.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/pr-lint.yml +15 -0
  3. data/.github/workflows/test-and-deploy.yml +129 -0
  4. data/.gitignore +5 -1
  5. data/.rubocop.yml +1 -1
  6. data/.rubocop_todo.yml +91 -28
  7. data/CHANGES.md +563 -0
  8. data/Gemfile +1 -0
  9. data/Makefile +8 -11
  10. data/README.md +13 -6
  11. data/examples/examples.rb +1 -1
  12. data/lib/rack/twilio_webhook_authentication.rb +25 -1
  13. data/lib/twilio-ruby/http/http_client.rb +20 -4
  14. data/lib/twilio-ruby/http.rb +5 -0
  15. data/lib/twilio-ruby/jwt/access_token.rb +13 -0
  16. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +23 -23
  17. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback_summary.rb +5 -5
  18. data/lib/twilio-ruby/rest/api/v2010/account/call/payment.rb +8 -8
  19. data/lib/twilio-ruby/rest/api/v2010/account/call/siprec.rb +674 -0
  20. data/lib/twilio-ruby/rest/api/v2010/account/call/stream.rb +674 -0
  21. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +68 -14
  22. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +12 -8
  23. data/lib/twilio-ruby/rest/api/v2010/account/conference/recording.rb +1 -1
  24. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +11 -4
  25. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +11 -4
  26. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +11 -4
  27. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +17 -10
  28. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +18 -5
  29. data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +34 -7
  30. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb +11 -11
  31. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb +11 -11
  32. data/lib/twilio-ruby/rest/bulkexports/v1/export/day.rb +0 -8
  33. data/lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb +0 -6
  34. data/lib/twilio-ruby/rest/bulkexports/v1/export/job.rb +0 -8
  35. data/lib/twilio-ruby/rest/bulkexports/v1/export.rb +0 -8
  36. data/lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb +0 -8
  37. data/lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb +10 -4
  38. data/lib/twilio-ruby/rest/chat/v3/channel.rb +275 -0
  39. data/lib/twilio-ruby/rest/chat/v3.rb +48 -0
  40. data/lib/twilio-ruby/rest/chat.rb +16 -0
  41. data/lib/twilio-ruby/rest/client.rb +21 -12
  42. data/lib/twilio-ruby/rest/conversations/v1/address_configuration.rb +454 -0
  43. data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +12 -5
  44. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +7 -0
  45. data/lib/twilio-ruby/rest/conversations/v1/participant_conversation.rb +312 -0
  46. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb +18 -2
  47. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb +269 -0
  48. data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +8 -0
  49. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +12 -5
  50. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +7 -0
  51. data/lib/twilio-ruby/rest/conversations/v1/service/participant_conversation.rb +324 -0
  52. data/lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb +466 -0
  53. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +44 -0
  54. data/lib/twilio-ruby/rest/conversations/v1/service.rb +23 -0
  55. data/lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb +442 -0
  56. data/lib/twilio-ruby/rest/conversations/v1/user.rb +35 -0
  57. data/lib/twilio-ruby/rest/conversations/v1.rb +24 -0
  58. data/lib/twilio-ruby/rest/conversations.rb +15 -0
  59. data/lib/twilio-ruby/rest/events/v1/event_type.rb +12 -5
  60. data/lib/twilio-ruby/rest/events/v1/sink.rb +41 -5
  61. data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +28 -0
  62. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +55 -34
  63. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.rb +236 -0
  64. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.rb +330 -0
  65. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb +384 -0
  66. data/lib/twilio-ruby/rest/flex_api/v1/interaction.rb +233 -0
  67. data/lib/twilio-ruby/rest/flex_api/v1.rb +16 -0
  68. data/lib/twilio-ruby/rest/flex_api.rb +9 -0
  69. data/lib/twilio-ruby/rest/frontline_api/v1/user.rb +258 -0
  70. data/lib/twilio-ruby/rest/{fax → frontline_api}/v1.rb +11 -11
  71. data/lib/twilio-ruby/rest/{fax.rb → frontline_api.rb} +11 -11
  72. data/lib/twilio-ruby/rest/insights/v1/annotation.rb +271 -0
  73. data/lib/twilio-ruby/rest/insights/v1/call_summaries.rb +434 -0
  74. data/lib/twilio-ruby/rest/insights/v1/conference/conference_participant.rb +474 -0
  75. data/lib/twilio-ruby/rest/insights/v1/conference.rb +512 -0
  76. data/lib/twilio-ruby/rest/insights/v1/setting.rb +215 -0
  77. data/lib/twilio-ruby/rest/insights/v1.rb +46 -0
  78. data/lib/twilio-ruby/rest/insights.rb +28 -0
  79. data/lib/twilio-ruby/rest/lookups/v2/phone_number.rb +268 -0
  80. data/lib/twilio-ruby/rest/lookups/v2.rb +45 -0
  81. data/lib/twilio-ruby/rest/lookups.rb +7 -0
  82. data/lib/twilio-ruby/rest/media/v1/media_processor.rb +397 -0
  83. data/lib/twilio-ruby/rest/media/v1/media_recording.rb +406 -0
  84. data/lib/twilio-ruby/rest/media/v1/player_streamer/playback_grant.rb +221 -0
  85. data/lib/twilio-ruby/rest/media/v1/player_streamer.rb +403 -0
  86. data/lib/twilio-ruby/rest/media/v1.rb +76 -0
  87. data/lib/twilio-ruby/rest/media.rb +65 -0
  88. data/lib/twilio-ruby/rest/{fax/v1/fax/fax_media.rb → messaging/v1/brand_registration/brand_vetting.rb} +134 -95
  89. data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +127 -2
  90. data/lib/twilio-ruby/rest/messaging/v1/external_campaign.rb +7 -0
  91. data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb +187 -20
  92. data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person_usecase.rb +6 -2
  93. data/lib/twilio-ruby/rest/messaging/v1/service.rb +37 -5
  94. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.rb +268 -0
  95. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/replace_items.rb +188 -0
  96. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +128 -26
  97. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +7 -0
  98. data/lib/twilio-ruby/rest/pricing/v2/country.rb +280 -0
  99. data/lib/twilio-ruby/rest/pricing/v2/number.rb +225 -0
  100. data/lib/twilio-ruby/rest/pricing/v2.rb +37 -0
  101. data/lib/twilio-ruby/rest/pricing.rb +19 -0
  102. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +1 -1
  103. data/lib/twilio-ruby/rest/serverless/v1/service.rb +7 -0
  104. data/lib/twilio-ruby/rest/studio/v1/flow/execution.rb +1 -1
  105. data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +1 -1
  106. data/lib/twilio-ruby/rest/supersim/v1/esim_profile.rb +372 -0
  107. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +44 -55
  108. data/lib/twilio-ruby/rest/supersim/v1/{command.rb → ip_command.rb} +132 -84
  109. data/lib/twilio-ruby/rest/supersim/v1/sim/billing_period.rb +231 -0
  110. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +30 -1
  111. data/lib/twilio-ruby/rest/supersim/v1/sms_command.rb +1 -1
  112. data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +23 -9
  113. data/lib/twilio-ruby/rest/supersim/v1.rb +23 -7
  114. data/lib/twilio-ruby/rest/supersim.rb +15 -6
  115. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +7 -0
  116. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +7 -3
  117. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.rb +6 -2
  118. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +7 -3
  119. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +23 -11
  120. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb +4 -2
  121. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb +4 -2
  122. data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +38 -22
  123. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +19 -3
  124. data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +155 -10
  125. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge/notification.rb +12 -9
  126. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +74 -22
  127. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +34 -15
  128. data/lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb +66 -31
  129. data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +7 -3
  130. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +25 -7
  131. data/lib/twilio-ruby/rest/verify/v2/service/webhook.rb +24 -5
  132. data/lib/twilio-ruby/rest/verify/v2/service.rb +40 -11
  133. data/lib/twilio-ruby/rest/verify/v2/template.rb +206 -0
  134. data/lib/twilio-ruby/rest/verify/v2/verification_attempt.rb +89 -21
  135. data/lib/twilio-ruby/rest/verify/v2/verification_attempts_summary.rb +234 -0
  136. data/lib/twilio-ruby/rest/verify/v2.rb +14 -0
  137. data/lib/twilio-ruby/rest/verify.rb +14 -2
  138. data/lib/twilio-ruby/rest/video/v1/composition.rb +21 -8
  139. data/lib/twilio-ruby/rest/video/v1/composition_hook.rb +0 -8
  140. data/lib/twilio-ruby/rest/video/v1/recording.rb +21 -0
  141. data/lib/twilio-ruby/rest/video/v1/room/recording.rb +7 -0
  142. data/lib/twilio-ruby/rest/video/v1/room.rb +62 -5
  143. data/lib/twilio-ruby/rest/voice/v1/archived_call.rb +184 -0
  144. data/lib/twilio-ruby/rest/voice/v1.rb +21 -0
  145. data/lib/twilio-ruby/rest/voice.rb +8 -0
  146. data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +3 -3
  147. data/lib/twilio-ruby/rest/wireless/v1/sim.rb +16 -26
  148. data/lib/twilio-ruby/rest.rb +13 -0
  149. data/lib/twilio-ruby/twiml/voice_response.rb +727 -87
  150. data/lib/twilio-ruby/version.rb +1 -1
  151. data/lib/twilio-ruby.rb +6 -16
  152. data/sonar-project.properties +13 -0
  153. data/twilio-ruby.gemspec +1 -2
  154. metadata +59 -32
  155. data/.travis.yml +0 -45
  156. data/lib/twilio-ruby/rest/fax/v1/fax.rb +0 -536
  157. /data/lib/twilio-ruby/framework/{domain.rb → rest/domain.rb} +0 -0
  158. /data/lib/twilio-ruby/framework/{error.rb → rest/error.rb} +0 -0
  159. /data/lib/twilio-ruby/framework/{helper.rb → rest/helper.rb} +0 -0
  160. /data/lib/twilio-ruby/framework/{obsolete_client.rb → rest/obsolete_client.rb} +0 -0
  161. /data/lib/twilio-ruby/framework/{page.rb → rest/page.rb} +0 -0
  162. /data/lib/twilio-ruby/framework/{resource.rb → rest/resource.rb} +0 -0
  163. /data/lib/twilio-ruby/framework/{version.rb → rest/version.rb} +0 -0
@@ -50,6 +50,10 @@ module Twilio
50
50
  # Lists SinkInstance records from the API as a list.
51
51
  # Unlike stream(), this operation is eager and will load `limit` records into
52
52
  # memory before returning.
53
+ # @param [Boolean] in_use A boolean query parameter filtering the results to
54
+ # return sinks used/not used by a subscription.
55
+ # @param [String] status A String query parameter filtering the results by status
56
+ # `initialized`, `validating`, `active` or `failed`.
53
57
  # @param [Integer] limit Upper limit for the number of records to return. stream()
54
58
  # guarantees to never return more than limit. Default is no limit
55
59
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -57,14 +61,18 @@ module Twilio
57
61
  # but a limit is defined, stream() will attempt to read the limit with the most
58
62
  # efficient page size, i.e. min(limit, 1000)
59
63
  # @return [Array] Array of up to limit results
60
- def list(limit: nil, page_size: nil)
61
- self.stream(limit: limit, page_size: page_size).entries
64
+ def list(in_use: :unset, status: :unset, limit: nil, page_size: nil)
65
+ self.stream(in_use: in_use, status: status, limit: limit, page_size: page_size).entries
62
66
  end
63
67
 
64
68
  ##
65
69
  # Streams SinkInstance records from the API as an Enumerable.
66
70
  # This operation lazily loads records as efficiently as possible until the limit
67
71
  # is reached.
72
+ # @param [Boolean] in_use A boolean query parameter filtering the results to
73
+ # return sinks used/not used by a subscription.
74
+ # @param [String] status A String query parameter filtering the results by status
75
+ # `initialized`, `validating`, `active` or `failed`.
68
76
  # @param [Integer] limit Upper limit for the number of records to return. stream()
69
77
  # guarantees to never return more than limit. Default is no limit.
70
78
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -72,10 +80,10 @@ module Twilio
72
80
  # but a limit is defined, stream() will attempt to read the limit with the most
73
81
  # efficient page size, i.e. min(limit, 1000)
74
82
  # @return [Enumerable] Enumerable that will yield up to limit results
75
- def stream(limit: nil, page_size: nil)
83
+ def stream(in_use: :unset, status: :unset, limit: nil, page_size: nil)
76
84
  limits = @version.read_limits(limit, page_size)
77
85
 
78
- page = self.page(page_size: limits[:page_size], )
86
+ page = self.page(in_use: in_use, status: status, page_size: limits[:page_size], )
79
87
 
80
88
  @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
81
89
  end
@@ -97,12 +105,18 @@ module Twilio
97
105
  ##
98
106
  # Retrieve a single page of SinkInstance records from the API.
99
107
  # Request is executed immediately.
108
+ # @param [Boolean] in_use A boolean query parameter filtering the results to
109
+ # return sinks used/not used by a subscription.
110
+ # @param [String] status A String query parameter filtering the results by status
111
+ # `initialized`, `validating`, `active` or `failed`.
100
112
  # @param [String] page_token PageToken provided by the API
101
113
  # @param [Integer] page_number Page Number, this value is simply for client state
102
114
  # @param [Integer] page_size Number of records to return, defaults to 50
103
115
  # @return [Page] Page of SinkInstance
104
- def page(page_token: :unset, page_number: :unset, page_size: :unset)
116
+ def page(in_use: :unset, status: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
105
117
  params = Twilio::Values.of({
118
+ 'InUse' => in_use,
119
+ 'Status' => status,
106
120
  'PageToken' => page_token,
107
121
  'Page' => page_number,
108
122
  'PageSize' => page_size,
@@ -200,6 +214,19 @@ module Twilio
200
214
  @version.delete('DELETE', @uri)
201
215
  end
202
216
 
217
+ ##
218
+ # Update the SinkInstance
219
+ # @param [String] description A human readable description for the Sink **This
220
+ # value should not contain PII.**
221
+ # @return [SinkInstance] Updated SinkInstance
222
+ def update(description: nil)
223
+ data = Twilio::Values.of({'Description' => description, })
224
+
225
+ payload = @version.update('POST', @uri, data: data)
226
+
227
+ SinkInstance.new(@version, payload, sid: @solution[:sid], )
228
+ end
229
+
203
230
  ##
204
231
  # Access the sink_test
205
232
  # @return [SinkTestList]
@@ -348,6 +375,15 @@ module Twilio
348
375
  context.delete
349
376
  end
350
377
 
378
+ ##
379
+ # Update the SinkInstance
380
+ # @param [String] description A human readable description for the Sink **This
381
+ # value should not contain PII.**
382
+ # @return [SinkInstance] Updated SinkInstance
383
+ def update(description: nil)
384
+ context.update(description: description, )
385
+ end
386
+
351
387
  ##
352
388
  # Access the sink_test
353
389
  # @return [sink_test] sink_test
@@ -167,6 +167,10 @@ module Twilio
167
167
  'notifications' => payload['notifications'],
168
168
  'markdown' => payload['markdown'],
169
169
  'url' => payload['url'],
170
+ 'flex_insights_hr' => payload['flex_insights_hr'],
171
+ 'flex_insights_drilldown' => payload['flex_insights_drilldown'],
172
+ 'flex_url' => payload['flex_url'],
173
+ 'channel_configs' => payload['channel_configs'],
170
174
  }
171
175
 
172
176
  # Context
@@ -419,6 +423,30 @@ module Twilio
419
423
  @properties['url']
420
424
  end
421
425
 
426
+ ##
427
+ # @return [Hash] Object that controls workspace reporting
428
+ def flex_insights_hr
429
+ @properties['flex_insights_hr']
430
+ end
431
+
432
+ ##
433
+ # @return [Boolean] Setting to enable Flex UI redirection
434
+ def flex_insights_drilldown
435
+ @properties['flex_insights_drilldown']
436
+ end
437
+
438
+ ##
439
+ # @return [String] URL to redirect to in case drilldown is enabled.
440
+ def flex_url
441
+ @properties['flex_url']
442
+ end
443
+
444
+ ##
445
+ # @return [Array[Hash]] Flex Conversations channels' attachments configurations
446
+ def channel_configs
447
+ @properties['channel_configs']
448
+ end
449
+
422
450
  ##
423
451
  # Fetch the ConfigurationInstance
424
452
  # @param [String] ui_version The Pinned UI version of the Configuration resource
@@ -115,12 +115,19 @@ module Twilio
115
115
  # @param [String] friendly_name A descriptive string that you create to describe
116
116
  # the Flex Flow resource.
117
117
  # @param [String] chat_service_sid The SID of the chat service.
118
- # @param [flex_flow.ChannelType] channel_type The channel type. Can be: `web`,
119
- # `facebook`, `sms`, `whatsapp`, `line` or `custom`.
118
+ # @param [flex_flow.ChannelType] channel_type The channel type. One of `web`,
119
+ # `facebook`, `sms`, `whatsapp`, `line` or `custom`. By default, Studio’s Send to
120
+ # Flex widget passes it on to the Task attributes for Tasks created based on this
121
+ # Flex Flow. The Task attributes will be used by the Flex UI to render the
122
+ # respective Task as appropriate (applying channel-specific design and length
123
+ # limits). If `channelType` is `facebook`, `whatsapp` or `line`, the Send to Flex
124
+ # widget should set the Task Channel to Programmable Chat.
120
125
  # @param [String] contact_identity The channel contact's Identity.
121
126
  # @param [Boolean] enabled Whether the new Flex Flow is enabled.
122
- # @param [flex_flow.IntegrationType] integration_type The integration type. Can
123
- # be: `studio`, `external`, or `task`.
127
+ # @param [flex_flow.IntegrationType] integration_type The software that will
128
+ # handle inbound messages. {Integration
129
+ # Type}[https://www.twilio.com/docs/flex/developer/messaging/manage-flows#integration-types]
130
+ # can be: `studio`, `external`, or `task`.
124
131
  # @param [String] integration_flow_sid The SID of the Studio Flow. Required when
125
132
  # `integrationType` is `studio`.
126
133
  # @param [String] integration_url The URL of the external webhook. Required when
@@ -129,9 +136,9 @@ module Twilio
129
136
  # Required when `integrationType` is `task`.
130
137
  # @param [String] integration_workflow_sid The Workflow SID for a new Task.
131
138
  # Required when `integrationType` is `task`.
132
- # @param [String] integration_channel The Task Channel for the TaskRouter Task
133
- # that will be created. Applicable and required when integrationType is `task`.
134
- # Set to `sms` for SMS, and to `chat` otherwise. The default value is `default`
139
+ # @param [String] integration_channel The Task Channel SID (TCXXXX) or unique name
140
+ # (e.g., `sms`) to use for the Task that will be created. Applicable and required
141
+ # when `integrationType` is `task`. The default value is `default`.
135
142
  # @param [String] integration_timeout The Task timeout in seconds for a new Task.
136
143
  # Default is 86,400 seconds (24 hours). Optional when `integrationType` is `task`,
137
144
  # not applicable otherwise.
@@ -149,10 +156,10 @@ module Twilio
149
156
  # @param [Boolean] janitor_enabled When enabled, the Messaging Channel Janitor
150
157
  # will remove active Proxy sessions if the associated Task is deleted outside of
151
158
  # the Flex UI. Defaults to `false`.
152
- # @param [String] integration_retry_count The number of times to retry the webhook
153
- # if the first attempt fails. Can be an integer between 0 and 3 (included),
154
- # default is 0. Optional when integrationType is `external`, not applicable
155
- # otherwise.
159
+ # @param [String] integration_retry_count The number of times to retry the Studio
160
+ # Flow or webhook in case of failure. Takes integer values from 0 to 3 with the
161
+ # default being 3. Optional when `integrationType` is `studio` or `external`, not
162
+ # applicable otherwise.
156
163
  # @return [FlexFlowInstance] Created FlexFlowInstance
157
164
  def create(friendly_name: nil, chat_service_sid: nil, channel_type: nil, contact_identity: :unset, enabled: :unset, integration_type: :unset, integration_flow_sid: :unset, integration_url: :unset, integration_workspace_sid: :unset, integration_workflow_sid: :unset, integration_channel: :unset, integration_timeout: :unset, integration_priority: :unset, integration_creation_on_message: :unset, long_lived: :unset, janitor_enabled: :unset, integration_retry_count: :unset)
158
165
  data = Twilio::Values.of({
@@ -244,12 +251,19 @@ module Twilio
244
251
  # @param [String] friendly_name A descriptive string that you create to describe
245
252
  # the Flex Flow resource.
246
253
  # @param [String] chat_service_sid The SID of the chat service.
247
- # @param [flex_flow.ChannelType] channel_type The channel type. Can be: `web`,
248
- # `facebook`, `sms`, `whatsapp`, `line` or `custom`.
254
+ # @param [flex_flow.ChannelType] channel_type The channel type. One of `web`,
255
+ # `facebook`, `sms`, `whatsapp`, `line` or `custom`. By default, Studio’s Send to
256
+ # Flex widget passes it on to the Task attributes for Tasks created based on this
257
+ # Flex Flow. The Task attributes will be used by the Flex UI to render the
258
+ # respective Task as appropriate (applying channel-specific design and length
259
+ # limits). If `channelType` is `facebook`, `whatsapp` or `line`, the Send to Flex
260
+ # widget should set the Task Channel to Programmable Chat.
249
261
  # @param [String] contact_identity The channel contact's Identity.
250
262
  # @param [Boolean] enabled Whether the new Flex Flow is enabled.
251
- # @param [flex_flow.IntegrationType] integration_type The integration type. Can
252
- # be: `studio`, `external`, or `task`.
263
+ # @param [flex_flow.IntegrationType] integration_type The software that will
264
+ # handle inbound messages. {Integration
265
+ # Type}[https://www.twilio.com/docs/flex/developer/messaging/manage-flows#integration-types]
266
+ # can be: `studio`, `external`, or `task`.
253
267
  # @param [String] integration_flow_sid The SID of the Studio Flow. Required when
254
268
  # `integrationType` is `studio`.
255
269
  # @param [String] integration_url The URL of the external webhook. Required when
@@ -258,9 +272,9 @@ module Twilio
258
272
  # Required when `integrationType` is `task`.
259
273
  # @param [String] integration_workflow_sid The Workflow SID for a new Task.
260
274
  # Required when `integrationType` is `task`.
261
- # @param [String] integration_channel The Task Channel for the TaskRouter Task
262
- # that will be created. Applicable and required when integrationType is `task`.
263
- # Set to `sms` for SMS, and to `chat` otherwise. The default value is `default`
275
+ # @param [String] integration_channel The Task Channel SID (TCXXXX) or unique name
276
+ # (e.g., `sms`) to use for the Task that will be created. Applicable and required
277
+ # when `integrationType` is `task`. The default value is `default`.
264
278
  # @param [String] integration_timeout The Task timeout in seconds for a new Task.
265
279
  # Default is 86,400 seconds (24 hours). Optional when `integrationType` is `task`,
266
280
  # not applicable otherwise.
@@ -278,10 +292,10 @@ module Twilio
278
292
  # @param [Boolean] janitor_enabled When enabled, the Messaging Channel Janitor
279
293
  # will remove active Proxy sessions if the associated Task is deleted outside of
280
294
  # the Flex UI. Defaults to `false`.
281
- # @param [String] integration_retry_count The number of times to retry the webhook
282
- # if the first attempt fails. Can be an integer between 0 and 3 (included),
283
- # default is 0. Optional when integrationType is `external`, not applicable
284
- # otherwise.
295
+ # @param [String] integration_retry_count The number of times to retry the Studio
296
+ # Flow or webhook in case of failure. Takes integer values from 0 to 3 with the
297
+ # default being 3. Optional when `integrationType` is `studio` or `external`, not
298
+ # applicable otherwise.
285
299
  # @return [FlexFlowInstance] Updated FlexFlowInstance
286
300
  def update(friendly_name: :unset, chat_service_sid: :unset, channel_type: :unset, contact_identity: :unset, enabled: :unset, integration_type: :unset, integration_flow_sid: :unset, integration_url: :unset, integration_workspace_sid: :unset, integration_workflow_sid: :unset, integration_channel: :unset, integration_timeout: :unset, integration_priority: :unset, integration_creation_on_message: :unset, long_lived: :unset, janitor_enabled: :unset, integration_retry_count: :unset)
287
301
  data = Twilio::Values.of({
@@ -430,7 +444,7 @@ module Twilio
430
444
  end
431
445
 
432
446
  ##
433
- # @return [flex_flow.IntegrationType] The integration type
447
+ # @return [flex_flow.IntegrationType] The software that will handle inbound messages.
434
448
  def integration_type
435
449
  @properties['integration_type']
436
450
  end
@@ -471,12 +485,19 @@ module Twilio
471
485
  # @param [String] friendly_name A descriptive string that you create to describe
472
486
  # the Flex Flow resource.
473
487
  # @param [String] chat_service_sid The SID of the chat service.
474
- # @param [flex_flow.ChannelType] channel_type The channel type. Can be: `web`,
475
- # `facebook`, `sms`, `whatsapp`, `line` or `custom`.
488
+ # @param [flex_flow.ChannelType] channel_type The channel type. One of `web`,
489
+ # `facebook`, `sms`, `whatsapp`, `line` or `custom`. By default, Studio’s Send to
490
+ # Flex widget passes it on to the Task attributes for Tasks created based on this
491
+ # Flex Flow. The Task attributes will be used by the Flex UI to render the
492
+ # respective Task as appropriate (applying channel-specific design and length
493
+ # limits). If `channelType` is `facebook`, `whatsapp` or `line`, the Send to Flex
494
+ # widget should set the Task Channel to Programmable Chat.
476
495
  # @param [String] contact_identity The channel contact's Identity.
477
496
  # @param [Boolean] enabled Whether the new Flex Flow is enabled.
478
- # @param [flex_flow.IntegrationType] integration_type The integration type. Can
479
- # be: `studio`, `external`, or `task`.
497
+ # @param [flex_flow.IntegrationType] integration_type The software that will
498
+ # handle inbound messages. {Integration
499
+ # Type}[https://www.twilio.com/docs/flex/developer/messaging/manage-flows#integration-types]
500
+ # can be: `studio`, `external`, or `task`.
480
501
  # @param [String] integration_flow_sid The SID of the Studio Flow. Required when
481
502
  # `integrationType` is `studio`.
482
503
  # @param [String] integration_url The URL of the external webhook. Required when
@@ -485,9 +506,9 @@ module Twilio
485
506
  # Required when `integrationType` is `task`.
486
507
  # @param [String] integration_workflow_sid The Workflow SID for a new Task.
487
508
  # Required when `integrationType` is `task`.
488
- # @param [String] integration_channel The Task Channel for the TaskRouter Task
489
- # that will be created. Applicable and required when integrationType is `task`.
490
- # Set to `sms` for SMS, and to `chat` otherwise. The default value is `default`
509
+ # @param [String] integration_channel The Task Channel SID (TCXXXX) or unique name
510
+ # (e.g., `sms`) to use for the Task that will be created. Applicable and required
511
+ # when `integrationType` is `task`. The default value is `default`.
491
512
  # @param [String] integration_timeout The Task timeout in seconds for a new Task.
492
513
  # Default is 86,400 seconds (24 hours). Optional when `integrationType` is `task`,
493
514
  # not applicable otherwise.
@@ -505,10 +526,10 @@ module Twilio
505
526
  # @param [Boolean] janitor_enabled When enabled, the Messaging Channel Janitor
506
527
  # will remove active Proxy sessions if the associated Task is deleted outside of
507
528
  # the Flex UI. Defaults to `false`.
508
- # @param [String] integration_retry_count The number of times to retry the webhook
509
- # if the first attempt fails. Can be an integer between 0 and 3 (included),
510
- # default is 0. Optional when integrationType is `external`, not applicable
511
- # otherwise.
529
+ # @param [String] integration_retry_count The number of times to retry the Studio
530
+ # Flow or webhook in case of failure. Takes integer values from 0 to 3 with the
531
+ # default being 3. Optional when `integrationType` is `studio` or `external`, not
532
+ # applicable otherwise.
512
533
  # @return [FlexFlowInstance] Updated FlexFlowInstance
513
534
  def update(friendly_name: :unset, chat_service_sid: :unset, channel_type: :unset, contact_identity: :unset, enabled: :unset, integration_type: :unset, integration_flow_sid: :unset, integration_url: :unset, integration_workspace_sid: :unset, integration_workflow_sid: :unset, integration_channel: :unset, integration_timeout: :unset, integration_priority: :unset, integration_creation_on_message: :unset, long_lived: :unset, janitor_enabled: :unset, integration_retry_count: :unset)
514
535
  context.update(
@@ -0,0 +1,236 @@
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 FlexApi < Domain
12
+ class V1 < Version
13
+ class InteractionContext < InstanceContext
14
+ class InteractionChannelContext < InstanceContext
15
+ class InteractionChannelInviteList < ListResource
16
+ ##
17
+ # Initialize the InteractionChannelInviteList
18
+ # @param [Version] version Version that contains the resource
19
+ # @param [String] interaction_sid The Interaction SID for this Channel.
20
+ # @param [String] channel_sid The Channel SID for this Invite.
21
+ # @return [InteractionChannelInviteList] InteractionChannelInviteList
22
+ def initialize(version, interaction_sid: nil, channel_sid: nil)
23
+ super(version)
24
+
25
+ # Path Solution
26
+ @solution = {interaction_sid: interaction_sid, channel_sid: channel_sid}
27
+ @uri = "/Interactions/#{@solution[:interaction_sid]}/Channels/#{@solution[:channel_sid]}/Invites"
28
+ end
29
+
30
+ ##
31
+ # Create the InteractionChannelInviteInstance
32
+ # @param [Hash] routing The Interaction's routing logic.
33
+ # @return [InteractionChannelInviteInstance] Created InteractionChannelInviteInstance
34
+ def create(routing: nil)
35
+ data = Twilio::Values.of({'Routing' => Twilio.serialize_object(routing), })
36
+
37
+ payload = @version.create('POST', @uri, data: data)
38
+
39
+ InteractionChannelInviteInstance.new(
40
+ @version,
41
+ payload,
42
+ interaction_sid: @solution[:interaction_sid],
43
+ channel_sid: @solution[:channel_sid],
44
+ )
45
+ end
46
+
47
+ ##
48
+ # Lists InteractionChannelInviteInstance records from the API as a list.
49
+ # Unlike stream(), this operation is eager and will load `limit` records into
50
+ # memory before returning.
51
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
52
+ # guarantees to never return more than limit. Default is no limit
53
+ # @param [Integer] page_size Number of records to fetch per request, when
54
+ # not set will use the default value of 50 records. If no page_size is defined
55
+ # but a limit is defined, stream() will attempt to read the limit with the most
56
+ # efficient page size, i.e. min(limit, 1000)
57
+ # @return [Array] Array of up to limit results
58
+ def list(limit: nil, page_size: nil)
59
+ self.stream(limit: limit, page_size: page_size).entries
60
+ end
61
+
62
+ ##
63
+ # Streams InteractionChannelInviteInstance records from the API as an Enumerable.
64
+ # This operation lazily loads records as efficiently as possible until the limit
65
+ # is reached.
66
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
67
+ # guarantees to never return more than limit. Default is no limit.
68
+ # @param [Integer] page_size Number of records to fetch per request, when
69
+ # not set will use the default value of 50 records. If no page_size is defined
70
+ # but a limit is defined, stream() will attempt to read the limit with the most
71
+ # efficient page size, i.e. min(limit, 1000)
72
+ # @return [Enumerable] Enumerable that will yield up to limit results
73
+ def stream(limit: nil, page_size: nil)
74
+ limits = @version.read_limits(limit, page_size)
75
+
76
+ page = self.page(page_size: limits[:page_size], )
77
+
78
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
79
+ end
80
+
81
+ ##
82
+ # When passed a block, yields InteractionChannelInviteInstance records from the API.
83
+ # This operation lazily loads records as efficiently as possible until the limit
84
+ # is reached.
85
+ def each
86
+ limits = @version.read_limits
87
+
88
+ page = self.page(page_size: limits[:page_size], )
89
+
90
+ @version.stream(page,
91
+ limit: limits[:limit],
92
+ page_limit: limits[:page_limit]).each {|x| yield x}
93
+ end
94
+
95
+ ##
96
+ # Retrieve a single page of InteractionChannelInviteInstance records from the API.
97
+ # Request is executed immediately.
98
+ # @param [String] page_token PageToken provided by the API
99
+ # @param [Integer] page_number Page Number, this value is simply for client state
100
+ # @param [Integer] page_size Number of records to return, defaults to 50
101
+ # @return [Page] Page of InteractionChannelInviteInstance
102
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
103
+ params = Twilio::Values.of({
104
+ 'PageToken' => page_token,
105
+ 'Page' => page_number,
106
+ 'PageSize' => page_size,
107
+ })
108
+
109
+ response = @version.page('GET', @uri, params: params)
110
+
111
+ InteractionChannelInvitePage.new(@version, response, @solution)
112
+ end
113
+
114
+ ##
115
+ # Retrieve a single page of InteractionChannelInviteInstance records from the API.
116
+ # Request is executed immediately.
117
+ # @param [String] target_url API-generated URL for the requested results page
118
+ # @return [Page] Page of InteractionChannelInviteInstance
119
+ def get_page(target_url)
120
+ response = @version.domain.request(
121
+ 'GET',
122
+ target_url
123
+ )
124
+ InteractionChannelInvitePage.new(@version, response, @solution)
125
+ end
126
+
127
+ ##
128
+ # Provide a user friendly representation
129
+ def to_s
130
+ '#<Twilio.FlexApi.V1.InteractionChannelInviteList>'
131
+ end
132
+ end
133
+
134
+ class InteractionChannelInvitePage < Page
135
+ ##
136
+ # Initialize the InteractionChannelInvitePage
137
+ # @param [Version] version Version that contains the resource
138
+ # @param [Response] response Response from the API
139
+ # @param [Hash] solution Path solution for the resource
140
+ # @return [InteractionChannelInvitePage] InteractionChannelInvitePage
141
+ def initialize(version, response, solution)
142
+ super(version, response)
143
+
144
+ # Path Solution
145
+ @solution = solution
146
+ end
147
+
148
+ ##
149
+ # Build an instance of InteractionChannelInviteInstance
150
+ # @param [Hash] payload Payload response from the API
151
+ # @return [InteractionChannelInviteInstance] InteractionChannelInviteInstance
152
+ def get_instance(payload)
153
+ InteractionChannelInviteInstance.new(
154
+ @version,
155
+ payload,
156
+ interaction_sid: @solution[:interaction_sid],
157
+ channel_sid: @solution[:channel_sid],
158
+ )
159
+ end
160
+
161
+ ##
162
+ # Provide a user friendly representation
163
+ def to_s
164
+ '<Twilio.FlexApi.V1.InteractionChannelInvitePage>'
165
+ end
166
+ end
167
+
168
+ class InteractionChannelInviteInstance < InstanceResource
169
+ ##
170
+ # Initialize the InteractionChannelInviteInstance
171
+ # @param [Version] version Version that contains the resource
172
+ # @param [Hash] payload payload that contains response from Twilio
173
+ # @param [String] interaction_sid The Interaction SID for this Channel.
174
+ # @param [String] channel_sid The Channel SID for this Invite.
175
+ # @return [InteractionChannelInviteInstance] InteractionChannelInviteInstance
176
+ def initialize(version, payload, interaction_sid: nil, channel_sid: nil)
177
+ super(version)
178
+
179
+ # Marshaled Properties
180
+ @properties = {
181
+ 'sid' => payload['sid'],
182
+ 'interaction_sid' => payload['interaction_sid'],
183
+ 'channel_sid' => payload['channel_sid'],
184
+ 'routing' => payload['routing'],
185
+ 'url' => payload['url'],
186
+ }
187
+ end
188
+
189
+ ##
190
+ # @return [String] The unique string that identifies the resource
191
+ def sid
192
+ @properties['sid']
193
+ end
194
+
195
+ ##
196
+ # @return [String] The Interaction SID for this Channel
197
+ def interaction_sid
198
+ @properties['interaction_sid']
199
+ end
200
+
201
+ ##
202
+ # @return [String] The Channel SID for this Invite
203
+ def channel_sid
204
+ @properties['channel_sid']
205
+ end
206
+
207
+ ##
208
+ # @return [Hash] A JSON object representing the routing rules for the Interaction Channel
209
+ def routing
210
+ @properties['routing']
211
+ end
212
+
213
+ ##
214
+ # @return [String] The url
215
+ def url
216
+ @properties['url']
217
+ end
218
+
219
+ ##
220
+ # Provide a user friendly representation
221
+ def to_s
222
+ "<Twilio.FlexApi.V1.InteractionChannelInviteInstance>"
223
+ end
224
+
225
+ ##
226
+ # Provide a detailed, user friendly representation
227
+ def inspect
228
+ "<Twilio.FlexApi.V1.InteractionChannelInviteInstance>"
229
+ end
230
+ end
231
+ end
232
+ end
233
+ end
234
+ end
235
+ end
236
+ end