svix 1.56.0 → 1.57.0

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 (98) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/svix/api/application_api.rb +115 -10
  4. data/lib/svix/api/authentication_api.rb +101 -16
  5. data/lib/svix/api/background_tasks_api.rb +43 -17
  6. data/lib/svix/api/endpoint_api.rb +312 -96
  7. data/lib/svix/api/inbound_api.rb +4 -4
  8. data/lib/svix/api/integration_api.rb +102 -24
  9. data/lib/svix/api/message_api.rb +142 -39
  10. data/lib/svix/api/message_attempt_api.rb +135 -372
  11. data/lib/svix/api/statistics_api.rb +6 -6
  12. data/lib/svix/api/stream_api.rb +203 -142
  13. data/lib/svix/api/transformation_template_api.rb +88 -23
  14. data/lib/svix/api/webhook_endpoint_api.rb +253 -77
  15. data/lib/svix/background_tasks_api.rb +2 -2
  16. data/lib/svix/message_attempt_api.rb +7 -3
  17. data/lib/svix/models/active_application_out.rb +373 -0
  18. data/lib/svix/models/active_endpoint_out.rb +355 -0
  19. data/lib/svix/models/aggregate_event_types_out.rb +40 -0
  20. data/lib/svix/models/aggregated_event_types.rb +305 -0
  21. data/lib/svix/models/app_portal_access_in.rb +18 -0
  22. data/lib/svix/models/app_usage_stats_out.rb +40 -0
  23. data/lib/svix/models/application_message_failure.rb +277 -0
  24. data/lib/svix/models/application_message_id_pair.rb +317 -0
  25. data/lib/svix/models/application_out.rb +41 -2
  26. data/lib/svix/models/application_patch.rb +1 -1
  27. data/lib/svix/models/application_stats.rb +41 -2
  28. data/lib/svix/models/application_stats_out.rb +324 -0
  29. data/lib/svix/models/auth_token_out.rb +40 -1
  30. data/lib/svix/models/background_task_finished_event.rb +272 -0
  31. data/lib/svix/models/background_task_finished_event2.rb +331 -0
  32. data/lib/svix/models/background_task_out.rb +40 -0
  33. data/lib/svix/models/background_task_type.rb +2 -1
  34. data/lib/svix/models/{template_in.rb → connector_in.rb} +4 -4
  35. data/lib/svix/models/{transformation_template_kind.rb → connector_kind.rb} +3 -3
  36. data/lib/svix/models/create_stream_in.rb +12 -12
  37. data/lib/svix/models/data.rb +108 -0
  38. data/lib/svix/models/data_any_of.rb +240 -0
  39. data/lib/svix/models/data_any_of1.rb +223 -0
  40. data/lib/svix/models/data_any_of2.rb +241 -0
  41. data/lib/svix/models/data_any_of3.rb +223 -0
  42. data/lib/svix/models/data_any_of4.rb +240 -0
  43. data/lib/svix/models/endpoint_created_event_data.rb +82 -4
  44. data/lib/svix/models/endpoint_deleted_event_data.rb +82 -4
  45. data/lib/svix/models/endpoint_disabled_event.rb +1 -1
  46. data/lib/svix/models/endpoint_disabled_event_data.rb +119 -16
  47. data/lib/svix/models/endpoint_disabled_trigger.rb +40 -0
  48. data/lib/svix/models/endpoint_enabled_event.rb +272 -0
  49. data/lib/svix/models/endpoint_enabled_event_data.rb +410 -0
  50. data/lib/svix/models/endpoint_message_out.rb +40 -1
  51. data/lib/svix/models/endpoint_mtls_config_out.rb +215 -0
  52. data/lib/svix/models/endpoint_oauth_config_in.rb +2 -2
  53. data/lib/svix/models/endpoint_oauth_config_out.rb +315 -0
  54. data/lib/svix/models/endpoint_out.rb +40 -1
  55. data/lib/svix/models/endpoint_patch.rb +1 -1
  56. data/lib/svix/models/endpoint_updated_event_data.rb +82 -4
  57. data/lib/svix/models/environment_in.rb +17 -19
  58. data/lib/svix/models/environment_settings_out.rb +23 -1
  59. data/lib/svix/models/event_type_import_open_api_in.rb +14 -2
  60. data/lib/svix/models/export_event_type_out.rb +40 -0
  61. data/lib/svix/models/expung_all_contents_out.rb +315 -0
  62. data/lib/svix/models/inbound_path_params.rb +1 -1
  63. data/lib/svix/models/integration_in.rb +41 -1
  64. data/lib/svix/models/integration_out.rb +81 -2
  65. data/lib/svix/models/integration_update.rb +41 -1
  66. data/lib/svix/models/list_response_active_application_out.rb +261 -0
  67. data/lib/svix/models/message_attempt_endpoint_out.rb +120 -3
  68. data/lib/svix/models/message_attempt_exhausted_event_data.rb +122 -5
  69. data/lib/svix/models/message_attempt_failed_data.rb +40 -1
  70. data/lib/svix/models/message_attempt_failing_event_data.rb +122 -5
  71. data/lib/svix/models/message_attempt_out.rb +120 -3
  72. data/lib/svix/models/message_attempt_recovered_event_data.rb +122 -5
  73. data/lib/svix/models/message_broadcast_out.rb +40 -0
  74. data/lib/svix/models/message_endpoint_out.rb +40 -1
  75. data/lib/svix/models/message_out.rb +40 -1
  76. data/lib/svix/models/message_precheck_in.rb +288 -0
  77. data/lib/svix/models/message_precheck_out.rb +221 -0
  78. data/lib/svix/models/{oauth2_auth_method_in.rb → oauth2_auth_method_in_out.rb} +3 -3
  79. data/lib/svix/models/{oauth2_grant_type_in.rb → oauth2_grant_type_in_out.rb} +3 -3
  80. data/lib/svix/models/operational_webhook_endpoint_headers_in.rb +223 -0
  81. data/lib/svix/models/operational_webhook_endpoint_headers_out.rb +251 -0
  82. data/lib/svix/models/operational_webhook_endpoint_out.rb +40 -1
  83. data/lib/svix/models/polling_endpoint_message_out.rb +454 -0
  84. data/lib/svix/models/polling_endpoint_out.rb +255 -0
  85. data/lib/svix/models/recover_out.rb +40 -0
  86. data/lib/svix/models/replay_out.rb +40 -0
  87. data/lib/svix/models/rotate_poller_token_in.rb +1 -1
  88. data/lib/svix/models/sink_secret_out.rb +233 -0
  89. data/lib/svix/models/stream_in.rb +6 -7
  90. data/lib/svix/models/stream_out.rb +46 -7
  91. data/lib/svix/models/stream_patch.rb +6 -7
  92. data/lib/svix/models/stream_portal_access_in.rb +293 -0
  93. data/lib/svix/models/template_out.rb +81 -1
  94. data/lib/svix/models/template_patch.rb +1 -1
  95. data/lib/svix/models/template_update.rb +1 -1
  96. data/lib/svix/version.rb +1 -1
  97. metadata +35 -7
  98. data/lib/svix/operational_webhook_endpoint_api.rb +0 -37
