twilio-ruby 7.0.0.pre.rc.3 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,436 +0,0 @@
1
- ##
2
- # This code was generated by
3
- # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4
- # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5
- # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6
- #
7
- # Twilio - Media
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 Media < MediaBase
19
- class V1 < Version
20
- class PlayerStreamerList < ListResource
21
-
22
- ##
23
- # Initialize the PlayerStreamerList
24
- # @param [Version] version Version that contains the resource
25
- # @return [PlayerStreamerList] PlayerStreamerList
26
- def initialize(version)
27
- super(version)
28
- # Path Solution
29
- @solution = { }
30
- @uri = "/PlayerStreamers"
31
-
32
- end
33
- ##
34
- # Create the PlayerStreamerInstance
35
- # @param [Boolean] video Specifies whether the PlayerStreamer is configured to stream video. Defaults to `true`.
36
- # @param [String] status_callback The URL to which Twilio will send asynchronous webhook requests for every PlayerStreamer event. See [Status Callbacks](/docs/live/api/status-callbacks) for more details.
37
- # @param [String] status_callback_method The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`.
38
- # @param [String] max_duration The maximum time, in seconds, that the PlayerStreamer is active (`created` or `started`) before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the PlayerStreamer, regardless of whether media is still streaming.
39
- # @return [PlayerStreamerInstance] Created PlayerStreamerInstance
40
- def create(
41
- video: :unset,
42
- status_callback: :unset,
43
- status_callback_method: :unset,
44
- max_duration: :unset
45
- )
46
-
47
- data = Twilio::Values.of({
48
- 'Video' => video,
49
- 'StatusCallback' => status_callback,
50
- 'StatusCallbackMethod' => status_callback_method,
51
- 'MaxDuration' => max_duration,
52
- })
53
-
54
-
55
- payload = @version.create('POST', @uri, data: data)
56
- PlayerStreamerInstance.new(
57
- @version,
58
- payload,
59
- )
60
- end
61
-
62
-
63
- ##
64
- # Lists PlayerStreamerInstance records from the API as a list.
65
- # Unlike stream(), this operation is eager and will load `limit` records into
66
- # memory before returning.
67
- # @param [Order] order The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default.
68
- # @param [Status] status Status to filter by, with possible values `created`, `started`, `ended`, or `failed`.
69
- # @param [Integer] limit Upper limit for the number of records to return. stream()
70
- # guarantees to never return more than limit. Default is no limit
71
- # @param [Integer] page_size Number of records to fetch per request, when
72
- # not set will use the default value of 50 records. If no page_size is defined
73
- # but a limit is defined, stream() will attempt to read the limit with the most
74
- # efficient page size, i.e. min(limit, 1000)
75
- # @return [Array] Array of up to limit results
76
- def list(order: :unset, status: :unset, limit: nil, page_size: nil)
77
- self.stream(
78
- order: order,
79
- status: status,
80
- limit: limit,
81
- page_size: page_size
82
- ).entries
83
- end
84
-
85
- ##
86
- # Streams Instance records from the API as an Enumerable.
87
- # This operation lazily loads records as efficiently as possible until the limit
88
- # is reached.
89
- # @param [Order] order The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default.
90
- # @param [Status] status Status to filter by, with possible values `created`, `started`, `ended`, or `failed`.
91
- # @param [Integer] limit Upper limit for the number of records to return. stream()
92
- # guarantees to never return more than limit. Default is no limit
93
- # @param [Integer] page_size Number of records to fetch per request, when
94
- # not set will use the default value of 50 records. If no page_size is defined
95
- # but a limit is defined, stream() will attempt to read the limit with the most
96
- # efficient page size, i.e. min(limit, 1000)
97
- # @return [Enumerable] Enumerable that will yield up to limit results
98
- def stream(order: :unset, status: :unset, limit: nil, page_size: nil)
99
- limits = @version.read_limits(limit, page_size)
100
-
101
- page = self.page(
102
- order: order,
103
- status: status,
104
- page_size: limits[:page_size], )
105
-
106
- @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
107
- end
108
-
109
- ##
110
- # When passed a block, yields PlayerStreamerInstance records from the API.
111
- # This operation lazily loads records as efficiently as possible until the limit
112
- # is reached.
113
- def each
114
- limits = @version.read_limits
115
-
116
- page = self.page(page_size: limits[:page_size], )
117
-
118
- @version.stream(page,
119
- limit: limits[:limit],
120
- page_limit: limits[:page_limit]).each {|x| yield x}
121
- end
122
-
123
- ##
124
- # Retrieve a single page of PlayerStreamerInstance records from the API.
125
- # Request is executed immediately.
126
- # @param [Order] order The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default.
127
- # @param [Status] status Status to filter by, with possible values `created`, `started`, `ended`, or `failed`.
128
- # @param [String] page_token PageToken provided by the API
129
- # @param [Integer] page_number Page Number, this value is simply for client state
130
- # @param [Integer] page_size Number of records to return, defaults to 50
131
- # @return [Page] Page of PlayerStreamerInstance
132
- def page(order: :unset, status: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
133
- params = Twilio::Values.of({
134
- 'Order' => order,
135
- 'Status' => status,
136
- 'PageToken' => page_token,
137
- 'Page' => page_number,
138
- 'PageSize' => page_size,
139
- })
140
-
141
- response = @version.page('GET', @uri, params: params)
142
-
143
- PlayerStreamerPage.new(@version, response, @solution)
144
- end
145
-
146
- ##
147
- # Retrieve a single page of PlayerStreamerInstance 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 PlayerStreamerInstance
151
- def get_page(target_url)
152
- response = @version.domain.request(
153
- 'GET',
154
- target_url
155
- )
156
- PlayerStreamerPage.new(@version, response, @solution)
157
- end
158
-
159
-
160
-
161
- # Provide a user friendly representation
162
- def to_s
163
- '#<Twilio.Media.V1.PlayerStreamerList>'
164
- end
165
- end
166
-
167
-
168
- class PlayerStreamerContext < InstanceContext
169
- ##
170
- # Initialize the PlayerStreamerContext
171
- # @param [Version] version Version that contains the resource
172
- # @param [String] sid The SID of the PlayerStreamer resource to update.
173
- # @return [PlayerStreamerContext] PlayerStreamerContext
174
- def initialize(version, sid)
175
- super(version)
176
-
177
- # Path Solution
178
- @solution = { sid: sid, }
179
- @uri = "/PlayerStreamers/#{@solution[:sid]}"
180
-
181
- # Dependents
182
- @playback_grant = nil
183
- end
184
- ##
185
- # Fetch the PlayerStreamerInstance
186
- # @return [PlayerStreamerInstance] Fetched PlayerStreamerInstance
187
- def fetch
188
-
189
-
190
- payload = @version.fetch('GET', @uri)
191
- PlayerStreamerInstance.new(
192
- @version,
193
- payload,
194
- sid: @solution[:sid],
195
- )
196
- end
197
-
198
- ##
199
- # Update the PlayerStreamerInstance
200
- # @param [UpdateStatus] status
201
- # @return [PlayerStreamerInstance] Updated PlayerStreamerInstance
202
- def update(
203
- status: nil
204
- )
205
-
206
- data = Twilio::Values.of({
207
- 'Status' => status,
208
- })
209
-
210
-
211
- payload = @version.update('POST', @uri, data: data)
212
- PlayerStreamerInstance.new(
213
- @version,
214
- payload,
215
- sid: @solution[:sid],
216
- )
217
- end
218
-
219
- ##
220
- # Access the playback_grant
221
- # @return [PlaybackGrantList]
222
- # @return [PlaybackGrantContext]
223
- def playback_grant
224
- PlaybackGrantContext.new(
225
- @version,
226
- @solution[:sid]
227
- )
228
- end
229
-
230
- ##
231
- # Provide a user friendly representation
232
- def to_s
233
- context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
234
- "#<Twilio.Media.V1.PlayerStreamerContext #{context}>"
235
- end
236
-
237
- ##
238
- # Provide a detailed, user friendly representation
239
- def inspect
240
- context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
241
- "#<Twilio.Media.V1.PlayerStreamerContext #{context}>"
242
- end
243
- end
244
-
245
- class PlayerStreamerPage < Page
246
- ##
247
- # Initialize the PlayerStreamerPage
248
- # @param [Version] version Version that contains the resource
249
- # @param [Response] response Response from the API
250
- # @param [Hash] solution Path solution for the resource
251
- # @return [PlayerStreamerPage] PlayerStreamerPage
252
- def initialize(version, response, solution)
253
- super(version, response)
254
-
255
- # Path Solution
256
- @solution = solution
257
- end
258
-
259
- ##
260
- # Build an instance of PlayerStreamerInstance
261
- # @param [Hash] payload Payload response from the API
262
- # @return [PlayerStreamerInstance] PlayerStreamerInstance
263
- def get_instance(payload)
264
- PlayerStreamerInstance.new(@version, payload)
265
- end
266
-
267
- ##
268
- # Provide a user friendly representation
269
- def to_s
270
- '<Twilio.Media.V1.PlayerStreamerPage>'
271
- end
272
- end
273
- class PlayerStreamerInstance < InstanceResource
274
- ##
275
- # Initialize the PlayerStreamerInstance
276
- # @param [Version] version Version that contains the resource
277
- # @param [Hash] payload payload that contains response from Twilio
278
- # @param [String] account_sid The SID of the
279
- # {Account}[https://www.twilio.com/docs/iam/api/account] that created this PlayerStreamer
280
- # resource.
281
- # @param [String] sid The SID of the Call resource to fetch.
282
- # @return [PlayerStreamerInstance] PlayerStreamerInstance
283
- def initialize(version, payload , sid: nil)
284
- super(version)
285
-
286
- # Marshaled Properties
287
- @properties = {
288
- 'account_sid' => payload['account_sid'],
289
- 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
290
- 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
291
- 'video' => payload['video'],
292
- 'links' => payload['links'],
293
- 'sid' => payload['sid'],
294
- 'status' => payload['status'],
295
- 'url' => payload['url'],
296
- 'status_callback' => payload['status_callback'],
297
- 'status_callback_method' => payload['status_callback_method'],
298
- 'ended_reason' => payload['ended_reason'],
299
- 'max_duration' => payload['max_duration'] == nil ? payload['max_duration'] : payload['max_duration'].to_i,
300
- }
301
-
302
- # Context
303
- @instance_context = nil
304
- @params = { 'sid' => sid || @properties['sid'] , }
305
- end
306
-
307
- ##
308
- # Generate an instance context for the instance, the context is capable of
309
- # performing various actions. All instance actions are proxied to the context
310
- # @return [PlayerStreamerContext] CallContext for this CallInstance
311
- def context
312
- unless @instance_context
313
- @instance_context = PlayerStreamerContext.new(@version , @params['sid'])
314
- end
315
- @instance_context
316
- end
317
-
318
- ##
319
- # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PlayerStreamer resource.
320
- def account_sid
321
- @properties['account_sid']
322
- end
323
-
324
- ##
325
- # @return [Time] The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
326
- def date_created
327
- @properties['date_created']
328
- end
329
-
330
- ##
331
- # @return [Time] The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
332
- def date_updated
333
- @properties['date_updated']
334
- end
335
-
336
- ##
337
- # @return [Boolean] Specifies whether the PlayerStreamer is configured to stream video. Defaults to `true`.
338
- def video
339
- @properties['video']
340
- end
341
-
342
- ##
343
- # @return [Hash] The URLs of related resources.
344
- def links
345
- @properties['links']
346
- end
347
-
348
- ##
349
- # @return [String] The unique string generated to identify the PlayerStreamer resource.
350
- def sid
351
- @properties['sid']
352
- end
353
-
354
- ##
355
- # @return [Status]
356
- def status
357
- @properties['status']
358
- end
359
-
360
- ##
361
- # @return [String] The absolute URL of the resource.
362
- def url
363
- @properties['url']
364
- end
365
-
366
- ##
367
- # @return [String] The URL to which Twilio will send asynchronous webhook requests for every PlayerStreamer event. See [Status Callbacks](/docs/live/api/status-callbacks) for more details.
368
- def status_callback
369
- @properties['status_callback']
370
- end
371
-
372
- ##
373
- # @return [String] The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`.
374
- def status_callback_method
375
- @properties['status_callback_method']
376
- end
377
-
378
- ##
379
- # @return [EndedReason]
380
- def ended_reason
381
- @properties['ended_reason']
382
- end
383
-
384
- ##
385
- # @return [String] The maximum time, in seconds, that the PlayerStreamer is active (`created` or `started`) before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the PlayerStreamer, regardless of whether media is still streaming.
386
- def max_duration
387
- @properties['max_duration']
388
- end
389
-
390
- ##
391
- # Fetch the PlayerStreamerInstance
392
- # @return [PlayerStreamerInstance] Fetched PlayerStreamerInstance
393
- def fetch
394
-
395
- context.fetch
396
- end
397
-
398
- ##
399
- # Update the PlayerStreamerInstance
400
- # @param [UpdateStatus] status
401
- # @return [PlayerStreamerInstance] Updated PlayerStreamerInstance
402
- def update(
403
- status: nil
404
- )
405
-
406
- context.update(
407
- status: status,
408
- )
409
- end
410
-
411
- ##
412
- # Access the playback_grant
413
- # @return [playback_grant] playback_grant
414
- def playback_grant
415
- context.playback_grant
416
- end
417
-
418
- ##
419
- # Provide a user friendly representation
420
- def to_s
421
- values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
422
- "<Twilio.Media.V1.PlayerStreamerInstance #{values}>"
423
- end
424
-
425
- ##
426
- # Provide a detailed, user friendly representation
427
- def inspect
428
- values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
429
- "<Twilio.Media.V1.PlayerStreamerInstance #{values}>"
430
- end
431
- end
432
-
433
- end
434
- end
435
- end
436
- end
@@ -1,79 +0,0 @@
1
- ##
2
- # This code was generated by
3
- # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4
- # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5
- # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6
- #
7
- # Twilio - Media
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
- module Twilio
16
- module REST
17
- class Media
18
- class V1 < Version
19
- ##
20
- # Initialize the V1 version of Media
21
- def initialize(domain)
22
- super
23
- @version = 'v1'
24
- @media_processor = nil
25
- @media_recording = nil
26
- @player_streamer = nil
27
- end
28
-
29
- ##
30
- # @param [String] sid The SID of the MediaProcessor resource to fetch.
31
- # @return [Twilio::REST::Media::V1::MediaProcessorContext] if sid was passed.
32
- # @return [Twilio::REST::Media::V1::MediaProcessorList]
33
- def media_processor(sid=:unset)
34
- if sid.nil?
35
- raise ArgumentError, 'sid cannot be nil'
36
- end
37
- if sid == :unset
38
- @media_processor ||= MediaProcessorList.new self
39
- else
40
- MediaProcessorContext.new(self, sid)
41
- end
42
- end
43
- ##
44
- # @param [String] sid The SID of the MediaRecording resource to fetch.
45
- # @return [Twilio::REST::Media::V1::MediaRecordingContext] if sid was passed.
46
- # @return [Twilio::REST::Media::V1::MediaRecordingList]
47
- def media_recording(sid=:unset)
48
- if sid.nil?
49
- raise ArgumentError, 'sid cannot be nil'
50
- end
51
- if sid == :unset
52
- @media_recording ||= MediaRecordingList.new self
53
- else
54
- MediaRecordingContext.new(self, sid)
55
- end
56
- end
57
- ##
58
- # @param [String] sid The SID of the PlayerStreamer resource to fetch.
59
- # @return [Twilio::REST::Media::V1::PlayerStreamerContext] if sid was passed.
60
- # @return [Twilio::REST::Media::V1::PlayerStreamerList]
61
- def player_streamer(sid=:unset)
62
- if sid.nil?
63
- raise ArgumentError, 'sid cannot be nil'
64
- end
65
- if sid == :unset
66
- @player_streamer ||= PlayerStreamerList.new self
67
- else
68
- PlayerStreamerContext.new(self, sid)
69
- end
70
- end
71
- ##
72
- # Provide a user friendly representation
73
- def to_s
74
- '<Twilio::REST::Media::V1>';
75
- end
76
- end
77
- end
78
- end
79
- end
@@ -1,35 +0,0 @@
1
- module Twilio
2
- module REST
3
- class Media < MediaBase
4
- ##
5
- # @param [String] sid The unique string generated to identify the MediaProcessor
6
- # resource.
7
- # @return [Twilio::REST::Media::V1::MediaProcessorInstance] if sid was passed.
8
- # @return [Twilio::REST::Media::V1::MediaProcessorList]
9
- def media_processor(sid=:unset)
10
- warn "media_processor is deprecated. Use v1.media_processor instead."
11
- self.v1.media_processor(sid)
12
- end
13
-
14
- ##
15
- # @param [String] sid The unique string generated to identify the MediaRecording
16
- # resource.
17
- # @return [Twilio::REST::Media::V1::MediaRecordingInstance] if sid was passed.
18
- # @return [Twilio::REST::Media::V1::MediaRecordingList]
19
- def media_recording(sid=:unset)
20
- warn "media_recording is deprecated. Use v1.media_recording instead."
21
- self.v1.media_recording(sid)
22
- end
23
-
24
- ##
25
- # @param [String] sid The unique string generated to identify the PlayerStreamer
26
- # resource.
27
- # @return [Twilio::REST::Media::V1::PlayerStreamerInstance] if sid was passed.
28
- # @return [Twilio::REST::Media::V1::PlayerStreamerList]
29
- def player_streamer(sid=:unset)
30
- warn "player_streamer is deprecated. Use v1.player_streamer instead."
31
- self.v1.player_streamer(sid)
32
- end
33
- end
34
- end
35
- end
@@ -1,38 +0,0 @@
1
- ##
2
- # This code was generated by
3
- # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4
- # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5
- # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6
- #
7
- # NOTE: This class is auto generated by OpenAPI Generator.
8
- # https://openapi-generator.tech
9
- # Do not edit the class manually.
10
- # frozen_string_literal: true
11
- module Twilio
12
- module REST
13
- class MediaBase < Domain
14
- ##
15
- # Initialize media domain
16
- #
17
- # @param twilio - The twilio client
18
- #
19
- def initialize(twilio)
20
- super(twilio)
21
- @base_url = "https://media.twilio.com"
22
- @host = "media.twilio.com"
23
- @port = 443
24
- @v1 = nil
25
- end
26
-
27
- def v1
28
- @v1 ||= Media::V1.new self
29
- end
30
-
31
- ##
32
- # Provide a user friendly representation
33
- def to_s
34
- '<Twilio::REST::Media::V1>';
35
- end
36
- end
37
- end
38
- end