twilio-ruby 7.2.1 → 7.3.1

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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +74 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/api/v2010/account/call/transcription.rb +5 -599
  5. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +2 -2
  6. data/lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result/payload/data.rb +200 -0
  7. data/lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result/payload.rb +22 -1
  8. data/lib/twilio-ruby/rest/assistants/v1/assistant/feedback.rb +303 -0
  9. data/lib/twilio-ruby/rest/assistants/v1/assistant.rb +626 -0
  10. data/lib/twilio-ruby/rest/assistants/v1/knowledge/chunk.rb +229 -0
  11. data/lib/twilio-ruby/rest/assistants/v1/knowledge.rb +593 -0
  12. data/lib/twilio-ruby/rest/assistants/v1/policy.rb +264 -0
  13. data/lib/twilio-ruby/rest/assistants/v1/session/message.rb +264 -0
  14. data/lib/twilio-ruby/rest/assistants/v1/session.rb +328 -0
  15. data/lib/twilio-ruby/rest/assistants/v1/tool.rb +549 -0
  16. data/lib/twilio-ruby/rest/assistants/v1.rb +100 -0
  17. data/lib/twilio-ruby/rest/{preview_iam.rb → assistants.rb} +1 -1
  18. data/lib/twilio-ruby/rest/assistants_base.rb +38 -0
  19. data/lib/twilio-ruby/rest/client.rb +8 -3
  20. data/lib/twilio-ruby/rest/content/v1/content/approval_fetch.rb +11 -11
  21. data/lib/twilio-ruby/rest/content/v1/content.rb +167 -4
  22. data/lib/twilio-ruby/rest/flex_api/v2/flex_user.rb +81 -1
  23. data/lib/twilio-ruby/rest/iam/v1/api_key.rb +270 -0
  24. data/lib/twilio-ruby/rest/iam/v1/get_api_keys.rb +223 -0
  25. data/lib/twilio-ruby/rest/iam/v1/new_api_key.rb +177 -0
  26. data/lib/twilio-ruby/rest/iam/v1.rb +61 -0
  27. data/lib/twilio-ruby/rest/iam.rb +6 -0
  28. data/lib/twilio-ruby/rest/{preview_iam_base.rb → iam_base.rb} +10 -5
  29. data/lib/twilio-ruby/rest/insights/v1/call_summaries.rb +60 -12
  30. data/lib/twilio-ruby/rest/intelligence/v2/operator_type.rb +1 -1
  31. data/lib/twilio-ruby/rest/intelligence/v2/transcript/sentence.rb +16 -3
  32. data/lib/twilio-ruby/rest/intelligence/v2.rb +1 -1
  33. data/lib/twilio-ruby/rest/marketplace/v1/installed_add_on/installed_add_on_usage.rb +16 -29
  34. data/lib/twilio-ruby/rest/marketplace/v1/module_data_management.rb +46 -20
  35. data/lib/twilio-ruby/rest/marketplace/v1/referral_conversion.rb +199 -0
  36. data/lib/twilio-ruby/rest/marketplace/v1.rb +7 -1
  37. data/lib/twilio-ruby/rest/messaging/v1/external_campaign.rb +4 -1
  38. data/lib/twilio-ruby/rest/messaging/v1/service/channel_sender.rb +40 -0
  39. data/lib/twilio-ruby/rest/numbers/v1/porting_port_in.rb +10 -10
  40. data/lib/twilio-ruby/rest/numbers/v1/porting_port_in_phone_number.rb +24 -17
  41. data/lib/twilio-ruby/rest/numbers/v1/porting_portability.rb +7 -7
  42. data/lib/twilio-ruby/rest/numbers/v1/porting_webhook_configuration.rb +3 -3
  43. data/lib/twilio-ruby/rest/numbers/v1/porting_webhook_configuration_delete.rb +1 -1
  44. data/lib/twilio-ruby/rest/numbers/v1/porting_webhook_configuration_fetch.rb +3 -3
  45. data/lib/twilio-ruby/rest/numbers/v1/signing_request_configuration.rb +96 -0
  46. data/lib/twilio-ruby/rest/numbers/v1.rb +2 -2
  47. data/lib/twilio-ruby/rest/numbers/v2/bundle_clone.rb +277 -0
  48. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +8 -5
  49. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +7 -0
  50. data/lib/twilio-ruby/rest/numbers/v2.rb +15 -0
  51. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +2 -2
  52. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb +1 -1
  53. data/lib/twilio-ruby/rest/trusthub/v1/compliance_inquiries.rb +12 -3
  54. data/lib/twilio-ruby/rest/verify/v2/service.rb +4 -4
  55. data/lib/twilio-ruby/version.rb +1 -1
  56. data/twilio-ruby.gemspec +2 -1
  57. metadata +23 -4
