svix 1.24.0 → 1.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/lib/svix/api/endpoint_api.rb +277 -2
  4. data/lib/svix/api/message_api.rb +218 -2
  5. data/lib/svix/api/streams_api.rb +185 -0
  6. data/lib/svix/api/transformation_template_api.rb +195 -24
  7. data/lib/svix/models/auth_token_out.rb +272 -0
  8. data/lib/svix/models/create_message_token_in.rb +250 -0
  9. data/lib/svix/models/create_stream_in.rb +225 -0
  10. data/lib/svix/models/endpoint_created_event_data.rb +1 -0
  11. data/lib/svix/models/endpoint_deleted_event_data.rb +1 -0
  12. data/lib/svix/models/endpoint_mtls_config_in.rb +15 -19
  13. data/lib/svix/models/endpoint_oauth_config_in.rb +13 -2
  14. data/lib/svix/models/endpoint_updated_event_data.rb +1 -0
  15. data/lib/svix/models/environment_settings_out.rb +15 -4
  16. data/lib/svix/models/event_in.rb +223 -0
  17. data/lib/svix/models/event_out.rb +223 -0
  18. data/lib/svix/models/event_type_from_open_api.rb +280 -0
  19. data/lib/svix/models/event_type_import_open_api_in.rb +13 -1
  20. data/lib/svix/models/event_type_import_open_api_out_data.rb +16 -4
  21. data/lib/svix/models/hubspot_oauth_config_in.rb +223 -0
  22. data/lib/svix/models/{oauth_payload_out.rb → incoming_webhook_payload_out.rb} +3 -3
  23. data/lib/svix/models/kafka_security_protocol_type.rb +38 -0
  24. data/lib/svix/models/list_response_event_out.rb +259 -0
  25. data/lib/svix/models/list_response_sink_out.rb +259 -0
  26. data/lib/svix/models/message_subscriber_auth_token_out.rb +237 -0
  27. data/lib/svix/models/{oauth_payload_in.rb → o_auth_payload_in.rb} +3 -3
  28. data/lib/svix/models/o_auth_payload_out.rb +239 -0
  29. data/lib/svix/models/{oauth2_grant_type.rb → oauth2_grant_type_in.rb} +4 -3
  30. data/lib/svix/models/settings_in.rb +15 -4
  31. data/lib/svix/models/settings_out.rb +15 -4
  32. data/lib/svix/models/sink_in.rb +107 -0
  33. data/lib/svix/models/sink_in_one_of.rb +285 -0
  34. data/lib/svix/models/sink_in_one_of1.rb +313 -0
  35. data/lib/svix/models/sink_in_one_of2.rb +321 -0
  36. data/lib/svix/models/sink_in_one_of3.rb +271 -0
  37. data/lib/svix/models/sink_out.rb +107 -0
  38. data/lib/svix/version.rb +1 -1
  39. metadata +24 -5