@@ -16,16 +16,16 @@ require 'time'
16
16
  module Svix
17
17
  # Sent when an endpoint is created, updated, or deleted
18
18
  class EndpointDeletedEventData
19
- # The app's ID
19
+ # The Application's ID.
20
20
  attr_accessor :app_id
21
21
 
22
- # The app's UID
22
+ # The Application's UID.
23
23
  attr_accessor :app_uid
24
24
 
25
- # The ep's ID
25
+ # The Endpoint's ID.
26
26
  attr_accessor :endpoint_id
27
27
 
28
- # The ep's UID
28
+ # The Endpoint's UID.
29
29
  attr_accessor :endpoint_uid
30
30
 
31
31
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -106,6 +106,19 @@ module Svix
106
106
  invalid_properties.push('invalid value for "app_id", app_id cannot be nil.')
107
107
  end
108
108
 
109
+ if @app_id.to_s.length > 31
110
+ invalid_properties.push('invalid value for "app_id", the character length must be smaller than or equal to 31.')
111
+ end
112
+
113
+ if @app_id.to_s.length < 31
114
+ invalid_properties.push('invalid value for "app_id", the character length must be great than or equal to 31.')
115
+ end
116
+
117
+ pattern = Regexp.new(/^app_[A-Za-z0-9]{27}$/)
118
+ if @app_id !~ pattern
119
+ invalid_properties.push("invalid value for \"app_id\", must conform to the pattern #{pattern}.")
120
+ end
121
+
109
122
  if !@app_uid.nil? && @app_uid.to_s.length > 256
