svix 1.23.0 → 1.25.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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/lib/svix/api/endpoint_api.rb +475 -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/client_secret_jwt_params_in.rb +3 -0
  9. data/lib/svix/models/create_message_token_in.rb +250 -0
  10. data/lib/svix/models/create_stream_in.rb +225 -0
  11. data/lib/svix/models/endpoint_created_event_data.rb +1 -0
  12. data/lib/svix/models/endpoint_deleted_event_data.rb +1 -0
  13. data/lib/svix/models/endpoint_mtls_config_in.rb +235 -0
  14. data/lib/svix/models/endpoint_oauth_config_in.rb +42 -2
  15. data/lib/svix/models/endpoint_updated_event_data.rb +1 -0
  16. data/lib/svix/models/environment_settings_out.rb +15 -4
  17. data/lib/svix/models/event_in.rb +223 -0
  18. data/lib/svix/models/event_out.rb +223 -0
  19. data/lib/svix/models/event_type_from_open_api.rb +280 -0
  20. data/lib/svix/models/event_type_import_open_api_in.rb +13 -1
  21. data/lib/svix/models/event_type_import_open_api_out_data.rb +16 -4
  22. data/lib/svix/models/hubspot_oauth_config_in.rb +223 -0
  23. data/lib/svix/models/{oauth_payload_out.rb → incoming_webhook_payload_out.rb} +3 -3
  24. data/lib/svix/models/kafka_security_protocol_type.rb +38 -0
  25. data/lib/svix/models/list_response_event_out.rb +259 -0
  26. data/lib/svix/models/list_response_sink_out.rb +259 -0
  27. data/lib/svix/models/message_subscriber_auth_token_out.rb +237 -0
  28. data/lib/svix/models/{oauth_payload_in.rb → o_auth_payload_in.rb} +3 -3
  29. data/lib/svix/models/o_auth_payload_out.rb +239 -0
  30. data/lib/svix/models/{oauth2_grant_type.rb → oauth2_grant_type_in.rb} +4 -3
  31. data/lib/svix/models/settings_in.rb +15 -4
  32. data/lib/svix/models/settings_out.rb +15 -4
  33. data/lib/svix/models/sink_in.rb +107 -0
  34. data/lib/svix/models/sink_in_one_of.rb +285 -0
  35. data/lib/svix/models/sink_in_one_of1.rb +313 -0
  36. data/lib/svix/models/sink_in_one_of2.rb +321 -0
  37. data/lib/svix/models/sink_in_one_of3.rb +271 -0
  38. data/lib/svix/models/sink_out.rb +107 -0
  39. data/lib/svix/version.rb +1 -1
  40. metadata +25 -5
