twilio-ruby 7.8.6 → 7.8.8

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.
@@ -0,0 +1,462 @@
1
+ ##
2
+ # This code was generated by
3
+ # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4
+ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5
+ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6
+ #
7
+ # Twilio - Iam
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 Iam < IamBase
19
+ class V1 < Version
20
+ class OAuthAppList < ListResource
21
+
22
+ class IamV1AccountVendorOauthAppCreateRequest
23
+ # @param [type]: [String]
24
+ # @param [friendly_name]: [String]
25
+ # @param [owner_sid]: [String]
26
+ # @param [description]: [String]
27
+ # @param [client_sid]: [String]
28
+ # @param [policy]: [OAuthAppList.IamV1OrganizationVendoroauthappPolicy]
29
+ # @param [access_token_ttl]: [String]
30
+ attr_accessor :type, :friendly_name, :owner_sid, :description, :client_sid, :policy, :access_token_ttl
31
+ def initialize(payload)
32
+ @type = payload["type"]
33
+ @friendly_name = payload["friendly_name"]
34
+ @owner_sid = payload["owner_sid"]
35
+ @description = payload["description"]
36
+ @client_sid = payload["client_sid"]
37
+ @policy = payload["policy"]
38
+ @access_token_ttl = payload["access_token_ttl"]
39
+ end
40
+ def to_json(options = {})
41
+ {
42
+ "type": @type,
43
+ "friendly_name": @friendly_name,
44
+ "owner_sid": @owner_sid,
45
+ "description": @description,
46
+ "client_sid": @client_sid,
47
+ "policy": @policy,
48
+ "access_token_ttl": @access_token_ttl,
49
+ }.to_json(options)
50
+ end
51
+ end
52
+
53
+ class IamV1AccountVendorOauthAppUpdateRequest
54
+ # @param [type]: [String]
55
+ # @param [friendly_name]: [String]
56
+ # @param [description]: [String]
57
+ # @param [policy]: [OAuthAppList.IamV1OrganizationVendorOauthAppUpdateRequestPolicy]
58
+ # @param [access_token_ttl]: [String]
59
+ attr_accessor :type, :friendly_name, :description, :policy, :access_token_ttl
60
+ def initialize(payload)
61
+ @type = payload["type"]
62
+ @friendly_name = payload["friendly_name"]
63
+ @description = payload["description"]
64
+ @policy = payload["policy"]
65
+ @access_token_ttl = payload["access_token_ttl"]
66
+ end
67
+ def to_json(options = {})
68
+ {
69
+ "type": @type,
70
+ "friendly_name": @friendly_name,
71
+ "description": @description,
72
+ "policy": @policy,
73
+ "access_token_ttl": @access_token_ttl,
74
+ }.to_json(options)
75
+ end
76
+ end
77
+
78
+ class IamV1OrganizationVendorOauthAppUpdateRequestPolicy
79
+ # @param [allow]: [Array<String>] Set of permissions explicitly allowed
80
+ # @param [deny]: [Array<String>] Set of permissions explicitly denied
81
+ attr_accessor :allow, :deny
82
+ def initialize(payload)
83
+ @allow = payload["allow"]
84
+ @deny = payload["deny"]
85
+ end
86
+ def to_json(options = {})
87
+ {
88
+ "allow": @allow,
89
+ "deny": @deny,
90
+ }.to_json(options)
91
+ end
92
+ end
93
+
94
+
95
+ class IamV1AccountVendorOauthAppCreateRequest
96
+ # @param [type]: [String]
97
+ # @param [friendly_name]: [String]
98
+ # @param [owner_sid]: [String]
99
+ # @param [description]: [String]
100
+ # @param [client_sid]: [String]
101
+ # @param [policy]: [OAuthAppList.IamV1OrganizationVendoroauthappPolicy]
102
+ # @param [access_token_ttl]: [String]
103
+ attr_accessor :type, :friendly_name, :owner_sid, :description, :client_sid, :policy, :access_token_ttl
104
+ def initialize(payload)
105
+ @type = payload["type"]
106
+ @friendly_name = payload["friendly_name"]
107
+ @owner_sid = payload["owner_sid"]
108
+ @description = payload["description"]
109
+ @client_sid = payload["client_sid"]
110
+ @policy = payload["policy"]
111
+ @access_token_ttl = payload["access_token_ttl"]
112
+ end
113
+ def to_json(options = {})
114
+ {
115
+ "type": @type,
116
+ "friendly_name": @friendly_name,
117
+ "owner_sid": @owner_sid,
118
+ "description": @description,
119
+ "client_sid": @client_sid,
120
+ "policy": @policy,
121
+ "access_token_ttl": @access_token_ttl,
122
+ }.to_json(options)
123
+ end
124
+ end
125
+
126
+ class IamV1AccountVendorOauthAppUpdateRequest
127
+ # @param [type]: [String]
128
+ # @param [friendly_name]: [String]
129
+ # @param [description]: [String]
130
+ # @param [policy]: [OAuthAppList.IamV1OrganizationVendorOauthAppUpdateRequestPolicy]
131
+ # @param [access_token_ttl]: [String]
132
+ attr_accessor :type, :friendly_name, :description, :policy, :access_token_ttl
133
+ def initialize(payload)
134
+ @type = payload["type"]
135
+ @friendly_name = payload["friendly_name"]
136
+ @description = payload["description"]
137
+ @policy = payload["policy"]
138
+ @access_token_ttl = payload["access_token_ttl"]
139
+ end
140
+ def to_json(options = {})
141
+ {
142
+ "type": @type,
143
+ "friendly_name": @friendly_name,
144
+ "description": @description,
145
+ "policy": @policy,
146
+ "access_token_ttl": @access_token_ttl,
147
+ }.to_json(options)
148
+ end
149
+ end
150
+
151
+ class IamV1OrganizationVendorOauthAppUpdateRequestPolicy
152
+ # @param [allow]: [Array<String>] Set of permissions explicitly allowed
153
+ # @param [deny]: [Array<String>] Set of permissions explicitly denied
154
+ attr_accessor :allow, :deny
155
+ def initialize(payload)
156
+ @allow = payload["allow"]
157
+ @deny = payload["deny"]
158
+ end
159
+ def to_json(options = {})
160
+ {
161
+ "allow": @allow,
162
+ "deny": @deny,
163
+ }.to_json(options)
164
+ end
165
+ end
166
+
167
+
168
+ ##
169
+ # Initialize the OAuthAppList
170
+ # @param [Version] version Version that contains the resource
171
+ # @return [OAuthAppList] OAuthAppList
172
+ def initialize(version)
173
+ super(version)
174
+ # Path Solution
175
+ @solution = { }
176
+ @uri = "/Account/OAuthApps"
177
+
178
+ end
179
+ ##
180
+ # Create the OAuthAppInstance
181
+ # @param [IamV1AccountVendorOauthAppCreateRequest] iam_v1_account_vendor_oauth_app_create_request
182
+ # @return [OAuthAppInstance] Created OAuthAppInstance
183
+ def create(iam_v1_account_vendor_oauth_app_create_request: nil
184
+ )
185
+
186
+ headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
187
+ headers['Content-Type'] = 'application/json'
188
+
189
+
190
+
191
+
192
+ payload = @version.create('POST', @uri, headers: headers, data: iam_v1_account_vendor_oauth_app_create_request.to_json)
193
+ OAuthAppInstance.new(
194
+ @version,
195
+ payload,
196
+ )
197
+ end
198
+
199
+
200
+
201
+
202
+ # Provide a user friendly representation
203
+ def to_s
204
+ '#<Twilio.Iam.V1.OAuthAppList>'
205
+ end
206
+ end
207
+
208
+
209
+ class OAuthAppContext < InstanceContext
210
+ ##
211
+ # Initialize the OAuthAppContext
212
+ # @param [Version] version Version that contains the resource
213
+ # @param [String] sid Unique ID (sid) of the OAuth app
214
+ # @return [OAuthAppContext] OAuthAppContext
215
+ def initialize(version, sid)
216
+ super(version)
217
+
218
+ # Path Solution
219
+ @solution = { sid: sid, }
220
+ @uri = "/Account/OAuthApps/#{@solution[:sid]}"
221
+
222
+
223
+ end
224
+ ##
225
+ # Delete the OAuthAppInstance
226
+ # @return [Boolean] True if delete succeeds, false otherwise
227
+ def delete
228
+
229
+ headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
230
+
231
+
232
+
233
+ @version.delete('DELETE', @uri, headers: headers)
234
+ end
235
+
236
+ ##
237
+ # Update the OAuthAppInstance
238
+ # @param [IamV1AccountVendorOauthAppUpdateRequest] iam_v1_account_vendor_oauth_app_update_request
239
+ # @return [OAuthAppInstance] Updated OAuthAppInstance
240
+ def update(iam_v1_account_vendor_oauth_app_update_request: nil
241
+ )
242
+
243
+ headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
244
+ headers['Content-Type'] = 'application/json'
245
+
246
+
247
+
248
+
249
+ payload = @version.update('PUT', @uri, headers: headers, data: iam_v1_account_vendor_oauth_app_update_request.to_json)
250
+ OAuthAppInstance.new(
251
+ @version,
252
+ payload,
253
+ sid: @solution[:sid],
254
+ )
255
+ end
256
+
257
+
258
+ ##
259
+ # Provide a user friendly representation
260
+ def to_s
261
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
262
+ "#<Twilio.Iam.V1.OAuthAppContext #{context}>"
263
+ end
264
+
265
+ ##
266
+ # Provide a detailed, user friendly representation
267
+ def inspect
268
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
269
+ "#<Twilio.Iam.V1.OAuthAppContext #{context}>"
270
+ end
271
+ end
272
+
273
+ class OAuthAppPage < Page
274
+ ##
275
+ # Initialize the OAuthAppPage
276
+ # @param [Version] version Version that contains the resource
277
+ # @param [Response] response Response from the API
278
+ # @param [Hash] solution Path solution for the resource
279
+ # @return [OAuthAppPage] OAuthAppPage
280
+ def initialize(version, response, solution)
281
+ super(version, response)
282
+
283
+ # Path Solution
284
+ @solution = solution
285
+ end
286
+
287
+ ##
288
+ # Build an instance of OAuthAppInstance
289
+ # @param [Hash] payload Payload response from the API
290
+ # @return [OAuthAppInstance] OAuthAppInstance
291
+ def get_instance(payload)
292
+ OAuthAppInstance.new(@version, payload)
293
+ end
294
+
295
+ ##
296
+ # Provide a user friendly representation
297
+ def to_s
298
+ '<Twilio.Iam.V1.OAuthAppPage>'
299
+ end
300
+ end
301
+ class OAuthAppInstance < InstanceResource
302
+ ##
303
+ # Initialize the OAuthAppInstance
304
+ # @param [Version] version Version that contains the resource
305
+ # @param [Hash] payload payload that contains response from Twilio
306
+ # @param [String] account_sid The SID of the
307
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this OAuthApp
308
+ # resource.
309
+ # @param [String] sid The SID of the Call resource to fetch.
310
+ # @return [OAuthAppInstance] OAuthAppInstance
311
+ def initialize(version, payload , sid: nil)
312
+ super(version)
313
+
314
+ # Marshaled Properties
315
+ @properties = {
316
+ 'type' => payload['type'],
317
+ 'sid' => payload['sid'],
318
+ 'friendly_name' => payload['friendly_name'],
319
+ 'description' => payload['description'],
320
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
321
+ 'created_by' => payload['created_by'],
322
+ 'secret' => payload['secret'],
323
+ 'status' => payload['status'],
324
+ 'policy' => payload['policy'],
325
+ 'access_token_ttl' => payload['access_token_ttl'] == nil ? payload['access_token_ttl'] : payload['access_token_ttl'].to_i,
326
+ 'code' => payload['code'],
327
+ 'message' => payload['message'],
328
+ 'more_info' => payload['more_info'],
329
+ }
330
+
331
+ # Context
332
+ @instance_context = nil
333
+ @params = { 'sid' => sid || @properties['sid'] , }
334
+ end
335
+
336
+ ##
337
+ # Generate an instance context for the instance, the context is capable of
338
+ # performing various actions. All instance actions are proxied to the context
339
+ # @return [OAuthAppContext] CallContext for this CallInstance
340
+ def context
341
+ unless @instance_context
342
+ @instance_context = OAuthAppContext.new(@version , @params['sid'])
343
+ end
344
+ @instance_context
345
+ end
346
+
347
+ ##
348
+ # @return [String]
349
+ def type
350
+ @properties['type']
351
+ end
352
+
353
+ ##
354
+ # @return [String]
355
+ def sid
356
+ @properties['sid']
357
+ end
358
+
359
+ ##
360
+ # @return [String]
361
+ def friendly_name
362
+ @properties['friendly_name']
363
+ end
364
+
365
+ ##
366
+ # @return [String]
367
+ def description
368
+ @properties['description']
369
+ end
370
+
371
+ ##
372
+ # @return [Time]
373
+ def date_created
374
+ @properties['date_created']
375
+ end
376
+
377
+ ##
378
+ # @return [String]
379
+ def created_by
380
+ @properties['created_by']
381
+ end
382
+
383
+ ##
384
+ # @return [String]
385
+ def secret
386
+ @properties['secret']
387
+ end
388
+
389
+ ##
390
+ # @return [String]
391
+ def status
392
+ @properties['status']
393
+ end
394
+
395
+ ##
396
+ # @return [IamV1OrganizationVendoroauthappPolicy]
397
+ def policy
398
+ @properties['policy']
399
+ end
400
+
401
+ ##
402
+ # @return [String]
403
+ def access_token_ttl
404
+ @properties['access_token_ttl']
405
+ end
406
+
407
+ ##
408
+ # @return [String] Twilio-specific error code
409
+ def code
410
+ @properties['code']
411
+ end
412
+
413
+ ##
414
+ # @return [String] Error message
415
+ def message
416
+ @properties['message']
417
+ end
418
+
419
+ ##
420
+ # @return [String] Link to Error Code References
421
+ def more_info
422
+ @properties['more_info']
423
+ end
424
+
425
+ ##
426
+ # Delete the OAuthAppInstance
427
+ # @return [Boolean] True if delete succeeds, false otherwise
428
+ def delete
429
+
430
+ context.delete
431
+ end
432
+
433
+ ##
434
+ # Update the OAuthAppInstance
435
+ # @param [IamV1AccountVendorOauthAppUpdateRequest] iam_v1_account_vendor_oauth_app_update_request
436
+ # @return [OAuthAppInstance] Updated OAuthAppInstance
437
+ def update(iam_v1_account_vendor_oauth_app_update_request: nil
438
+ )
439
+
440
+ context.update(
441
+ )
442
+ end
443
+
444
+ ##
445
+ # Provide a user friendly representation
446
+ def to_s
447
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
448
+ "<Twilio.Iam.V1.OAuthAppInstance #{values}>"
449
+ end
450
+
451
+ ##
452
+ # Provide a detailed, user friendly representation
453
+ def inspect
454
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
455
+ "<Twilio.Iam.V1.OAuthAppInstance #{values}>"
456
+ end
457
+ end
458
+
459
+ end
460
+ end
461
+ end
462
+ end
@@ -24,6 +24,7 @@ module Twilio
24
24
  @api_key = nil
25
25
  @get_api_keys = nil
26
26
  @new_api_key = nil
27
+ @o_auth_apps = nil
27
28
  @token = nil
28
29
  end
29
30
 
@@ -52,6 +53,20 @@ module Twilio
52
53
  @new_api_key ||= NewApiKeyList.new self
53
54
  end
54
55
  ##
56
+ # @param [String] sid Unique ID (sid) of the OAuth app
57
+ # @return [Twilio::REST::Iam::V1::OAuthAppContext] if sid was passed.
58
+ # @return [Twilio::REST::Iam::V1::OAuthAppList]
59
+ def o_auth_apps(sid=:unset)
60
+ if sid.nil?
61
+ raise ArgumentError, 'sid cannot be nil'
62
+ end
63
+ if sid == :unset
64
+ @o_auth_apps ||= OAuthAppList.new self
65
+ else
66
+ OAuthAppContext.new(self, sid)
67
+ end
68
+ end
69
+ ##
55
70
  # @return [Twilio::REST::Iam::V1::TokenList]
56
71
  def token
57
72
  @token ||= TokenList.new self