110
123
  invalid_properties.push('invalid value for "app_uid", the character length must be smaller than or equal to 256.')
111
124
  end
@@ -123,6 +136,19 @@ module Svix
123
136
  invalid_properties.push('invalid value for "endpoint_id", endpoint_id cannot be nil.')
124
137
  end
125
138
 
139
+ if @endpoint_id.to_s.length > 30
140
+ invalid_properties.push('invalid value for "endpoint_id", the character length must be smaller than or equal to 30.')
141
+ end
142
+
143
+ if @endpoint_id.to_s.length < 30
144
+ invalid_properties.push('invalid value for "endpoint_id", the character length must be great than or equal to 30.')
145
+ end
146
+
147
+ pattern = Regexp.new(/^ep_[A-Za-z0-9]{27}$/)
148
+ if @endpoint_id !~ pattern
149
+ invalid_properties.push("invalid value for \"endpoint_id\", must conform to the pattern #{pattern}.")
150
+ end
151
+
126
152
  if !@endpoint_uid.nil? && @endpoint_uid.to_s.length > 256
127
153
  invalid_properties.push('invalid value for "endpoint_uid", the character length must be smaller than or equal to 256.')
128
154
  end
@@ -144,16 +170,45 @@ module Svix
144
170
  def valid?
145
171
  warn '[DEPRECATED] the `valid?` method is obsolete'
146
172
  return false if @app_id.nil?
173
+ return false if @app_id.to_s.length > 31
174
+ return false if @app_id.to_s.length < 31
175
+ return false if @app_id !~ Regexp.new(/^app_[A-Za-z0-9]{27}$/)
147
176
  return false if !@app_uid.nil? && @app_uid.to_s.length > 256
148
177
  return false if !@app_uid.nil? && @app_uid.to_s.length < 1
149
178
  return false if !@app_uid.nil? && @app_uid !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
150
179
  return false if @endpoint_id.nil?
180
+ return false if @endpoint_id.to_s.length > 30
181
+ return false if @endpoint_id.to_s.length < 30
182
+ return false if @endpoint_id !~ Regexp.new(/^ep_[A-Za-z0-9]{27}$/)
151
183
  return false if !@endpoint_uid.nil? && @endpoint_uid.to_s.length > 256
152
184
  return false if !@endpoint_uid.nil? && @endpoint_uid.to_s.length < 1
153
185
  return false if !@endpoint_uid.nil? && @endpoint_uid !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
154
186
  true
155
187
  end
156
188
 
189
+ # Custom attribute writer method with validation
190
+ # @param [Object] app_id Value to be assigned
191
+ def app_id=(app_id)
192
+ if app_id.nil?
193
+ fail ArgumentError, 'app_id cannot be nil'
194
+ end
195
+
196
+ if app_id.to_s.length > 31
197
+ fail ArgumentError, 'invalid value for "app_id", the character length must be smaller than or equal to 31.'
198
+ end
199
+
200
+ if app_id.to_s.length < 31
201
+ fail ArgumentError, 'invalid value for "app_id", the character length must be great than or equal to 31.'
202
+ end
203
+
204
+ pattern = Regexp.new(/^app_[A-Za-z0-9]{27}$/)
205
+ if app_id !~ pattern
206
+ fail ArgumentError, "invalid value for \"app_id\", must conform to the pattern #{pattern}."
207
+ end
208
+
209
+ @app_id = app_id
210
+ end
211
+
157
212
  # Custom attribute writer method with validation