@@ -0,0 +1,239 @@
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 OAuthPayloadOut
18
+ attr_accessor :access_token
19
+
20
+ attr_accessor :error
21
+
22
+ attr_accessor :refresh_token
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'access_token' => :'accessToken',
28
+ :'error' => :'error',
29
+ :'refresh_token' => :'refreshToken'
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
+ :'access_token' => :'String',
42
+ :'error' => :'String',
43
+ :'refresh_token' => :'String'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ :'access_token',
51
+ :'error',
52
+ :'refresh_token'
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::OAuthPayloadOut` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::OAuthPayloadOut`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'access_token')
72
+ self.access_token = attributes[:'access_token']
73
+ end
74
+
75
+ if attributes.key?(:'error')
76
+ self.error = attributes[:'error']
77
+ end
78
+
79
+ if attributes.key?(:'refresh_token')
80
+ self.refresh_token = attributes[:'refresh_token']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ invalid_properties
89
+ end
90
+
91
+ # Check to see if the all the properties in the model are valid
92
+ # @return true if the model is valid
93
+ def valid?
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ access_token == o.access_token &&
103
+ error == o.error &&
104
+ refresh_token == o.refresh_token
105
+ end
106
+
107
+ # @see the `==` method
108
+ # @param [Object] Object to be compared
109
+ def eql?(o)
110
+ self == o
111
+ end
112
+
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Integer] Hash code
115
+ def hash
116
+ [access_token, error, refresh_token].hash
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def self.build_from_hash(attributes)
123
+ new.build_from_hash(attributes)
124
+ end
125
+
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
129
+ def build_from_hash(attributes)
130
+ return nil unless attributes.is_a?(Hash)
131
+ self.class.openapi_types.each_pair do |key, type|
132
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
133
+ self.send("#{key}=", nil)
134
+ elsif type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
138
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
139
+ end
140
+ elsif !attributes[self.class.attribute_map[key]].nil?
141
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
142
+ end
143
+ end
144
+
145
+ self
146
+ end
147
+
148
+ # Deserializes the data based on type
149
+ # @param string type Data type
150
+ # @param string value Value to be deserialized
151
+ # @return [Object] Deserialized data
152
+ def _deserialize(type, value)
153
+ case type.to_sym
154
+ when :Time
155
+ Time.parse(value)
156
+ when :Date
157
+ Date.parse(value)
158
+ when :String
159
+ value.to_s
160
+ when :Integer
161
+ value.to_i
162
+ when :Float
163
+ value.to_f
164
+ when :Boolean
165
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
+ true
167
+ else
168
+ false
169
+ end
170
+ when :Object
171
+ # generic object (usually a Hash), return directly
172
+ value
173
+ when /\AArray<(?<inner_type>.+)>\z/
174
+ inner_type = Regexp.last_match[:inner_type]
175
+ value.map { |v| _deserialize(inner_type, v) }
176
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
+ k_type = Regexp.last_match[:k_type]
178
+ v_type = Regexp.last_match[:v_type]
179
+ {}.tap do |hash|
180
+ value.each do |k, v|
181
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
+ end
183
+ end
184
+ else # model
185
+ # models (e.g. Pet) or oneOf
186
+ klass = Svix.const_get(type)
187
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+
237
+ end
238
+
239
+ end
@@ -14,8 +14,9 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Svix
17
- class Oauth2GrantType
17
+ class Oauth2GrantTypeIn
18
18
  CLIENT_CREDENTIALS = "clientCredentials".freeze
19
+ REFRESH_TOKEN = "refreshToken".freeze
19
20
 
20
21
  # Builds the enum from string
21
22
  # @param [String] The enum value in the form of the string
@@ -28,8 +29,8 @@ module Svix
28
29
  # @param [String] The enum value in the form of the string
29
30
  # @return [String] The enum value
30
31
  def build_from_hash(value)
31
- constantValues = Oauth2GrantType.constants.select { |c| Oauth2GrantType::const_get(c) == value }
32
- raise "Invalid ENUM value #{value} for class #Oauth2GrantType" if constantValues.empty?
32
+ constantValues = Oauth2GrantTypeIn.constants.select { |c| Oauth2GrantTypeIn::const_get(c) == value }
33
+ raise "Invalid ENUM value #{value} for class #Oauth2GrantTypeIn" if constantValues.empty?
33
34
  value
34
35
  end
35
36
  end
@@ -49,6 +49,8 @@ module Svix
49
49
 
50
50
  attr_accessor :show_use_svix_play
51
51
 
52
+ attr_accessor :wipe_successful_payload
53
+
52
54
  # Attribute mapping from ruby-style variable name to JSON key.
53
55
  def self.attribute_map
54
56
  {
@@ -68,7 +70,8 @@ module Svix
68
70
  :'enforce_https' => :'enforceHttps',
69
71
  :'event_catalog_published' => :'eventCatalogPublished',
70
72
  :'read_only' => :'readOnly',
71
- :'show_use_svix_play' => :'showUseSvixPlay'
73
+ :'show_use_svix_play' => :'showUseSvixPlay',
74
+ :'wipe_successful_payload' => :'wipeSuccessfulPayload'
72
75
  }
73
76
  end
74
77
 