@@ -0,0 +1,285 @@
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
+ OpenAPI Generator version: 5.2.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Svix
17
+ class SinkInOneOf
18
+ attr_accessor :routing_key
19
+
20
+ attr_accessor :type
21
+
22
+ attr_accessor :uri
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'routing_key' => :'routingKey',
50
+ :'type' => :'type',
51
+ :'uri' => :'uri'
52
+ }
53
+ end
54
+
55
+ # Returns all the JSON keys this model knows about
56
+ def self.acceptable_attributes
57
+ attribute_map.values
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'routing_key' => :'String',
64
+ :'type' => :'String',
65
+ :'uri' => :'String'
66
+ }
67
+ end
68
+
69
+ # List of attributes with nullable: true
70
+ def self.openapi_nullable
71
+ Set.new([
72
+ ])
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ if (!attributes.is_a?(Hash))
79
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::SinkInOneOf` initialize method"
80
+ end
81
+
82
+ # check to see if the attribute exists and convert string to symbol for hash key
83
+ attributes = attributes.each_with_object({}) { |(k, v), h|
84
+ if (!self.class.attribute_map.key?(k.to_sym))
85
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::SinkInOneOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
86
+ end
87
+ h[k.to_sym] = v
88
+ }
89
+
90
+ if attributes.key?(:'routing_key')
91
+ self.routing_key = attributes[:'routing_key']
92
+ end
93
+
94
+ if attributes.key?(:'type')
95
+ self.type = attributes[:'type']
96
+ end
97
+
98
+ if attributes.key?(:'uri')
99
+ self.uri = attributes[:'uri']
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ invalid_properties = Array.new
107
+ if @routing_key.nil?
108
+ invalid_properties.push('invalid value for "routing_key", routing_key cannot be nil.')
109
+ end
110
+
111
+ if @type.nil?
112
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
113
+ end
114
+
115
+ if @uri.nil?
116
+ invalid_properties.push('invalid value for "uri", uri cannot be nil.')
117
+ end
118
+
119
+ invalid_properties
120
+ end
121
+
122
+ # Check to see if the all the properties in the model are valid
123
+ # @return true if the model is valid
124
+ def valid?
125
+ return false if @routing_key.nil?
126
+ return false if @type.nil?
127
+ type_validator = EnumAttributeValidator.new('String', ["rabbitMQ"])
128
+ return false unless type_validator.valid?(@type)
129
+ return false if @uri.nil?
130
+ true
131
+ end
132
+
133
+ # Custom attribute writer method checking allowed values (enum).
134
+ # @param [Object] type Object to be assigned
135
+ def type=(type)
136
+ validator = EnumAttributeValidator.new('String', ["rabbitMQ"])
137
+ unless validator.valid?(type)
138
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
139
+ end
140
+ @type = type
141
+ end
142
+
143
+ # Checks equality by comparing each attribute.
144
+ # @param [Object] Object to be compared
145
+ def ==(o)
146
+ return true if self.equal?(o)
147
+ self.class == o.class &&
148
+ routing_key == o.routing_key &&
149
+ type == o.type &&
150
+ uri == o.uri
151
+ end
152
+
153
+ # @see the `==` method
154
+ # @param [Object] Object to be compared
155
+ def eql?(o)
156
+ self == o
157
+ end
158
+
159
+ # Calculates hash code according to all attributes.
160
+ # @return [Integer] Hash code
161
+ def hash
162
+ [routing_key, type, uri].hash
163
+ end
164
+
165
+ # Builds the object from hash
166
+ # @param [Hash] attributes Model attributes in the form of hash
167
+ # @return [Object] Returns the model itself
168
+ def self.build_from_hash(attributes)
169
+ new.build_from_hash(attributes)
170
+ end
171
+
172
+ # Builds the object from hash
173
+ # @param [Hash] attributes Model attributes in the form of hash
174
+ # @return [Object] Returns the model itself
175
+ def build_from_hash(attributes)
176
+ return nil unless attributes.is_a?(Hash)
177
+ self.class.openapi_types.each_pair do |key, type|
178
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
179
+ self.send("#{key}=", nil)
180
+ elsif type =~ /\AArray<(.*)>/i
181
+ # check to ensure the input is an array given that the attribute
182
+ # is documented as an array but the input is not
183
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
184
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
185
+ end
186
+ elsif !attributes[self.class.attribute_map[key]].nil?
187
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
188
+ end
189
+ end
190
+
191
+ self
192
+ end
193
+
194
+ # Deserializes the data based on type
195
+ # @param string type Data type
196
+ # @param string value Value to be deserialized
197
+ # @return [Object] Deserialized data
198
+ def _deserialize(type, value)
199
+ case type.to_sym
200
+ when :Time
201
+ Time.parse(value)
202
+ when :Date
203
+ Date.parse(value)
204
+ when :String
205
+ value.to_s
206
+ when :Integer
207
+ value.to_i
208
+ when :Float
209
+ value.to_f
210
+ when :Boolean
211
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
212
+ true
213
+ else
214
+ false
215
+ end
216
+ when :Object
217
+ # generic object (usually a Hash), return directly
218
+ value
219
+ when /\AArray<(?<inner_type>.+)>\z/
220
+ inner_type = Regexp.last_match[:inner_type]
221
+ value.map { |v| _deserialize(inner_type, v) }
222
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
223
+ k_type = Regexp.last_match[:k_type]
224
+ v_type = Regexp.last_match[:v_type]
225
+ {}.tap do |hash|
226
+ value.each do |k, v|
227
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
228
+ end
229
+ end
230
+ else # model
231
+ # models (e.g. Pet) or oneOf
232
+ klass = Svix.const_get(type)
233
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
234
+ end
235
+ end
236
+
237
+ # Returns the string representation of the object
238
+ # @return [String] String presentation of the object
239
+ def to_s
240
+ to_hash.to_s
241
+ end
242
+
243
+ # to_body is an alias to to_hash (backward compatibility)
244
+ # @return [Hash] Returns the object in the form of hash
245
+ def to_body
246
+ to_hash
247
+ end
248
+
249
+ # Returns the object in the form of hash
250
+ # @return [Hash] Returns the object in the form of hash
251
+ def to_hash
252
+ hash = {}
253
+ self.class.attribute_map.each_pair do |attr, param|
254
+ value = self.send(attr)
255
+ if value.nil?
256
+ is_nullable = self.class.openapi_nullable.include?(attr)
257
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
258
+ end
259
+
260
+ hash[param] = _to_hash(value)
261
+ end
262
+ hash
263
+ end
264
+
265
+ # Outputs non-array value in the form of hash
266
+ # For object, use to_hash. Otherwise, just return the value
267
+ # @param [Object] value Any valid value
268
+ # @return [Hash] Returns the value in the form of hash
269
+ def _to_hash(value)
270
+ if value.is_a?(Array)
271
+ value.compact.map { |v| _to_hash(v) }
272
+ elsif value.is_a?(Hash)
273
+ {}.tap do |hash|
274
+ value.each { |k, v| hash[k] = _to_hash(v) }
275
+ end
276
+ elsif value.respond_to? :to_hash
277
+ value.to_hash
278
+ else
279
+ value
280
+ end
281
+ end
282
+
283
+ end
284
+
285
+ end
@@ -0,0 +1,313 @@
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
+ OpenAPI Generator version: 5.2.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Svix
17
+ class SinkInOneOf1
18
+ attr_accessor :access_key
19
+
20
+ attr_accessor :queue_dsn
21
+
22
+ attr_accessor :region
23
+
24
+ attr_accessor :secret_key
25
+
26
+ attr_accessor :type
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype
30
+ attr_reader :allowable_values
31
+
32
+ def initialize(datatype, allowable_values)
33
+ @allowable_values = allowable_values.map do |value|
34
+ case datatype.to_s
35
+ when /Integer/i
36
+ value.to_i
37
+ when /Float/i
38
+ value.to_f
39
+ else
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def valid?(value)
46
+ !value || allowable_values.include?(value)
47
+ end
48
+ end
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'access_key' => :'accessKey',
54
+ :'queue_dsn' => :'queueDsn',
55
+ :'region' => :'region',
56
+ :'secret_key' => :'secretKey',
57
+ :'type' => :'type'
58
+ }
59
+ end
60
+
61
+ # Returns all the JSON keys this model knows about
62
+ def self.acceptable_attributes
63
+ attribute_map.values
64
+ end
65
+
66
+ # Attribute type mapping.
67
+ def self.openapi_types
68
+ {
69
+ :'access_key' => :'String',
70
+ :'queue_dsn' => :'String',
71
+ :'region' => :'String',
72
+ :'secret_key' => :'String',
73
+ :'type' => :'String'
74
+ }
75
+ end
76
+
77
+ # List of attributes with nullable: true
78
+ def self.openapi_nullable
79
+ Set.new([
80
+ ])
81
+ end
82
+
83
+ # Initializes the object
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ def initialize(attributes = {})
86
+ if (!attributes.is_a?(Hash))
87
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::SinkInOneOf1` initialize method"
88
+ end
89
+
90
+ # check to see if the attribute exists and convert string to symbol for hash key
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!self.class.attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::SinkInOneOf1`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'access_key')
99
+ self.access_key = attributes[:'access_key']
100
+ end
101
+
102
+ if attributes.key?(:'queue_dsn')
103
+ self.queue_dsn = attributes[:'queue_dsn']
104
+ end
105
+
106
+ if attributes.key?(:'region')
107
+ self.region = attributes[:'region']
108
+ end
109
+
110
+ if attributes.key?(:'secret_key')
111
+ self.secret_key = attributes[:'secret_key']
112
+ end
113
+
114
+ if attributes.key?(:'type')
115
+ self.type = attributes[:'type']
116
+ end
117
+ end
118
+
119
+ # Show invalid properties with the reasons. Usually used together with valid?
120
+ # @return Array for valid properties with the reasons
121
+ def list_invalid_properties
122
+ invalid_properties = Array.new
123
+ if @access_key.nil?
124
+ invalid_properties.push('invalid value for "access_key", access_key cannot be nil.')
125
+ end
126
+
127
+ if @queue_dsn.nil?
128
+ invalid_properties.push('invalid value for "queue_dsn", queue_dsn cannot be nil.')
129
+ end
130
+
131
+ if @region.nil?
132
+ invalid_properties.push('invalid value for "region", region cannot be nil.')
133
+ end
134
+
135
+ if @secret_key.nil?
136
+ invalid_properties.push('invalid value for "secret_key", secret_key cannot be nil.')
137
+ end
138
+
139
+ if @type.nil?
140
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
141
+ end
142
+
143
+ invalid_properties
144
+ end
145
+
146
+ # Check to see if the all the properties in the model are valid
147
+ # @return true if the model is valid
148
+ def valid?
149
+ return false if @access_key.nil?
150
+ return false if @queue_dsn.nil?
151
+ return false if @region.nil?
152
+ return false if @secret_key.nil?
153
+ return false if @type.nil?
154
+ type_validator = EnumAttributeValidator.new('String', ["sqs"])
155
+ return false unless type_validator.valid?(@type)
156
+ true
157
+ end
158
+
159
+ # Custom attribute writer method checking allowed values (enum).
160
+ # @param [Object] type Object to be assigned
161
+ def type=(type)
162
+ validator = EnumAttributeValidator.new('String', ["sqs"])
163
+ unless validator.valid?(type)
164
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
165
+ end
166
+ @type = type
167
+ end
168
+
169
+ # Checks equality by comparing each attribute.
170
+ # @param [Object] Object to be compared
171
+ def ==(o)
172
+ return true if self.equal?(o)
173
+ self.class == o.class &&
174
+ access_key == o.access_key &&
175
+ queue_dsn == o.queue_dsn &&
176
+ region == o.region &&
177
+ secret_key == o.secret_key &&
178
+ type == o.type
179
+ end
180
+
181
+ # @see the `==` method
182
+ # @param [Object] Object to be compared
183
+ def eql?(o)
184
+ self == o
185
+ end
186
+
187
+ # Calculates hash code according to all attributes.
188
+ # @return [Integer] Hash code
189
+ def hash
190
+ [access_key, queue_dsn, region, secret_key, type].hash
191
+ end
192
+
193
+ # Builds the object from hash
194
+ # @param [Hash] attributes Model attributes in the form of hash
195
+ # @return [Object] Returns the model itself
196
+ def self.build_from_hash(attributes)
197
+ new.build_from_hash(attributes)
198
+ end
199
+
200
+ # Builds the object from hash
201
+ # @param [Hash] attributes Model attributes in the form of hash
202
+ # @return [Object] Returns the model itself
203
+ def build_from_hash(attributes)
204
+ return nil unless attributes.is_a?(Hash)
205
+ self.class.openapi_types.each_pair do |key, type|
206
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
207
+ self.send("#{key}=", nil)
208
+ elsif type =~ /\AArray<(.*)>/i
209
+ # check to ensure the input is an array given that the attribute
210
+ # is documented as an array but the input is not
211
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
212
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
213
+ end
214
+ elsif !attributes[self.class.attribute_map[key]].nil?
215
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
216
+ end
217
+ end
218
+
219
+ self
220
+ end
221
+
222
+ # Deserializes the data based on type
223
+ # @param string type Data type
224
+ # @param string value Value to be deserialized
225
+ # @return [Object] Deserialized data
226
+ def _deserialize(type, value)
227
+ case type.to_sym
228
+ when :Time
229
+ Time.parse(value)
230
+ when :Date
231
+ Date.parse(value)
232
+ when :String
233
+ value.to_s
234
+ when :Integer
235
+ value.to_i
236
+ when :Float
237
+ value.to_f
238
+ when :Boolean
239
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
240
+ true
241
+ else
242
+ false
243
+ end
244
+ when :Object
245
+ # generic object (usually a Hash), return directly
246
+ value
247
+ when /\AArray<(?<inner_type>.+)>\z/
248
+ inner_type = Regexp.last_match[:inner_type]
249
+ value.map { |v| _deserialize(inner_type, v) }
250
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
251
+ k_type = Regexp.last_match[:k_type]
252
+ v_type = Regexp.last_match[:v_type]
253
+ {}.tap do |hash|
254
+ value.each do |k, v|
255
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
256
+ end
257
+ end
258
+ else # model
259
+ # models (e.g. Pet) or oneOf
260
+ klass = Svix.const_get(type)
261
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
262
+ end
263
+ end
264
+
265
+ # Returns the string representation of the object
266
+ # @return [String] String presentation of the object
267
+ def to_s
268
+ to_hash.to_s
269
+ end
270
+
271
+ # to_body is an alias to to_hash (backward compatibility)
272
+ # @return [Hash] Returns the object in the form of hash
273
+ def to_body
274
+ to_hash
275
+ end
276
+
277
+ # Returns the object in the form of hash
278
+ # @return [Hash] Returns the object in the form of hash
279
+ def to_hash
280
+ hash = {}
281
+ self.class.attribute_map.each_pair do |attr, param|
282
+ value = self.send(attr)
283
+ if value.nil?
284
+ is_nullable = self.class.openapi_nullable.include?(attr)
285
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
286
+ end
287
+
288
+ hash[param] = _to_hash(value)
289
+ end
290
+ hash
291
+ end
292
+
293
+ # Outputs non-array value in the form of hash
294
+ # For object, use to_hash. Otherwise, just return the value
295
+ # @param [Object] value Any valid value
296
+ # @return [Hash] Returns the value in the form of hash
297
+ def _to_hash(value)
298
+ if value.is_a?(Array)
299
+ value.compact.map { |v| _to_hash(v) }
300
+ elsif value.is_a?(Hash)
301
+ {}.tap do |hash|
302
+ value.each { |k, v| hash[k] = _to_hash(v) }
303
+ end
304
+ elsif value.respond_to? :to_hash
305
+ value.to_hash
306
+ else
307
+ value
308
+ end
309
+ end
310
+
311
+ end
312
+
313
+ end