158
213
  # @param [Object] app_uid Value to be assigned
159
214
  def app_uid=(app_uid)
@@ -173,6 +228,29 @@ module Svix
173
228
  @app_uid = app_uid
174
229
  end
175
230
 
231
+ # Custom attribute writer method with validation
232
+ # @param [Object] endpoint_id Value to be assigned
233
+ def endpoint_id=(endpoint_id)
234
+ if endpoint_id.nil?
235
+ fail ArgumentError, 'endpoint_id cannot be nil'
236
+ end
237
+
238
+ if endpoint_id.to_s.length > 30
239
+ fail ArgumentError, 'invalid value for "endpoint_id", the character length must be smaller than or equal to 30.'
240
+ end
241
+
242
+ if endpoint_id.to_s.length < 30
243
+ fail ArgumentError, 'invalid value for "endpoint_id", the character length must be great than or equal to 30.'
244
+ end
245
+
246
+ pattern = Regexp.new(/^ep_[A-Za-z0-9]{27}$/)
247
+ if endpoint_id !~ pattern
248
+ fail ArgumentError, "invalid value for \"endpoint_id\", must conform to the pattern #{pattern}."
249
+ end
250
+
251
+ @endpoint_id = endpoint_id
252
+ end
253
+
176
254
  # Custom attribute writer method with validation
177
255
  # @param [Object] endpoint_uid Value to be assigned
178
256
  def endpoint_uid=(endpoint_uid)
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Svix
17
- # Sent when an endpoint has been automatically disabled after continuous failures.
17
+ # Sent when an endpoint has been automatically disabled after continuous failures, or manually via an API call.
18
18
  class EndpointDisabledEvent
19
19
  attr_accessor :data
20
20
 
@@ -14,22 +14,46 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Svix
17
- # Sent when an endpoint has been automatically disabled after continuous failures.
17
+ # Sent when an endpoint has been automatically disabled after continuous failures, or manually via an API call.
18
18
  class EndpointDisabledEventData
19
- # The app's ID
19
+ # The Application's ID.
20
20
  attr_accessor :app_id
21
21
 
22
- # The app's UID
22
+ # The Application's UID.
23
23
  attr_accessor :app_uid
24
24
 
25
- # The ep's ID
25
+ # The Endpoint's ID.
26
26
  attr_accessor :endpoint_id
27
27
 
28
- # The ep's UID
28
+ # The Endpoint's UID.
29
29
  attr_accessor :endpoint_uid
30
30
 
31
31
  attr_accessor :fail_since
32
32
 
33
+ attr_accessor :trigger
34
+
35
+ class EnumAttributeValidator
36
+ attr_reader :datatype
37
+ attr_reader :allowable_values
38
+
39
+ def initialize(datatype, allowable_values)
40
+ @allowable_values = allowable_values.map do |value|
41
+ case datatype.to_s
42
+ when /Integer/i
43
+ value.to_i
44
+ when /Float/i
45
+ value.to_f
46
+ else
47
+ value
48
+ end
49
+ end
50
+ end
51
+
52
+ def valid?(value)
53
+ !value || allowable_values.include?(value)
54
+ end
55
+ end
56
+
33
57
  # Attribute mapping from ruby-style variable name to JSON key.
34
58
  def self.attribute_map
35
59
  {
@@ -37,7 +61,8 @@ module Svix
37
61
  :'app_uid' => :'appUid',
38
62
  :'endpoint_id' => :'endpointId',
39
63
  :'endpoint_uid' => :'endpointUid',
40
- :'fail_since' => :'failSince'
64
+ :'fail_since' => :'failSince',
65
+ :'trigger' => :'trigger'
41
66
  }
42
67
  end
43
68
 
