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