@@ -96,7 +99,8 @@ module Svix
96
99
  :'enforce_https' => :'Boolean',
97
100
  :'event_catalog_published' => :'Boolean',
98
101
  :'read_only' => :'Boolean',
99
- :'show_use_svix_play' => :'Boolean'
102
+ :'show_use_svix_play' => :'Boolean',
103
+ :'wipe_successful_payload' => :'Boolean'
100
104
  }
101
105
  end
102
106
 
@@ -210,6 +214,12 @@ module Svix
210
214
  else
211
215
  self.show_use_svix_play = true
212
216
  end
217
+
218
+ if attributes.key?(:'wipe_successful_payload')
219
+ self.wipe_successful_payload = attributes[:'wipe_successful_payload']
220
+ else
221
+ self.wipe_successful_payload = false
222
+ end
213
223
  end
214
224
 
215
225
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -311,7 +321,8 @@ module Svix
311
321
  enforce_https == o.enforce_https &&
312
322
  event_catalog_published == o.event_catalog_published &&
313
323
  read_only == o.read_only &&
314
- show_use_svix_play == o.show_use_svix_play
324
+ show_use_svix_play == o.show_use_svix_play &&
325
+ wipe_successful_payload == o.wipe_successful_payload
315
326
  end
316
327
 
317
328
  # @see the `==` method
@@ -323,7 +334,7 @@ module Svix
323
334
  # Calculates hash code according to all attributes.
324
335
  # @return [Integer] Hash code
325
336
  def hash
326
- [color_palette_dark, color_palette_light, custom_base_font_size, custom_color, custom_font_family, custom_font_family_url, custom_logo_url, custom_theme_override, disable_endpoint_on_failure, display_name, enable_channels, enable_integration_management, enable_transformations, enforce_https, event_catalog_published, read_only, show_use_svix_play].hash
337
+ [color_palette_dark, color_palette_light, custom_base_font_size, custom_color, custom_font_family, custom_font_family_url, custom_logo_url, custom_theme_override, disable_endpoint_on_failure, display_name, enable_channels, enable_integration_management, enable_transformations, enforce_https, event_catalog_published, read_only, show_use_svix_play, wipe_successful_payload].hash
327
338
  end
328
339
 
329
340
  # Builds the object from hash
@@ -49,6 +49,8 @@ module Svix
49
49
 
50
50
  attr_accessor :show_use_svix_play
51
51
 
52
+ attr_accessor :wipe_successful_payload
53
+
52
54
  # Attribute mapping from ruby-style variable name to JSON key.
53
55
  def self.attribute_map
54
56
  {
@@ -68,7 +70,8 @@ module Svix
68
70
  :'enforce_https' => :'enforceHttps',
69
71
  :'event_catalog_published' => :'eventCatalogPublished',
70
72
  :'read_only' => :'readOnly',
71
- :'show_use_svix_play' => :'showUseSvixPlay'
73
+ :'show_use_svix_play' => :'showUseSvixPlay',
74
+ :'wipe_successful_payload' => :'wipeSuccessfulPayload'
72
75
  }
73
76
  end
74
77
 
@@ -96,7 +99,8 @@ module Svix
96
99
  :'enforce_https' => :'Boolean',
97
100
  :'event_catalog_published' => :'Boolean',
98
101
  :'read_only' => :'Boolean',
99
- :'show_use_svix_play' => :'Boolean'
102
+ :'show_use_svix_play' => :'Boolean',
103
+ :'wipe_successful_payload' => :'Boolean'
100
104
  }
101
105
  end
102
106
 
@@ -210,6 +214,12 @@ module Svix
210
214
  else
211
215
  self.show_use_svix_play = true
212
216
  end
217
+
218
+ if attributes.key?(:'wipe_successful_payload')
219
+ self.wipe_successful_payload = attributes[:'wipe_successful_payload']
220
+ else
221
+ self.wipe_successful_payload = false
222
+ end
213
223
  end
214
224
 