@@ -53,7 +78,8 @@ module Svix
53
78
  :'app_uid' => :'String',
54
79
  :'endpoint_id' => :'String',
55
80
  :'endpoint_uid' => :'String',
56
- :'fail_since' => :'Time'
81
+ :'fail_since' => :'Time',
82
+ :'trigger' => :'EndpointDisabledTrigger'
57
83
  }
58
84
  end
59
85
 
@@ -62,6 +88,7 @@ module Svix
62
88
  Set.new([
63
89
  :'app_uid',
64
90
  :'endpoint_uid',
91
+ :'fail_since',
65
92
  ])
66
93
  end
67
94
 
@@ -102,8 +129,10 @@ module Svix
102
129
 
103
130
  if attributes.key?(:'fail_since')
104
131
  self.fail_since = attributes[:'fail_since']
105
- else
106
- self.fail_since = nil
132
+ end
133
+
134
+ if attributes.key?(:'trigger')
135
+ self.trigger = attributes[:'trigger']
107
136
  end
108
137
  end
109
138
 
@@ -116,6 +145,19 @@ module Svix
116
145
  invalid_properties.push('invalid value for "app_id", app_id cannot be nil.')
117
146
  end
118
147
 
148
+ if @app_id.to_s.length > 31
149
+ invalid_properties.push('invalid value for "app_id", the character length must be smaller than or equal to 31.')
150
+ end
151
+
152
+ if @app_id.to_s.length < 31
153
+ invalid_properties.push('invalid value for "app_id", the character length must be great than or equal to 31.')
154
+ end
155
+
156
+ pattern = Regexp.new(/^app_[A-Za-z0-9]{27}$/)
157
+ if @app_id !~ pattern
158
+ invalid_properties.push("invalid value for \"app_id\", must conform to the pattern #{pattern}.")
159
+ end
160
+
119
161
  if !@app_uid.nil? && @app_uid.to_s.length > 256
120
162
  invalid_properties.push('invalid value for "app_uid", the character length must be smaller than or equal to 256.')
121
163
  end
@@ -133,6 +175,19 @@ module Svix
133
175
  invalid_properties.push('invalid value for "endpoint_id", endpoint_id cannot be nil.')
134
176
  end
135
177
 
178
+ if @endpoint_id.to_s.length > 30
179
+ invalid_properties.push('invalid value for "endpoint_id", the character length must be smaller than or equal to 30.')
180
+ end
181
+
182
+ if @endpoint_id.to_s.length < 30
183
+ invalid_properties.push('invalid value for "endpoint_id", the character length must be great than or equal to 30.')
184
+ end
185
+
186
+ pattern = Regexp.new(/^ep_[A-Za-z0-9]{27}$/)
187
+ if @endpoint_id !~ pattern
188
+ invalid_properties.push("invalid value for \"endpoint_id\", must conform to the pattern #{pattern}.")
189
+ end
190
+
136
191
  if !@endpoint_uid.nil? && @endpoint_uid.to_s.length > 256
137
192
  invalid_properties.push('invalid value for "endpoint_uid", the character length must be smaller than or equal to 256.')
138
193
  end
@@ -146,10 +201,6 @@ module Svix
146
201
  invalid_properties.push("invalid value for \"endpoint_uid\", must conform to the pattern #{pattern}.")
147
202
  end
148
203
 
149
- if @fail_since.nil?
150
- invalid_properties.push('invalid value for "fail_since", fail_since cannot be nil.')
151
- end
152
-
153
204
  invalid_properties
154
205
  end
155
206
 
@@ -158,17 +209,45 @@ module Svix
158
209
  def valid?
159
210
  warn '[DEPRECATED] the `valid?` method is obsolete'
160
211
  return false if @app_id.nil?
212
+ return false if @app_id.to_s.length > 31
213
+ return false if @app_id.to_s.length < 31
214
+ return false if @app_id !~ Regexp.new(/^app_[A-Za-z0-9]{27}$/)
161
215
  return false if !@app_uid.nil? && @app_uid.to_s.length > 256