@@ -0,0 +1,270 @@
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 ApiKeyList < ListResource
21
+
22
+ ##
23
+ # Initialize the ApiKeyList
24
+ # @param [Version] version Version that contains the resource
25
+ # @return [ApiKeyList] ApiKeyList
26
+ def initialize(version)
27
+ super(version)
28
+ # Path Solution
29
+ @solution = { }
30
+
31
+
32
+ end
33
+
34
+
35
+
36
+ # Provide a user friendly representation
37
+ def to_s
38
+ '#<Twilio.Iam.V1.ApiKeyList>'
39
+ end
40
+ end
41
+
42
+
43
+ class ApiKeyContext < InstanceContext
44
+ ##
45
+ # Initialize the ApiKeyContext
46
+ # @param [Version] version Version that contains the resource
47
+ # @param [String] sid The Twilio-provided string that uniquely identifies the Key resource to update.
48
+ # @return [ApiKeyContext] ApiKeyContext
49
+ def initialize(version, sid)
50
+ super(version)
51
+
52
+ # Path Solution
53
+ @solution = { sid: sid, }
54
+ @uri = "/Keys/#{@solution[:sid]}"
55
+
56
+
57
+ end
58
+ ##
59
+ # Delete the ApiKeyInstance
60
+ # @return [Boolean] True if delete succeeds, false otherwise
61
+ def delete
62
+
63
+ headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
64
+
65
+ @version.delete('DELETE', @uri, headers: headers)
66
+ end
67
+
68
+ ##
69
+ # Fetch the ApiKeyInstance
70
+ # @return [ApiKeyInstance] Fetched ApiKeyInstance
71
+ def fetch
72
+
73
+ headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
74
+
75
+ payload = @version.fetch('GET', @uri, headers: headers)
76
+ ApiKeyInstance.new(
77
+ @version,
78
+ payload,
79
+ sid: @solution[:sid],
80
+ )
81
+ end
82
+
83
+ ##
84
+ # Update the ApiKeyInstance
85
+ # @param [String] friendly_name A descriptive string that you create to describe the resource. It can be up to 64 characters long.
86
+ # @param [Object] policy The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys).
87
+ # @return [ApiKeyInstance] Updated ApiKeyInstance
88
+ def update(
89
+ friendly_name: :unset,
90
+ policy: :unset
91
+ )
92
+
93
+ data = Twilio::Values.of({
94
+ 'FriendlyName' => friendly_name,
95
+ 'Policy' => Twilio.serialize_object(policy),
96
+ })
97
+
98
+ headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
99
+
100
+ payload = @version.update('POST', @uri, data: data, headers: headers)
101
+ ApiKeyInstance.new(
102
+ @version,
103
+ payload,
104
+ sid: @solution[:sid],
105
+ )
106
+ end
107
+
108
+
109
+ ##
110
+ # Provide a user friendly representation
111
+ def to_s
112
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
113
+ "#<Twilio.Iam.V1.ApiKeyContext #{context}>"
114
+ end
115
+
116
+ ##
117
+ # Provide a detailed, user friendly representation
118
+ def inspect
119
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
120
+ "#<Twilio.Iam.V1.ApiKeyContext #{context}>"
121
+ end
122
+ end
123
+
124
+ class ApiKeyPage < Page
125
+ ##
126
+ # Initialize the ApiKeyPage
127
+ # @param [Version] version Version that contains the resource
128
+ # @param [Response] response Response from the API
129
+ # @param [Hash] solution Path solution for the resource
130
+ # @return [ApiKeyPage] ApiKeyPage
131
+ def initialize(version, response, solution)
132
+ super(version, response)
133
+
134
+ # Path Solution
135
+ @solution = solution
136
+ end
137
+
138
+ ##
139
+ # Build an instance of ApiKeyInstance
140
+ # @param [Hash] payload Payload response from the API
141
+ # @return [ApiKeyInstance] ApiKeyInstance
142
+ def get_instance(payload)
143
+ ApiKeyInstance.new(@version, payload)
144
+ end
145
+
146
+ ##
147
+ # Provide a user friendly representation
148
+ def to_s
149
+ '<Twilio.Iam.V1.ApiKeyPage>'
150
+ end
151
+ end
152
+ class ApiKeyInstance < InstanceResource
153
+ ##
154
+ # Initialize the ApiKeyInstance
155
+ # @param [Version] version Version that contains the resource
156
+ # @param [Hash] payload payload that contains response from Twilio
157
+ # @param [String] account_sid The SID of the
158
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this ApiKey
159
+ # resource.
160
+ # @param [String] sid The SID of the Call resource to fetch.
161
+ # @return [ApiKeyInstance] ApiKeyInstance
162
+ def initialize(version, payload , sid: nil)
163
+ super(version)
164
+
165
+ # Marshaled Properties
166
+ @properties = {
167
+ 'sid' => payload['sid'],
168
+ 'friendly_name' => payload['friendly_name'],
169
+ 'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
170
+ 'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
171
+ 'policy' => payload['policy'],
172
+ }
173
+
174
+ # Context
175
+ @instance_context = nil
176
+ @params = { 'sid' => sid || @properties['sid'] , }
177
+ end
178
+
179
+ ##
180
+ # Generate an instance context for the instance, the context is capable of
181
+ # performing various actions. All instance actions are proxied to the context
182
+ # @return [ApiKeyContext] CallContext for this CallInstance
183
+ def context
184
+ unless @instance_context
185
+ @instance_context = ApiKeyContext.new(@version , @params['sid'])
186
+ end
187
+ @instance_context
188
+ end
189
+
190
+ ##
191
+ # @return [String] The unique string that we created to identify the Key resource.
192
+ def sid
193
+ @properties['sid']
194
+ end
195
+
196
+ ##
197
+ # @return [String] The string that you assigned to describe the resource.
198
+ def friendly_name
199
+ @properties['friendly_name']
200
+ end
201
+
202
+ ##
203
+ # @return [Time] The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
204
+ def date_created
205
+ @properties['date_created']
206
+ end
207
+
208
+ ##
209
+ # @return [Time] The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
210
+ def date_updated
211
+ @properties['date_updated']
212
+ end
213
+
214
+ ##
215
+ # @return [Hash] The \\`Policy\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys).
216
+ def policy
217
+ @properties['policy']
218
+ end
219
+
220
+ ##
221
+ # Delete the ApiKeyInstance
222
+ # @return [Boolean] True if delete succeeds, false otherwise
223
+ def delete
224
+
225
+ context.delete
226
+ end
227
+
228
+ ##
229
+ # Fetch the ApiKeyInstance
230
+ # @return [ApiKeyInstance] Fetched ApiKeyInstance
231
+ def fetch
232
+
233
+ context.fetch
234
+ end
235
+
236
+ ##
237
+ # Update the ApiKeyInstance
238
+ # @param [String] friendly_name A descriptive string that you create to describe the resource. It can be up to 64 characters long.
239
+ # @param [Object] policy The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys).
240
+ # @return [ApiKeyInstance] Updated ApiKeyInstance
241
+ def update(
242
+ friendly_name: :unset,
243
+ policy: :unset
244
+ )
245
+
246
+ context.update(
247
+ friendly_name: friendly_name,
248
+ policy: policy,
249
+ )
250
+ end
251
+
252
+ ##
253
+ # Provide a user friendly representation
254
+ def to_s
255
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
256
+ "<Twilio.Iam.V1.ApiKeyInstance #{values}>"
257
+ end
258
+
259
+ ##
260
+ # Provide a detailed, user friendly representation
261
+ def inspect
262
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
263
+ "<Twilio.Iam.V1.ApiKeyInstance #{values}>"
264
+ end
265
+ end
266
+
267
+ end
268
+ end
269
+ end
270
+ end
@@ -0,0 +1,223 @@
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 GetApiKeysList < ListResource
21
+
22
+ ##
23
+ # Initialize the GetApiKeysList
24
+ # @param [Version] version Version that contains the resource
25
+ # @return [GetApiKeysList] GetApiKeysList
26
+ def initialize(version)
27
+ super(version)
28
+ # Path Solution
29
+ @solution = { }
30
+ @uri = "/Keys"
31
+
32
+ end
33
+
34
+ ##
35
+ # Lists GetApiKeysInstance records from the API as a list.
36
+ # Unlike stream(), this operation is eager and will load `limit` records into
37
+ # memory before returning.
38
+ # @param [String] account_sid The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource.
39
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
40
+ # guarantees to never return more than limit. Default is no limit
41
+ # @param [Integer] page_size Number of records to fetch per request, when
42
+ # not set will use the default value of 50 records. If no page_size is defined
43
+ # but a limit is defined, stream() will attempt to read the limit with the most
44
+ # efficient page size, i.e. min(limit, 1000)
45
+ # @return [Array] Array of up to limit results
46
+ def list(account_sid: nil, limit: nil, page_size: nil)
47
+ self.stream(
48
+ account_sid: account_sid,
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 [String] account_sid The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource.
59
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
60
+ # guarantees to never return more than limit. Default is no limit
61
+ # @param [Integer] page_size Number of records to fetch per request, when
62
+ # not set will use the default value of 50 records. If no page_size is defined
63
+ # but a limit is defined, stream() will attempt to read the limit with the most
64
+ # efficient page size, i.e. min(limit, 1000)
65
+ # @return [Enumerable] Enumerable that will yield up to limit results
66
+ def stream(account_sid: nil, limit: nil, page_size: nil)
67
+ limits = @version.read_limits(limit, page_size)
68
+
69
+ page = self.page(
70
+ account_sid: account_sid,
71
+ page_size: limits[:page_size], )
72
+
73
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
74
+ end
75
+
76
+ ##
77
+ # When passed a block, yields GetApiKeysInstance records from the API.
78
+ # This operation lazily loads records as efficiently as possible until the limit
79
+ # is reached.
80
+ def each
81
+ limits = @version.read_limits
82
+
83
+ page = self.page(page_size: limits[:page_size], )
84
+
85
+ @version.stream(page,
86
+ limit: limits[:limit],
87
+ page_limit: limits[:page_limit]).each {|x| yield x}
88
+ end
89
+
90
+ ##
91
+ # Retrieve a single page of GetApiKeysInstance records from the API.
92
+ # Request is executed immediately.
93
+ # @param [String] account_sid The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource.
94
+ # @param [String] page_token PageToken provided by the API
95
+ # @param [Integer] page_number Page Number, this value is simply for client state
96
+ # @param [Integer] page_size Number of records to return, defaults to 50
97
+ # @return [Page] Page of GetApiKeysInstance
98
+ def page(account_sid: nil, page_token: :unset, page_number: :unset, page_size: :unset)
99
+ params = Twilio::Values.of({
100
+ 'AccountSid' => account_sid,
101
+ 'PageToken' => page_token,
102
+ 'Page' => page_number,
103
+ 'PageSize' => page_size,
104
+ })
105
+
106
+ response = @version.page('GET', @uri, params: params)
107
+
108
+ GetApiKeysPage.new(@version, response, @solution)
109
+ end
110
+
111
+ ##
112
+ # Retrieve a single page of GetApiKeysInstance records from the API.
113
+ # Request is executed immediately.
114
+ # @param [String] target_url API-generated URL for the requested results page
115
+ # @return [Page] Page of GetApiKeysInstance
116
+ def get_page(target_url)
117
+ response = @version.domain.request(
118
+ 'GET',
119
+ target_url
120
+ )
121
+ GetApiKeysPage.new(@version, response, @solution)
122
+ end
123
+
124
+
125
+
126
+ # Provide a user friendly representation
127
+ def to_s
128
+ '#<Twilio.Iam.V1.GetApiKeysList>'
129
+ end
130
+ end
131
+
132
+ class GetApiKeysPage < Page
133
+ ##
134
+ # Initialize the GetApiKeysPage
135
+ # @param [Version] version Version that contains the resource
136
+ # @param [Response] response Response from the API
137
+ # @param [Hash] solution Path solution for the resource
138
+ # @return [GetApiKeysPage] GetApiKeysPage
139
+ def initialize(version, response, solution)
140
+ super(version, response)
141
+
142
+ # Path Solution
143
+ @solution = solution
144
+ end
145
+
146
+ ##
147
+ # Build an instance of GetApiKeysInstance
148
+ # @param [Hash] payload Payload response from the API
149
+ # @return [GetApiKeysInstance] GetApiKeysInstance
150
+ def get_instance(payload)
151
+ GetApiKeysInstance.new(@version, payload)
152
+ end
153
+
154
+ ##
155
+ # Provide a user friendly representation
156
+ def to_s
157
+ '<Twilio.Iam.V1.GetApiKeysPage>'
158
+ end
159
+ end
160
+ class GetApiKeysInstance < InstanceResource
161
+ ##
162
+ # Initialize the GetApiKeysInstance
163
+ # @param [Version] version Version that contains the resource
164
+ # @param [Hash] payload payload that contains response from Twilio
165
+ # @param [String] account_sid The SID of the
166
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this GetApiKeys
167
+ # resource.
168
+ # @param [String] sid The SID of the Call resource to fetch.
169
+ # @return [GetApiKeysInstance] GetApiKeysInstance
170
+ def initialize(version, payload )
171
+ super(version)
172
+
173
+ # Marshaled Properties
174
+ @properties = {
175
+ 'sid' => payload['sid'],
176
+ 'friendly_name' => payload['friendly_name'],
177
+ 'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
178
+ 'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
179
+ }
180
+ end
181
+
182
+
183
+ ##
184
+ # @return [String] The unique string that we created to identify the Key resource.
185
+ def sid
186
+ @properties['sid']
187
+ end
188
+
189
+ ##
190
+ # @return [String] The string that you assigned to describe the resource.
191
+ def friendly_name
192
+ @properties['friendly_name']
193
+ end
194
+
195
+ ##
196
+ # @return [Time] The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
197
+ def date_created
198
+ @properties['date_created']
199
+ end
200
+
201
+ ##
202
+ # @return [Time] The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
203
+ def date_updated
204
+ @properties['date_updated']
205
+ end
206
+
207
+ ##
208
+ # Provide a user friendly representation
209
+ def to_s
210
+ "<Twilio.Iam.V1.GetApiKeysInstance>"
211
+ end
212
+
213
+ ##
214
+ # Provide a detailed, user friendly representation
215
+ def inspect
216
+ "<Twilio.Iam.V1.GetApiKeysInstance>"
217
+ end
218
+ end
219
+
220
+ end
221
+ end
222
+ end
223
+ end
@@ -0,0 +1,177 @@
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 NewApiKeyList < ListResource
21
+
22
+ ##
23
+ # Initialize the NewApiKeyList
24
+ # @param [Version] version Version that contains the resource
25
+ # @return [NewApiKeyList] NewApiKeyList
26
+ def initialize(version)
27
+ super(version)
28
+ # Path Solution
29
+ @solution = { }
30
+ @uri = "/Keys"
31
+
32
+ end
33
+ ##
34
+ # Create the NewApiKeyInstance
35
+ # @param [String] account_sid The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource.
36
+ # @param [String] friendly_name A descriptive string that you create to describe the resource. It can be up to 64 characters long.
37
+ # @param [Keytype] key_type
38
+ # @param [Object] policy The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys).
39
+ # @return [NewApiKeyInstance] Created NewApiKeyInstance
40
+ def create(
41
+ account_sid: nil,
42
+ friendly_name: :unset,
43
+ key_type: :unset,
44
+ policy: :unset
45
+ )
46
+
47
+ data = Twilio::Values.of({
48
+ 'AccountSid' => account_sid,
49
+ 'FriendlyName' => friendly_name,
50
+ 'KeyType' => key_type,
51
+ 'Policy' => Twilio.serialize_object(policy),
52
+ })
53
+
54
+ headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
55
+
56
+ payload = @version.create('POST', @uri, data: data, headers: headers)
57
+ NewApiKeyInstance.new(
58
+ @version,
59
+ payload,
60
+ )
61
+ end
62
+
63
+
64
+
65
+
66
+ # Provide a user friendly representation
67
+ def to_s
68
+ '#<Twilio.Iam.V1.NewApiKeyList>'
69
+ end
70
+ end
71
+
72
+ class NewApiKeyPage < Page
73
+ ##
74
+ # Initialize the NewApiKeyPage
75
+ # @param [Version] version Version that contains the resource
76
+ # @param [Response] response Response from the API
77
+ # @param [Hash] solution Path solution for the resource
78
+ # @return [NewApiKeyPage] NewApiKeyPage
79
+ def initialize(version, response, solution)
80
+ super(version, response)
81
+
82
+ # Path Solution
83
+ @solution = solution
84
+ end
85
+
86
+ ##
87
+ # Build an instance of NewApiKeyInstance
88
+ # @param [Hash] payload Payload response from the API
89
+ # @return [NewApiKeyInstance] NewApiKeyInstance
90
+ def get_instance(payload)
91
+ NewApiKeyInstance.new(@version, payload)
92
+ end
93
+
94
+ ##
95
+ # Provide a user friendly representation
96
+ def to_s
97
+ '<Twilio.Iam.V1.NewApiKeyPage>'
98
+ end
99
+ end
100
+ class NewApiKeyInstance < InstanceResource
101
+ ##
102
+ # Initialize the NewApiKeyInstance
103
+ # @param [Version] version Version that contains the resource
104
+ # @param [Hash] payload payload that contains response from Twilio
105
+ # @param [String] account_sid The SID of the
106
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this NewApiKey
107
+ # resource.
108
+ # @param [String] sid The SID of the Call resource to fetch.
109
+ # @return [NewApiKeyInstance] NewApiKeyInstance
110
+ def initialize(version, payload )
111
+ super(version)
112
+
113
+ # Marshaled Properties
114
+ @properties = {
115
+ 'sid' => payload['sid'],
116
+ 'friendly_name' => payload['friendly_name'],
117
+ 'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
118
+ 'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
119
+ 'secret' => payload['secret'],
120
+ 'policy' => payload['policy'],
121
+ }
122
+ end
123
+
124
+
125
+ ##
126
+ # @return [String] The unique string that that we created to identify the NewKey resource. You will use this as the basic-auth `user` when authenticating to the API.
127
+ def sid
128
+ @properties['sid']
129
+ end
130
+
131
+ ##
132
+ # @return [String] The string that you assigned to describe the resource.
133
+ def friendly_name
134
+ @properties['friendly_name']
135
+ end
136
+
137
+ ##
138
+ # @return [Time] The date and time in GMT that the API Key was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
139
+ def date_created
140
+ @properties['date_created']
141
+ end
142
+
143
+ ##
144
+ # @return [Time] The date and time in GMT that the new API Key was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
145
+ def date_updated
146
+ @properties['date_updated']
147
+ end
148
+
149
+ ##
150
+ # @return [String] The secret your application uses to sign Access Tokens and to authenticate to the REST API (you will use this as the basic-auth `password`). **Note that for security reasons, this field is ONLY returned when the API Key is first created.**
151
+ def secret
152
+ @properties['secret']
153
+ end
154
+
155
+ ##
156
+ # @return [Hash] Collection of allow assertions.
157
+ def policy
158
+ @properties['policy']
159
+ end
160
+
161
+ ##
162
+ # Provide a user friendly representation
163
+ def to_s
164
+ "<Twilio.Iam.V1.NewApiKeyInstance>"
165
+ end
166
+
167
+ ##
168
+ # Provide a detailed, user friendly representation
169
+ def inspect
170
+ "<Twilio.Iam.V1.NewApiKeyInstance>"
171
+ end
172
+ end
173
+
174
+ end
175
+ end
176
+ end
177
+ end