twilio-ruby 7.3.0 → 7.3.2
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.
- checksums.yaml +4 -4
- data/CHANGES.md +21 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/accounts/v1/bulk_consents.rb +133 -0
- data/lib/twilio-ruby/rest/accounts/v1/bulk_contacts.rb +133 -0
- data/lib/twilio-ruby/rest/accounts/v1.rb +12 -0
- data/lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb +355 -0
- data/lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb +362 -0
- data/lib/twilio-ruby/rest/assistants/v1/assistant/feedback.rb +303 -0
- data/lib/twilio-ruby/rest/assistants/v1/assistant/message.rb +201 -0
- data/lib/twilio-ruby/rest/assistants/v1/assistant.rb +668 -0
- data/lib/twilio-ruby/rest/assistants/v1/knowledge/chunk.rb +229 -0
- data/lib/twilio-ruby/rest/assistants/v1/knowledge/knowledge_status.rb +209 -0
- data/lib/twilio-ruby/rest/assistants/v1/knowledge.rb +591 -0
- data/lib/twilio-ruby/rest/assistants/v1/policy.rb +264 -0
- data/lib/twilio-ruby/rest/assistants/v1/session/message.rb +264 -0
- data/lib/twilio-ruby/rest/assistants/v1/session.rb +328 -0
- data/lib/twilio-ruby/rest/assistants/v1/tool.rb +586 -0
- data/lib/twilio-ruby/rest/assistants/v1.rb +100 -0
- data/lib/twilio-ruby/rest/assistants.rb +6 -0
- data/lib/twilio-ruby/rest/assistants_base.rb +38 -0
- data/lib/twilio-ruby/rest/client.rb +5 -0
- data/lib/twilio-ruby/rest/content/v1/content/approval_fetch.rb +11 -11
- data/lib/twilio-ruby/rest/marketplace/v1/installed_add_on/installed_add_on_usage.rb +11 -24
- data/lib/twilio-ruby/rest/marketplace/v1/module_data_management.rb +28 -15
- data/lib/twilio-ruby/rest/numbers/v1/{porting_webhook_configuration_fetch.rb → webhook.rb} +20 -20
- data/lib/twilio-ruby/rest/numbers/v1.rb +6 -6
- data/lib/twilio-ruby/rest/numbers/v2/bundle_clone.rb +2 -2
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +4 -4
- data/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb +4 -1
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +20 -3
@@ -0,0 +1,362 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
6
|
+
#
|
7
|
+
# Twilio - Assistants
|
8
|
+
# This is the public Twilio REST API.
|
9
|
+
#
|
10
|
+
# NOTE: This class is auto generated by OpenAPI Generator.
|
11
|
+
# https://openapi-generator.tech
|
12
|
+
# Do not edit the class manually.
|
13
|
+
#
|
14
|
+
|
15
|
+
|
16
|
+
module Twilio
|
17
|
+
module REST
|
18
|
+
class Assistants < AssistantsBase
|
19
|
+
class V1 < Version
|
20
|
+
class AssistantContext < InstanceContext
|
21
|
+
|
22
|
+
class AssistantsToolList < ListResource
|
23
|
+
|
24
|
+
##
|
25
|
+
# Initialize the AssistantsToolList
|
26
|
+
# @param [Version] version Version that contains the resource
|
27
|
+
# @return [AssistantsToolList] AssistantsToolList
|
28
|
+
def initialize(version, assistant_id: nil)
|
29
|
+
super(version)
|
30
|
+
# Path Solution
|
31
|
+
@solution = { assistant_id: assistant_id }
|
32
|
+
@uri = "/Assistants/#{@solution[:assistant_id]}/Tools"
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
##
|
37
|
+
# Lists AssistantsToolInstance records from the API as a list.
|
38
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
39
|
+
# memory before returning.
|
40
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
41
|
+
# guarantees to never return more than limit. Default is no limit
|
42
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
43
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
44
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
45
|
+
# efficient page size, i.e. min(limit, 1000)
|
46
|
+
# @return [Array] Array of up to limit results
|
47
|
+
def list(limit: nil, page_size: nil)
|
48
|
+
self.stream(
|
49
|
+
limit: limit,
|
50
|
+
page_size: page_size
|
51
|
+
).entries
|
52
|
+
end
|
53
|
+
|
54
|
+
##
|
55
|
+
# Streams Instance records from the API as an Enumerable.
|
56
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
57
|
+
# is reached.
|
58
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
59
|
+
# guarantees to never return more than limit. Default is no limit
|
60
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
61
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
62
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
63
|
+
# efficient page size, i.e. min(limit, 1000)
|
64
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
65
|
+
def stream(limit: nil, page_size: nil)
|
66
|
+
limits = @version.read_limits(limit, page_size)
|
67
|
+
|
68
|
+
page = self.page(
|
69
|
+
page_size: limits[:page_size], )
|
70
|
+
|
71
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
72
|
+
end
|
73
|
+
|
74
|
+
##
|
75
|
+
# When passed a block, yields AssistantsToolInstance records from the API.
|
76
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
77
|
+
# is reached.
|
78
|
+
def each
|
79
|
+
limits = @version.read_limits
|
80
|
+
|
81
|
+
page = self.page(page_size: limits[:page_size], )
|
82
|
+
|
83
|
+
@version.stream(page,
|
84
|
+
limit: limits[:limit],
|
85
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
86
|
+
end
|
87
|
+
|
88
|
+
##
|
89
|
+
# Retrieve a single page of AssistantsToolInstance records from the API.
|
90
|
+
# Request is executed immediately.
|
91
|
+
# @param [String] page_token PageToken provided by the API
|
92
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
93
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
94
|
+
# @return [Page] Page of AssistantsToolInstance
|
95
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
96
|
+
params = Twilio::Values.of({
|
97
|
+
'PageToken' => page_token,
|
98
|
+
'Page' => page_number,
|
99
|
+
'PageSize' => page_size,
|
100
|
+
})
|
101
|
+
|
102
|
+
response = @version.page('GET', @uri, params: params)
|
103
|
+
|
104
|
+
AssistantsToolPage.new(@version, response, @solution)
|
105
|
+
end
|
106
|
+
|
107
|
+
##
|
108
|
+
# Retrieve a single page of AssistantsToolInstance records from the API.
|
109
|
+
# Request is executed immediately.
|
110
|
+
# @param [String] target_url API-generated URL for the requested results page
|
111
|
+
# @return [Page] Page of AssistantsToolInstance
|
112
|
+
def get_page(target_url)
|
113
|
+
response = @version.domain.request(
|
114
|
+
'GET',
|
115
|
+
target_url
|
116
|
+
)
|
117
|
+
AssistantsToolPage.new(@version, response, @solution)
|
118
|
+
end
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
# Provide a user friendly representation
|
123
|
+
def to_s
|
124
|
+
'#<Twilio.Assistants.V1.AssistantsToolList>'
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
|
129
|
+
class AssistantsToolContext < InstanceContext
|
130
|
+
##
|
131
|
+
# Initialize the AssistantsToolContext
|
132
|
+
# @param [Version] version Version that contains the resource
|
133
|
+
# @param [String] assistant_id The assistant ID.
|
134
|
+
# @param [String] id The tool ID.
|
135
|
+
# @return [AssistantsToolContext] AssistantsToolContext
|
136
|
+
def initialize(version, assistant_id, id)
|
137
|
+
super(version)
|
138
|
+
|
139
|
+
# Path Solution
|
140
|
+
@solution = { assistant_id: assistant_id, id: id, }
|
141
|
+
@uri = "/Assistants/#{@solution[:assistant_id]}/Tools/#{@solution[:id]}"
|
142
|
+
|
143
|
+
|
144
|
+
end
|
145
|
+
##
|
146
|
+
# Create the AssistantsToolInstance
|
147
|
+
# @return [AssistantsToolInstance] Created AssistantsToolInstance
|
148
|
+
def create
|
149
|
+
|
150
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
151
|
+
|
152
|
+
payload = @version.create('POST', @uri, headers: headers)
|
153
|
+
AssistantsToolInstance.new(
|
154
|
+
@version,
|
155
|
+
payload,
|
156
|
+
assistant_id: @solution[:assistant_id],
|
157
|
+
id: @solution[:id],
|
158
|
+
)
|
159
|
+
end
|
160
|
+
|
161
|
+
##
|
162
|
+
# Delete the AssistantsToolInstance
|
163
|
+
# @return [Boolean] True if delete succeeds, false otherwise
|
164
|
+
def delete
|
165
|
+
|
166
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
167
|
+
|
168
|
+
@version.delete('DELETE', @uri, headers: headers)
|
169
|
+
end
|
170
|
+
|
171
|
+
|
172
|
+
##
|
173
|
+
# Provide a user friendly representation
|
174
|
+
def to_s
|
175
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
176
|
+
"#<Twilio.Assistants.V1.AssistantsToolContext #{context}>"
|
177
|
+
end
|
178
|
+
|
179
|
+
##
|
180
|
+
# Provide a detailed, user friendly representation
|
181
|
+
def inspect
|
182
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
183
|
+
"#<Twilio.Assistants.V1.AssistantsToolContext #{context}>"
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
class AssistantsToolPage < Page
|
188
|
+
##
|
189
|
+
# Initialize the AssistantsToolPage
|
190
|
+
# @param [Version] version Version that contains the resource
|
191
|
+
# @param [Response] response Response from the API
|
192
|
+
# @param [Hash] solution Path solution for the resource
|
193
|
+
# @return [AssistantsToolPage] AssistantsToolPage
|
194
|
+
def initialize(version, response, solution)
|
195
|
+
super(version, response)
|
196
|
+
|
197
|
+
# Path Solution
|
198
|
+
@solution = solution
|
199
|
+
end
|
200
|
+
|
201
|
+
##
|
202
|
+
# Build an instance of AssistantsToolInstance
|
203
|
+
# @param [Hash] payload Payload response from the API
|
204
|
+
# @return [AssistantsToolInstance] AssistantsToolInstance
|
205
|
+
def get_instance(payload)
|
206
|
+
AssistantsToolInstance.new(@version, payload, assistant_id: @solution[:assistant_id])
|
207
|
+
end
|
208
|
+
|
209
|
+
##
|
210
|
+
# Provide a user friendly representation
|
211
|
+
def to_s
|
212
|
+
'<Twilio.Assistants.V1.AssistantsToolPage>'
|
213
|
+
end
|
214
|
+
end
|
215
|
+
class AssistantsToolInstance < InstanceResource
|
216
|
+
##
|
217
|
+
# Initialize the AssistantsToolInstance
|
218
|
+
# @param [Version] version Version that contains the resource
|
219
|
+
# @param [Hash] payload payload that contains response from Twilio
|
220
|
+
# @param [String] account_sid The SID of the
|
221
|
+
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this AssistantsTool
|
222
|
+
# resource.
|
223
|
+
# @param [String] sid The SID of the Call resource to fetch.
|
224
|
+
# @return [AssistantsToolInstance] AssistantsToolInstance
|
225
|
+
def initialize(version, payload , assistant_id: nil, id: nil)
|
226
|
+
super(version)
|
227
|
+
|
228
|
+
# Marshaled Properties
|
229
|
+
@properties = {
|
230
|
+
'account_sid' => payload['account_sid'],
|
231
|
+
'description' => payload['description'],
|
232
|
+
'enabled' => payload['enabled'],
|
233
|
+
'id' => payload['id'],
|
234
|
+
'meta' => payload['meta'],
|
235
|
+
'name' => payload['name'],
|
236
|
+
'requires_auth' => payload['requires_auth'],
|
237
|
+
'type' => payload['type'],
|
238
|
+
'url' => payload['url'],
|
239
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
240
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
241
|
+
}
|
242
|
+
|
243
|
+
# Context
|
244
|
+
@instance_context = nil
|
245
|
+
@params = { 'assistant_id' => assistant_id || @properties['assistant_id'] ,'id' => id || @properties['id'] , }
|
246
|
+
end
|
247
|
+
|
248
|
+
##
|
249
|
+
# Generate an instance context for the instance, the context is capable of
|
250
|
+
# performing various actions. All instance actions are proxied to the context
|
251
|
+
# @return [AssistantsToolContext] CallContext for this CallInstance
|
252
|
+
def context
|
253
|
+
unless @instance_context
|
254
|
+
@instance_context = AssistantsToolContext.new(@version , @params['assistant_id'], @params['id'])
|
255
|
+
end
|
256
|
+
@instance_context
|
257
|
+
end
|
258
|
+
|
259
|
+
##
|
260
|
+
# @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Tool resource.
|
261
|
+
def account_sid
|
262
|
+
@properties['account_sid']
|
263
|
+
end
|
264
|
+
|
265
|
+
##
|
266
|
+
# @return [String] The description of the tool.
|
267
|
+
def description
|
268
|
+
@properties['description']
|
269
|
+
end
|
270
|
+
|
271
|
+
##
|
272
|
+
# @return [Boolean] True if the tool is enabled.
|
273
|
+
def enabled
|
274
|
+
@properties['enabled']
|
275
|
+
end
|
276
|
+
|
277
|
+
##
|
278
|
+
# @return [String] The tool ID.
|
279
|
+
def id
|
280
|
+
@properties['id']
|
281
|
+
end
|
282
|
+
|
283
|
+
##
|
284
|
+
# @return [Hash] The metadata related to method, url, input_schema to used with the Tool.
|
285
|
+
def meta
|
286
|
+
@properties['meta']
|
287
|
+
end
|
288
|
+
|
289
|
+
##
|
290
|
+
# @return [String] The name of the tool.
|
291
|
+
def name
|
292
|
+
@properties['name']
|
293
|
+
end
|
294
|
+
|
295
|
+
##
|
296
|
+
# @return [Boolean] The authentication requirement for the tool.
|
297
|
+
def requires_auth
|
298
|
+
@properties['requires_auth']
|
299
|
+
end
|
300
|
+
|
301
|
+
##
|
302
|
+
# @return [String] The type of the tool. ('WEBHOOK')
|
303
|
+
def type
|
304
|
+
@properties['type']
|
305
|
+
end
|
306
|
+
|
307
|
+
##
|
308
|
+
# @return [String] The url of the tool resource.
|
309
|
+
def url
|
310
|
+
@properties['url']
|
311
|
+
end
|
312
|
+
|
313
|
+
##
|
314
|
+
# @return [Time] The date and time in GMT when the Tool was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
315
|
+
def date_created
|
316
|
+
@properties['date_created']
|
317
|
+
end
|
318
|
+
|
319
|
+
##
|
320
|
+
# @return [Time] The date and time in GMT when the Tool was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
321
|
+
def date_updated
|
322
|
+
@properties['date_updated']
|
323
|
+
end
|
324
|
+
|
325
|
+
##
|
326
|
+
# Create the AssistantsToolInstance
|
327
|
+
# @return [AssistantsToolInstance] Created AssistantsToolInstance
|
328
|
+
def create
|
329
|
+
|
330
|
+
context.create
|
331
|
+
end
|
332
|
+
|
333
|
+
##
|
334
|
+
# Delete the AssistantsToolInstance
|
335
|
+
# @return [Boolean] True if delete succeeds, false otherwise
|
336
|
+
def delete
|
337
|
+
|
338
|
+
context.delete
|
339
|
+
end
|
340
|
+
|
341
|
+
##
|
342
|
+
# Provide a user friendly representation
|
343
|
+
def to_s
|
344
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
345
|
+
"<Twilio.Assistants.V1.AssistantsToolInstance #{values}>"
|
346
|
+
end
|
347
|
+
|
348
|
+
##
|
349
|
+
# Provide a detailed, user friendly representation
|
350
|
+
def inspect
|
351
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
352
|
+
"<Twilio.Assistants.V1.AssistantsToolInstance #{values}>"
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|
356
|
+
end
|
357
|
+
end
|
358
|
+
end
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
|
@@ -0,0 +1,303 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
6
|
+
#
|
7
|
+
# Twilio - Assistants
|
8
|
+
# This is the public Twilio REST API.
|
9
|
+
#
|
10
|
+
# NOTE: This class is auto generated by OpenAPI Generator.
|
11
|
+
# https://openapi-generator.tech
|
12
|
+
# Do not edit the class manually.
|
13
|
+
#
|
14
|
+
|
15
|
+
|
16
|
+
module Twilio
|
17
|
+
module REST
|
18
|
+
class Assistants < AssistantsBase
|
19
|
+
class V1 < Version
|
20
|
+
class AssistantContext < InstanceContext
|
21
|
+
|
22
|
+
class FeedbackList < ListResource
|
23
|
+
|
24
|
+
class AssistantsV1ServiceCreateFeedbackRequest
|
25
|
+
# @param [message_id]: [String] The message ID.
|
26
|
+
# @param [score]: [Float] The score to be given(0-1).
|
27
|
+
# @param [session_id]: [String] The Session ID.
|
28
|
+
# @param [text]: [String] The text to be given as feedback.
|
29
|
+
attr_accessor :message_id, :score, :session_id, :text
|
30
|
+
def initialize(payload)
|
31
|
+
@message_id = payload["message_id"]
|
32
|
+
@score = payload["score"]
|
33
|
+
@session_id = payload["session_id"]
|
34
|
+
@text = payload["text"]
|
35
|
+
end
|
36
|
+
def to_json(options = {})
|
37
|
+
{
|
38
|
+
message_id: @message_id,
|
39
|
+
score: @score,
|
40
|
+
session_id: @session_id,
|
41
|
+
text: @text,
|
42
|
+
}.to_json(options)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
##
|
47
|
+
# Initialize the FeedbackList
|
48
|
+
# @param [Version] version Version that contains the resource
|
49
|
+
# @return [FeedbackList] FeedbackList
|
50
|
+
def initialize(version, id: nil)
|
51
|
+
super(version)
|
52
|
+
# Path Solution
|
53
|
+
@solution = { id: id }
|
54
|
+
@uri = "/Assistants/#{@solution[:id]}/Feedbacks"
|
55
|
+
|
56
|
+
end
|
57
|
+
##
|
58
|
+
# Create the FeedbackInstance
|
59
|
+
# @param [AssistantsV1ServiceCreateFeedbackRequest] assistants_v1_service_create_feedback_request
|
60
|
+
# @return [FeedbackInstance] Created FeedbackInstance
|
61
|
+
def create(assistants_v1_service_create_feedback_request: nil
|
62
|
+
)
|
63
|
+
|
64
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
65
|
+
headers['Content-Type'] = 'application/json'
|
66
|
+
payload = @version.create('POST', @uri, headers: headers, data: assistants_v1_service_create_feedback_request.to_json)
|
67
|
+
FeedbackInstance.new(
|
68
|
+
@version,
|
69
|
+
payload,
|
70
|
+
id: @solution[:id],
|
71
|
+
)
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
##
|
76
|
+
# Lists FeedbackInstance records from the API as a list.
|
77
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
78
|
+
# memory before returning.
|
79
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
80
|
+
# guarantees to never return more than limit. Default is no limit
|
81
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
82
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
83
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
84
|
+
# efficient page size, i.e. min(limit, 1000)
|
85
|
+
# @return [Array] Array of up to limit results
|
86
|
+
def list(limit: nil, page_size: nil)
|
87
|
+
self.stream(
|
88
|
+
limit: limit,
|
89
|
+
page_size: page_size
|
90
|
+
).entries
|
91
|
+
end
|
92
|
+
|
93
|
+
##
|
94
|
+
# Streams Instance records from the API as an Enumerable.
|
95
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
96
|
+
# is reached.
|
97
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
98
|
+
# guarantees to never return more than limit. Default is no limit
|
99
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
100
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
101
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
102
|
+
# efficient page size, i.e. min(limit, 1000)
|
103
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
104
|
+
def stream(limit: nil, page_size: nil)
|
105
|
+
limits = @version.read_limits(limit, page_size)
|
106
|
+
|
107
|
+
page = self.page(
|
108
|
+
page_size: limits[:page_size], )
|
109
|
+
|
110
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
111
|
+
end
|
112
|
+
|
113
|
+
##
|
114
|
+
# When passed a block, yields FeedbackInstance records from the API.
|
115
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
116
|
+
# is reached.
|
117
|
+
def each
|
118
|
+
limits = @version.read_limits
|
119
|
+
|
120
|
+
page = self.page(page_size: limits[:page_size], )
|
121
|
+
|
122
|
+
@version.stream(page,
|
123
|
+
limit: limits[:limit],
|
124
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
125
|
+
end
|
126
|
+
|
127
|
+
##
|
128
|
+
# Retrieve a single page of FeedbackInstance records from the API.
|
129
|
+
# Request is executed immediately.
|
130
|
+
# @param [String] page_token PageToken provided by the API
|
131
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
132
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
133
|
+
# @return [Page] Page of FeedbackInstance
|
134
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
135
|
+
params = Twilio::Values.of({
|
136
|
+
'PageToken' => page_token,
|
137
|
+
'Page' => page_number,
|
138
|
+
'PageSize' => page_size,
|
139
|
+
})
|
140
|
+
|
141
|
+
response = @version.page('GET', @uri, params: params)
|
142
|
+
|
143
|
+
FeedbackPage.new(@version, response, @solution)
|
144
|
+
end
|
145
|
+
|
146
|
+
##
|
147
|
+
# Retrieve a single page of FeedbackInstance records from the API.
|
148
|
+
# Request is executed immediately.
|
149
|
+
# @param [String] target_url API-generated URL for the requested results page
|
150
|
+
# @return [Page] Page of FeedbackInstance
|
151
|
+
def get_page(target_url)
|
152
|
+
response = @version.domain.request(
|
153
|
+
'GET',
|
154
|
+
target_url
|
155
|
+
)
|
156
|
+
FeedbackPage.new(@version, response, @solution)
|
157
|
+
end
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
# Provide a user friendly representation
|
162
|
+
def to_s
|
163
|
+
'#<Twilio.Assistants.V1.FeedbackList>'
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
class FeedbackPage < Page
|
168
|
+
##
|
169
|
+
# Initialize the FeedbackPage
|
170
|
+
# @param [Version] version Version that contains the resource
|
171
|
+
# @param [Response] response Response from the API
|
172
|
+
# @param [Hash] solution Path solution for the resource
|
173
|
+
# @return [FeedbackPage] FeedbackPage
|
174
|
+
def initialize(version, response, solution)
|
175
|
+
super(version, response)
|
176
|
+
|
177
|
+
# Path Solution
|
178
|
+
@solution = solution
|
179
|
+
end
|
180
|
+
|
181
|
+
##
|
182
|
+
# Build an instance of FeedbackInstance
|
183
|
+
# @param [Hash] payload Payload response from the API
|
184
|
+
# @return [FeedbackInstance] FeedbackInstance
|
185
|
+
def get_instance(payload)
|
186
|
+
FeedbackInstance.new(@version, payload, id: @solution[:id])
|
187
|
+
end
|
188
|
+
|
189
|
+
##
|
190
|
+
# Provide a user friendly representation
|
191
|
+
def to_s
|
192
|
+
'<Twilio.Assistants.V1.FeedbackPage>'
|
193
|
+
end
|
194
|
+
end
|
195
|
+
class FeedbackInstance < InstanceResource
|
196
|
+
##
|
197
|
+
# Initialize the FeedbackInstance
|
198
|
+
# @param [Version] version Version that contains the resource
|
199
|
+
# @param [Hash] payload payload that contains response from Twilio
|
200
|
+
# @param [String] account_sid The SID of the
|
201
|
+
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this Feedback
|
202
|
+
# resource.
|
203
|
+
# @param [String] sid The SID of the Call resource to fetch.
|
204
|
+
# @return [FeedbackInstance] FeedbackInstance
|
205
|
+
def initialize(version, payload , id: nil)
|
206
|
+
super(version)
|
207
|
+
|
208
|
+
# Marshaled Properties
|
209
|
+
@properties = {
|
210
|
+
'assistant_id' => payload['assistant_id'],
|
211
|
+
'id' => payload['id'],
|
212
|
+
'account_sid' => payload['account_sid'],
|
213
|
+
'user_sid' => payload['user_sid'],
|
214
|
+
'message_id' => payload['message_id'],
|
215
|
+
'score' => payload['score'],
|
216
|
+
'session_id' => payload['session_id'],
|
217
|
+
'text' => payload['text'],
|
218
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
219
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
220
|
+
}
|
221
|
+
end
|
222
|
+
|
223
|
+
|
224
|
+
##
|
225
|
+
# @return [String] The Assistant ID.
|
226
|
+
def assistant_id
|
227
|
+
@properties['assistant_id']
|
228
|
+
end
|
229
|
+
|
230
|
+
##
|
231
|
+
# @return [String] The Feedback ID.
|
232
|
+
def id
|
233
|
+
@properties['id']
|
234
|
+
end
|
235
|
+
|
236
|
+
##
|
237
|
+
# @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Feedback.
|
238
|
+
def account_sid
|
239
|
+
@properties['account_sid']
|
240
|
+
end
|
241
|
+
|
242
|
+
##
|
243
|
+
# @return [String] The SID of the User created the Feedback.
|
244
|
+
def user_sid
|
245
|
+
@properties['user_sid']
|
246
|
+
end
|
247
|
+
|
248
|
+
##
|
249
|
+
# @return [String] The Message ID.
|
250
|
+
def message_id
|
251
|
+
@properties['message_id']
|
252
|
+
end
|
253
|
+
|
254
|
+
##
|
255
|
+
# @return [Float] The Score to provide as Feedback (0-1)
|
256
|
+
def score
|
257
|
+
@properties['score']
|
258
|
+
end
|
259
|
+
|
260
|
+
##
|
261
|
+
# @return [String] The Session ID.
|
262
|
+
def session_id
|
263
|
+
@properties['session_id']
|
264
|
+
end
|
265
|
+
|
266
|
+
##
|
267
|
+
# @return [String] The text to be given as feedback.
|
268
|
+
def text
|
269
|
+
@properties['text']
|
270
|
+
end
|
271
|
+
|
272
|
+
##
|
273
|
+
# @return [Time] The date and time in GMT when the Feedback was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
274
|
+
def date_created
|
275
|
+
@properties['date_created']
|
276
|
+
end
|
277
|
+
|
278
|
+
##
|
279
|
+
# @return [Time] The date and time in GMT when the Feedback was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
280
|
+
def date_updated
|
281
|
+
@properties['date_updated']
|
282
|
+
end
|
283
|
+
|
284
|
+
##
|
285
|
+
# Provide a user friendly representation
|
286
|
+
def to_s
|
287
|
+
"<Twilio.Assistants.V1.FeedbackInstance>"
|
288
|
+
end
|
289
|
+
|
290
|
+
##
|
291
|
+
# Provide a detailed, user friendly representation
|
292
|
+
def inspect
|
293
|
+
"<Twilio.Assistants.V1.FeedbackInstance>"
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
end
|
298
|
+
end
|
299
|
+
end
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
|