162
216
  return false if !@app_uid.nil? && @app_uid.to_s.length < 1
163
217
  return false if !@app_uid.nil? && @app_uid !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
164
218
  return false if @endpoint_id.nil?
219
+ return false if @endpoint_id.to_s.length > 30
220
+ return false if @endpoint_id.to_s.length < 30
221
+ return false if @endpoint_id !~ Regexp.new(/^ep_[A-Za-z0-9]{27}$/)
165
222
  return false if !@endpoint_uid.nil? && @endpoint_uid.to_s.length > 256
166
223
  return false if !@endpoint_uid.nil? && @endpoint_uid.to_s.length < 1
167
224
  return false if !@endpoint_uid.nil? && @endpoint_uid !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
168
- return false if @fail_since.nil?
169
225
  true
170
226
  end
171
227
 
228
+ # Custom attribute writer method with validation
229
+ # @param [Object] app_id Value to be assigned
230
+ def app_id=(app_id)
231
+ if app_id.nil?
232
+ fail ArgumentError, 'app_id cannot be nil'
233
+ end
234
+
235
+ if app_id.to_s.length > 31
236
+ fail ArgumentError, 'invalid value for "app_id", the character length must be smaller than or equal to 31.'
237
+ end
238
+
239
+ if app_id.to_s.length < 31
240
+ fail ArgumentError, 'invalid value for "app_id", the character length must be great than or equal to 31.'
241
+ end
242
+
243
+ pattern = Regexp.new(/^app_[A-Za-z0-9]{27}$/)
244
+ if app_id !~ pattern
245
+ fail ArgumentError, "invalid value for \"app_id\", must conform to the pattern #{pattern}."
246
+ end
247
+
248
+ @app_id = app_id
249
+ end
250
+
172
251
  # Custom attribute writer method with validation
173
252
  # @param [Object] app_uid Value to be assigned
174
253
  def app_uid=(app_uid)
@@ -188,6 +267,29 @@ module Svix
188
267
  @app_uid = app_uid
189
268
  end
190
269
 
270
+ # Custom attribute writer method with validation
271
+ # @param [Object] endpoint_id Value to be assigned
272
+ def endpoint_id=(endpoint_id)
273
+ if endpoint_id.nil?
274
+ fail ArgumentError, 'endpoint_id cannot be nil'
275
+ end
276
+
277
+ if endpoint_id.to_s.length > 30
278
+ fail ArgumentError, 'invalid value for "endpoint_id", the character length must be smaller than or equal to 30.'
279
+ end
280
+
281
+ if endpoint_id.to_s.length < 30
282
+ fail ArgumentError, 'invalid value for "endpoint_id", the character length must be great than or equal to 30.'
283
+ end
284
+
285
+ pattern = Regexp.new(/^ep_[A-Za-z0-9]{27}$/)
286
+ if endpoint_id !~ pattern
287
+ fail ArgumentError, "invalid value for \"endpoint_id\", must conform to the pattern #{pattern}."
288
+ end
289
+
290
+ @endpoint_id = endpoint_id
291
+ end
292
+
191
293
  # Custom attribute writer method with validation
192
294
  # @param [Object] endpoint_uid Value to be assigned
193
295
  def endpoint_uid=(endpoint_uid)
@@ -216,7 +318,8 @@ module Svix
216
318
  app_uid == o.app_uid &&
217
319
  endpoint_id == o.endpoint_id &&
218
320
  endpoint_uid == o.endpoint_uid &&
219
- fail_since == o.fail_since
321
+ fail_since == o.fail_since &&
322
+ trigger == o.trigger
220
323
  end
221
324
 
222
325
  # @see the `==` method
@@ -228,7 +331,7 @@ module Svix
228
331
  # Calculates hash code according to all attributes.
229
332
  # @return [Integer] Hash code
230
333
  def hash
231
- [app_id, app_uid, endpoint_id, endpoint_uid, fail_since].hash
334
+ [app_id, app_uid, endpoint_id, endpoint_uid, fail_since, trigger].hash
232
335
  end