215
225
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -311,7 +321,8 @@ module Svix
311
321
  enforce_https == o.enforce_https &&
312
322
  event_catalog_published == o.event_catalog_published &&
313
323
  read_only == o.read_only &&
314
- show_use_svix_play == o.show_use_svix_play
324
+ show_use_svix_play == o.show_use_svix_play &&
325
+ wipe_successful_payload == o.wipe_successful_payload
315
326
  end
316
327
 
317
328
  # @see the `==` method
@@ -323,7 +334,7 @@ module Svix
323
334
  # Calculates hash code according to all attributes.
324
335
  # @return [Integer] Hash code
325
336
  def hash
326
- [color_palette_dark, color_palette_light, custom_base_font_size, custom_color, custom_font_family, custom_font_family_url, custom_logo_url, custom_theme_override, disable_endpoint_on_failure, display_name, enable_channels, enable_integration_management, enable_transformations, enforce_https, event_catalog_published, read_only, show_use_svix_play].hash
337
+ [color_palette_dark, color_palette_light, custom_base_font_size, custom_color, custom_font_family, custom_font_family_url, custom_logo_url, custom_theme_override, disable_endpoint_on_failure, display_name, enable_channels, enable_integration_management, enable_transformations, enforce_https, event_catalog_published, read_only, show_use_svix_play, wipe_successful_payload].hash
327
338
  end
328
339
 
329
340
  # Builds the object from hash
@@ -0,0 +1,107 @@
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
+ module SinkIn
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'SinkInOneOf',
23
+ :'SinkInOneOf1',
24
+ :'SinkInOneOf2',
25
+ :'SinkInOneOf3'
26
+ ]
27
+ end
28
+
29
+ # Builds the object
30
+ # @param [Mixed] Data to be matched against the list of oneOf items
31
+ # @return [Object] Returns the model or the data itself
32
+ def build(data)
33
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
34
+ # Note:
35
+ # - We do not attempt to check whether exactly one item matches.
36
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
37
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
38
+ # - TODO: scalar values are defacto behaving as if they were nullable.
39
+ # - TODO: logging when debugging is set.
40
+ openapi_one_of.each do |klass|
41
+ begin
42
+ next if klass == :AnyType # "nullable: true"
43
+ typed_data = find_and_cast_into_type(klass, data)
44
+ return typed_data if typed_data
45
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
46
+ end
47
+ end
48
+
49
+ openapi_one_of.include?(:AnyType) ? data : nil
50
+ end
51
+
52
+ private
53
+
54
+ SchemaMismatchError = Class.new(StandardError)
55
+
56
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
57
+ def find_and_cast_into_type(klass, data)
58
+ return if data.nil?
59
+
60
+ case klass.to_s
61
+ when 'Boolean'
62
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
63
+ when 'Float'
64
+ return data if data.instance_of?(Float)
65
+ when 'Integer'
66
+ return data if data.instance_of?(Integer)
67
+ when 'Time'
68
+ return Time.parse(data)
69
+ when 'Date'
70
+ return Date.parse(data)
71
+ when 'String'
72
+ return data if data.instance_of?(String)
73
+ when 'Object' # "type: object"
74
+ return data if data.instance_of?(Hash)
75
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
76
+ if data.instance_of?(Array)
77
+ sub_type = Regexp.last_match[:sub_type]
78
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
79
+ end
80
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
81
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
82
+ sub_type = Regexp.last_match[:sub_type]
83
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
84
+ end
85
+ else # model
86
+ const = Svix.const_get(klass)
87
+ if const
88
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
89
+ model = const.build(data)
90
+ return model if model
91
+ else
92
+ # raise if data contains keys that are not known to the model
93
+ raise unless (data.keys - const.acceptable_attributes).empty?
94
+ model = const.build_from_hash(data)
95
+ return model if model && model.valid?
96
+ end
97
+ end
98
+ end
99
+
100
+ raise # if no match by now, raise
101
+ rescue
102
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
103
+ end
104
+ end
105
+ end
106
+
107
+ end