233
336
 
234
337
  # Builds the object from hash
@@ -0,0 +1,40 @@
1
+ =begin
2
+ #Svix API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.1.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.9.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Svix
17
+ class EndpointDisabledTrigger
18
+ MANUAL = "manual".freeze
19
+ AUTOMATIC = "automatic".freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [MANUAL, AUTOMATIC].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ return value if EndpointDisabledTrigger.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #EndpointDisabledTrigger"
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,272 @@
1
+ =begin
2
+ #Svix API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.1.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.9.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Svix
17
+ # Sent when an endpoint has been enabled.
18
+ class EndpointEnabledEvent
19
+ attr_accessor :data
20
+
21
+ attr_accessor :type
22
+
23
+ class EnumAttributeValidator
24
+ attr_reader :datatype
25
+ attr_reader :allowable_values
26
+
27
+ def initialize(datatype, allowable_values)
28
+ @allowable_values = allowable_values.map do |value|
29
+ case datatype.to_s
30
+ when /Integer/i
31
+ value.to_i
32
+ when /Float/i
33
+ value.to_f
34
+ else
35
+ value
36
+ end
37
+ end
38
+ end
39
+
40
+ def valid?(value)
41
+ !value || allowable_values.include?(value)
42
+ end
43
+ end
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'data' => :'data',
49
+ :'type' => :'type'
50
+ }
51
+ end
52
+
53
+ # Returns all the JSON keys this model knows about
54
+ def self.acceptable_attributes
55
+ attribute_map.values
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'data' => :'EndpointEnabledEventData',
62
+ :'type' => :'String'
63
+ }
64
+ end
65
+
66
+ # List of attributes with nullable: true
67
+ def self.openapi_nullable
68
+ Set.new([
69
+ ])
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ if (!attributes.is_a?(Hash))
76
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::EndpointEnabledEvent` initialize method"
77
+ end
78
+
79
+ # check to see if the attribute exists and convert string to symbol for hash key
80
+ attributes = attributes.each_with_object({}) { |(k, v), h|
81
+ if (!self.class.attribute_map.key?(k.to_sym))
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::EndpointEnabledEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
83
+ end
84
+ h[k.to_sym] = v
85
+ }
86
+
87
+ if attributes.key?(:'data')
88
+ self.data = attributes[:'data']
89
+ else
90
+ self.data = nil
91
+ end
92
+
93
+ if attributes.key?(:'type')
94
+ self.type = attributes[:'type']
95
+ else
96
+ self.type = 'endpoint.enabled'
97
+ end
98
+ end
99
+
100
+ # Show invalid properties with the reasons. Usually used together with valid?
101
+ # @return Array for valid properties with the reasons
102
+ def list_invalid_properties
103
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
104
+ invalid_properties = Array.new
105
+ if @data.nil?
106
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
107
+ end
108
+
109
+ if @type.nil?
110
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
111
+ end
112
+
113
+ invalid_properties
114
+ end
115
+
116
+ # Check to see if the all the properties in the model are valid
117
+ # @return true if the model is valid
118
+ def valid?
119
+ warn '[DEPRECATED] the `valid?` method is obsolete'
120
+ return false if @data.nil?
121
+ return false if @type.nil?
122
+ type_validator = EnumAttributeValidator.new('String', ["endpoint.enabled"])
123
+ return false unless type_validator.valid?(@type)
124
+ true
125
+ end
126
+
127
+ # Custom attribute writer method checking allowed values (enum).
128
+ # @param [Object] type Object to be assigned
129
+ def type=(type)
130
+ validator = EnumAttributeValidator.new('String', ["endpoint.enabled"])
131
+ unless validator.valid?(type)
132
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
133
+ end
134
+ @type = type
135
+ end
136
+
137
+ # Checks equality by comparing each attribute.
138
+ # @param [Object] Object to be compared
139
+ def ==(o)
140
+ return true if self.equal?(o)
141
+ self.class == o.class &&
142
+ data == o.data &&
143
+ type == o.type
144
+ end
145
+
146
+ # @see the `==` method
147
+ # @param [Object] Object to be compared
148
+ def eql?(o)
149
+ self == o
150
+ end
151
+
152
+ # Calculates hash code according to all attributes.
153
+ # @return [Integer] Hash code
154
+ def hash
155
+ [data, type].hash
156
+ end
157
+
158
+ # Builds the object from hash
159
+ # @param [Hash] attributes Model attributes in the form of hash
160
+ # @return [Object] Returns the model itself
161
+ def self.build_from_hash(attributes)
162
+ return nil unless attributes.is_a?(Hash)
163
+ attributes = attributes.transform_keys(&:to_sym)
164
+ transformed_hash = {}
165
+ openapi_types.each_pair do |key, type|
166
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
167
+ transformed_hash["#{key}"] = nil
168
+ elsif type =~ /\AArray<(.*)>/i
169
+ # check to ensure the input is an array given that the attribute
170
+ # is documented as an array but the input is not
171
+ if attributes[attribute_map[key]].is_a?(Array)
172
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
173
+ end
174
+ elsif !attributes[attribute_map[key]].nil?
175
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
176
+ end
177
+ end
178
+ new(transformed_hash)
179
+ end
180
+
181
+ # Deserializes the data based on type
182
+ # @param string type Data type
183
+ # @param string value Value to be deserialized
184
+ # @return [Object] Deserialized data
185
+ def self._deserialize(type, value)
186
+ case type.to_sym
187
+ when :Time
188
+ Time.parse(value)
189
+ when :Date
190
+ Date.parse(value)
191
+ when :String
192
+ value.to_s
193
+ when :Integer
194
+ value.to_i
195
+ when :Float
196
+ value.to_f
197
+ when :Boolean
198
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
199
+ true
200
+ else
201
+ false
202
+ end
203
+ when :Object
204
+ # generic object (usually a Hash), return directly
205
+ value
206
+ when /\AArray<(?<inner_type>.+)>\z/
207
+ inner_type = Regexp.last_match[:inner_type]
208
+ value.map { |v| _deserialize(inner_type, v) }
209
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
210
+ k_type = Regexp.last_match[:k_type]
211
+ v_type = Regexp.last_match[:v_type]
212
+ {}.tap do |hash|
213
+ value.each do |k, v|
214
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
215
+ end
216
+ end
217
+ else # model
218
+ # models (e.g. Pet) or oneOf
219
+ klass = Svix.const_get(type)
220
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
221
+ end
222
+ end
223
+
224
+ # Returns the string representation of the object
225
+ # @return [String] String presentation of the object
226
+ def to_s
227
+ to_hash.to_s
228
+ end
229
+
230
+ # to_body is an alias to to_hash (backward compatibility)
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_body
233
+ to_hash
234
+ end
235
+
236
+ # Returns the object in the form of hash
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_hash
239
+ hash = {}
240
+ self.class.attribute_map.each_pair do |attr, param|
241
+ value = self.send(attr)
242
+ if value.nil?
243
+ is_nullable = self.class.openapi_nullable.include?(attr)
244
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
245
+ end
246
+
247
+ hash[param] = _to_hash(value)
248
+ end
249
+ hash
250
+ end
251
+
252
+ # Outputs non-array value in the form of hash
253
+ # For object, use to_hash. Otherwise, just return the value
254
+ # @param [Object] value Any valid value
255
+ # @return [Hash] Returns the value in the form of hash
256
+ def _to_hash(value)
257
+ if value.is_a?(Array)
258
+ value.compact.map { |v| _to_hash(v) }
259
+ elsif value.is_a?(Hash)
260
+ {}.tap do |hash|
261
+ value.each { |k, v| hash[k] = _to_hash(v) }
262
+ end
263
+ elsif value.respond_to? :to_hash
264
+ value.to_hash
265
+ else
266
+ value
267
+ end
268
+ end
269
+
270
+ end
271
+
272
+ end