svix 1.39.0 → 1.41.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/svix/api/stream_api.rb +157 -0
  4. data/lib/svix/api/stream_event_types_api.rb +486 -0
  5. data/lib/svix/models/app_usage_stats_in.rb +1 -0
  6. data/lib/svix/models/app_usage_stats_out.rb +33 -4
  7. data/lib/svix/models/event_example_in.rb +35 -4
  8. data/lib/svix/models/event_in.rb +38 -1
  9. data/lib/svix/models/event_out.rb +38 -1
  10. data/lib/svix/models/list_response_application_out.rb +2 -0
  11. data/lib/svix/models/list_response_application_stats.rb +2 -0
  12. data/lib/svix/models/list_response_background_task_out.rb +2 -0
  13. data/lib/svix/models/list_response_endpoint_message_out.rb +2 -0
  14. data/lib/svix/models/list_response_endpoint_out.rb +2 -0
  15. data/lib/svix/models/list_response_event_type_out.rb +2 -0
  16. data/lib/svix/models/list_response_integration_out.rb +2 -0
  17. data/lib/svix/models/list_response_message_attempt_endpoint_out.rb +2 -0
  18. data/lib/svix/models/list_response_message_attempt_out.rb +2 -0
  19. data/lib/svix/models/list_response_message_endpoint_out.rb +2 -0
  20. data/lib/svix/models/list_response_message_out.rb +2 -0
  21. data/lib/svix/models/list_response_operational_webhook_endpoint_out.rb +2 -0
  22. data/lib/svix/models/list_response_sink_out.rb +2 -0
  23. data/lib/svix/models/list_response_stream_event_type_out.rb +261 -0
  24. data/lib/svix/models/list_response_stream_out.rb +2 -0
  25. data/lib/svix/models/list_response_stream_sink_out.rb +2 -0
  26. data/lib/svix/models/list_response_template_out.rb +2 -0
  27. data/lib/svix/models/sink_http_config.rb +11 -1
  28. data/lib/svix/models/stream_event_type_in.rb +262 -0
  29. data/lib/svix/models/stream_event_type_out.rb +294 -0
  30. data/lib/svix/models/stream_event_type_patch.rb +254 -0
  31. data/lib/svix/version.rb +1 -1
  32. metadata +7 -3
  33. data/lib/svix/api/sink_api.rb +0 -179
@@ -0,0 +1,261 @@
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 ListResponseStreamEventTypeOut
18
+ attr_accessor :data
19
+
20
+ attr_accessor :done
21
+
22
+ attr_accessor :iterator
23
+
24
+ attr_accessor :prev_iterator
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'data' => :'data',
30
+ :'done' => :'done',
31
+ :'iterator' => :'iterator',
32
+ :'prev_iterator' => :'prevIterator'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'data' => :'Array<StreamEventTypeOut>',
45
+ :'done' => :'Boolean',
46
+ :'iterator' => :'String',
47
+ :'prev_iterator' => :'String'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ :'iterator',
55
+ :'prev_iterator'
56
+ ])
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ if (!attributes.is_a?(Hash))
63
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::ListResponseStreamEventTypeOut` initialize method"
64
+ end
65
+
66
+ # check to see if the attribute exists and convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!self.class.attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::ListResponseStreamEventTypeOut`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'data')
75
+ if (value = attributes[:'data']).is_a?(Array)
76
+ self.data = value
77
+ end
78
+ else
79
+ self.data = nil
80
+ end
81
+
82
+ if attributes.key?(:'done')
83
+ self.done = attributes[:'done']
84
+ else
85
+ self.done = nil
86
+ end
87
+
88
+ if attributes.key?(:'iterator')
89
+ self.iterator = attributes[:'iterator']
90
+ else
91
+ self.iterator = nil
92
+ end
93
+
94
+ if attributes.key?(:'prev_iterator')
95
+ self.prev_iterator = attributes[:'prev_iterator']
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
103
+ invalid_properties = Array.new
104
+ if @data.nil?
105
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
106
+ end
107
+
108
+ if @done.nil?
109
+ invalid_properties.push('invalid value for "done", done cannot be nil.')
110
+ end
111
+
112
+ invalid_properties
113
+ end
114
+
115
+ # Check to see if the all the properties in the model are valid
116
+ # @return true if the model is valid
117
+ def valid?
118
+ warn '[DEPRECATED] the `valid?` method is obsolete'
119
+ return false if @data.nil?
120
+ return false if @done.nil?
121
+ true
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(o)
127
+ return true if self.equal?(o)
128
+ self.class == o.class &&
129
+ data == o.data &&
130
+ done == o.done &&
131
+ iterator == o.iterator &&
132
+ prev_iterator == o.prev_iterator
133
+ end
134
+
135
+ # @see the `==` method
136
+ # @param [Object] Object to be compared
137
+ def eql?(o)
138
+ self == o
139
+ end
140
+
141
+ # Calculates hash code according to all attributes.
142
+ # @return [Integer] Hash code
143
+ def hash
144
+ [data, done, iterator, prev_iterator].hash
145
+ end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def self.build_from_hash(attributes)
151
+ return nil unless attributes.is_a?(Hash)
152
+ attributes = attributes.transform_keys(&:to_sym)
153
+ transformed_hash = {}
154
+ openapi_types.each_pair do |key, type|
155
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
156
+ transformed_hash["#{key}"] = nil
157
+ elsif type =~ /\AArray<(.*)>/i
158
+ # check to ensure the input is an array given that the attribute
159
+ # is documented as an array but the input is not
160
+ if attributes[attribute_map[key]].is_a?(Array)
161
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
162
+ end
163
+ elsif !attributes[attribute_map[key]].nil?
164
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
165
+ end
166
+ end
167
+ new(transformed_hash)
168
+ end
169
+
170
+ # Deserializes the data based on type
171
+ # @param string type Data type
172
+ # @param string value Value to be deserialized
173
+ # @return [Object] Deserialized data
174
+ def self._deserialize(type, value)
175
+ case type.to_sym
176
+ when :Time
177
+ Time.parse(value)
178
+ when :Date
179
+ Date.parse(value)
180
+ when :String
181
+ value.to_s
182
+ when :Integer
183
+ value.to_i
184
+ when :Float
185
+ value.to_f
186
+ when :Boolean
187
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
188
+ true
189
+ else
190
+ false
191
+ end
192
+ when :Object
193
+ # generic object (usually a Hash), return directly
194
+ value
195
+ when /\AArray<(?<inner_type>.+)>\z/
196
+ inner_type = Regexp.last_match[:inner_type]
197
+ value.map { |v| _deserialize(inner_type, v) }
198
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
199
+ k_type = Regexp.last_match[:k_type]
200
+ v_type = Regexp.last_match[:v_type]
201
+ {}.tap do |hash|
202
+ value.each do |k, v|
203
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
204
+ end
205
+ end
206
+ else # model
207
+ # models (e.g. Pet) or oneOf
208
+ klass = Svix.const_get(type)
209
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
210
+ end
211
+ end
212
+
213
+ # Returns the string representation of the object
214
+ # @return [String] String presentation of the object
215
+ def to_s
216
+ to_hash.to_s
217
+ end
218
+
219
+ # to_body is an alias to to_hash (backward compatibility)
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_body
222
+ to_hash
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ if value.nil?
232
+ is_nullable = self.class.openapi_nullable.include?(attr)
233
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
234
+ end
235
+
236
+ hash[param] = _to_hash(value)
237
+ end
238
+ hash
239
+ end
240
+
241
+ # Outputs non-array value in the form of hash
242
+ # For object, use to_hash. Otherwise, just return the value
243
+ # @param [Object] value Any valid value
244
+ # @return [Hash] Returns the value in the form of hash
245
+ def _to_hash(value)
246
+ if value.is_a?(Array)
247
+ value.compact.map { |v| _to_hash(v) }
248
+ elsif value.is_a?(Hash)
249
+ {}.tap do |hash|
250
+ value.each { |k, v| hash[k] = _to_hash(v) }
251
+ end
252
+ elsif value.respond_to? :to_hash
253
+ value.to_hash
254
+ else
255
+ value
256
+ end
257
+ end
258
+
259
+ end
260
+
261
+ end
@@ -87,6 +87,8 @@ module Svix
87
87
 
88
88
  if attributes.key?(:'iterator')
89
89
  self.iterator = attributes[:'iterator']
90
+ else
91
+ self.iterator = nil
90
92
  end
91
93
 
92
94
  if attributes.key?(:'prev_iterator')
@@ -87,6 +87,8 @@ module Svix
87
87
 
88
88
  if attributes.key?(:'iterator')
89
89
  self.iterator = attributes[:'iterator']
90
+ else
91
+ self.iterator = nil
90
92
  end
91
93
 
92
94
  if attributes.key?(:'prev_iterator')
@@ -87,6 +87,8 @@ module Svix
87
87
 
88
88
  if attributes.key?(:'iterator')
89
89
  self.iterator = attributes[:'iterator']
90
+ else
91
+ self.iterator = nil
90
92
  end
91
93
 
92
94
  if attributes.key?(:'prev_iterator')
@@ -17,12 +17,15 @@ module Svix
17
17
  class SinkHttpConfig
18
18
  attr_accessor :headers
19
19
 
20
+ attr_accessor :key
21
+
20
22
  attr_accessor :url
21
23
 
22
24
  # Attribute mapping from ruby-style variable name to JSON key.
23
25
  def self.attribute_map
24
26
  {
25
27
  :'headers' => :'headers',
28
+ :'key' => :'key',
26
29
  :'url' => :'url'
27
30
  }
28
31
  end
@@ -36,6 +39,7 @@ module Svix
36
39
  def self.openapi_types
37
40
  {
38
41
  :'headers' => :'Hash<String, String>',
42
+ :'key' => :'String',
39
43
  :'url' => :'String'
40
44
  }
41
45
  end
@@ -43,6 +47,7 @@ module Svix
43
47
  # List of attributes with nullable: true
44
48
  def self.openapi_nullable
45
49
  Set.new([
50
+ :'key',
46
51
  ])
47
52
  end
48
53
 
@@ -67,6 +72,10 @@ module Svix
67
72
  end
68
73
  end
69
74
 
75
+ if attributes.key?(:'key')
76
+ self.key = attributes[:'key']
77
+ end
78
+
70
79
  if attributes.key?(:'url')
71
80
  self.url = attributes[:'url']
72
81
  else
@@ -100,6 +109,7 @@ module Svix
100
109
  return true if self.equal?(o)
101
110
  self.class == o.class &&
102
111
  headers == o.headers &&
112
+ key == o.key &&
103
113
  url == o.url
104
114
  end
105
115
 
@@ -112,7 +122,7 @@ module Svix
112
122
  # Calculates hash code according to all attributes.
113
123
  # @return [Integer] Hash code
114
124
  def hash
115
- [headers, url].hash
125
+ [headers, key, url].hash
116
126
  end
117
127
 
118
128
  # Builds the object from hash
@@ -0,0 +1,262 @@
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 StreamEventTypeIn
18
+ attr_accessor :description
19
+
20
+ # The event type's name
21
+ attr_accessor :name
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'description' => :'description',
27
+ :'name' => :'name'
28
+ }
29
+ end
30
+
31
+ # Returns all the JSON keys this model knows about
32
+ def self.acceptable_attributes
33
+ attribute_map.values
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'description' => :'String',
40
+ :'name' => :'String'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ :'description',
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::StreamEventTypeIn` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::StreamEventTypeIn`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'description')
67
+ self.description = attributes[:'description']
68
+ end
69
+
70
+ if attributes.key?(:'name')
71
+ self.name = attributes[:'name']
72
+ else
73
+ self.name = nil
74
+ end
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
81
+ invalid_properties = Array.new
82
+ if @name.nil?
83
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
84
+ end
85
+
86
+ if @name.to_s.length > 256
87
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 256.')
88
+ end
89
+
90
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
91
+ if @name !~ pattern
92
+ invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
93
+ end
94
+
95
+ invalid_properties
96
+ end
97
+
98
+ # Check to see if the all the properties in the model are valid
99
+ # @return true if the model is valid
100
+ def valid?
101
+ warn '[DEPRECATED] the `valid?` method is obsolete'
102
+ return false if @name.nil?
103
+ return false if @name.to_s.length > 256
104
+ return false if @name !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
105
+ true
106
+ end
107
+
108
+ # Custom attribute writer method with validation
109
+ # @param [Object] name Value to be assigned
110
+ def name=(name)
111
+ if name.nil?
112
+ fail ArgumentError, 'name cannot be nil'
113
+ end
114
+
115
+ if name.to_s.length > 256
116
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 256.'
117
+ end
118
+
119
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
120
+ if name !~ pattern
121
+ fail ArgumentError, "invalid value for \"name\", must conform to the pattern #{pattern}."
122
+ end
123
+
124
+ @name = name
125
+ end
126
+
127
+ # Checks equality by comparing each attribute.
128
+ # @param [Object] Object to be compared
129
+ def ==(o)
130
+ return true if self.equal?(o)
131
+ self.class == o.class &&
132
+ description == o.description &&
133
+ name == o.name
134
+ end
135
+
136
+ # @see the `==` method
137
+ # @param [Object] Object to be compared
138
+ def eql?(o)
139
+ self == o
140
+ end
141
+
142
+ # Calculates hash code according to all attributes.
143
+ # @return [Integer] Hash code
144
+ def hash
145
+ [description, name].hash
146
+ end
147
+
148
+ # Builds the object from hash
149
+ # @param [Hash] attributes Model attributes in the form of hash
150
+ # @return [Object] Returns the model itself
151
+ def self.build_from_hash(attributes)
152
+ return nil unless attributes.is_a?(Hash)
153
+ attributes = attributes.transform_keys(&:to_sym)
154
+ transformed_hash = {}
155
+ openapi_types.each_pair do |key, type|
156
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
157
+ transformed_hash["#{key}"] = nil
158
+ elsif type =~ /\AArray<(.*)>/i
159
+ # check to ensure the input is an array given that the attribute
160
+ # is documented as an array but the input is not
161
+ if attributes[attribute_map[key]].is_a?(Array)
162
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
163
+ end
164
+ elsif !attributes[attribute_map[key]].nil?
165
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
166
+ end
167
+ end
168
+ new(transformed_hash)
169
+ end
170
+
171
+ # Deserializes the data based on type
172
+ # @param string type Data type
173
+ # @param string value Value to be deserialized
174
+ # @return [Object] Deserialized data
175
+ def self._deserialize(type, value)
176
+ case type.to_sym
177
+ when :Time
178
+ Time.parse(value)
179
+ when :Date
180
+ Date.parse(value)
181
+ when :String
182
+ value.to_s
183
+ when :Integer
184
+ value.to_i
185
+ when :Float
186
+ value.to_f
187
+ when :Boolean
188
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
189
+ true
190
+ else
191
+ false
192
+ end
193
+ when :Object
194
+ # generic object (usually a Hash), return directly
195
+ value
196
+ when /\AArray<(?<inner_type>.+)>\z/
197
+ inner_type = Regexp.last_match[:inner_type]
198
+ value.map { |v| _deserialize(inner_type, v) }
199
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
200
+ k_type = Regexp.last_match[:k_type]
201
+ v_type = Regexp.last_match[:v_type]
202
+ {}.tap do |hash|
203
+ value.each do |k, v|
204
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
205
+ end
206
+ end
207
+ else # model
208
+ # models (e.g. Pet) or oneOf
209
+ klass = Svix.const_get(type)
210
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
211
+ end
212
+ end
213
+
214
+ # Returns the string representation of the object
215
+ # @return [String] String presentation of the object
216
+ def to_s
217
+ to_hash.to_s
218
+ end
219
+
220
+ # to_body is an alias to to_hash (backward compatibility)
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_body
223
+ to_hash
224
+ end
225
+
226
+ # Returns the object in the form of hash
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_hash
229
+ hash = {}
230
+ self.class.attribute_map.each_pair do |attr, param|
231
+ value = self.send(attr)
232
+ if value.nil?
233
+ is_nullable = self.class.openapi_nullable.include?(attr)
234
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
235
+ end
236
+
237
+ hash[param] = _to_hash(value)
238
+ end
239
+ hash
240
+ end
241
+
242
+ # Outputs non-array value in the form of hash
243
+ # For object, use to_hash. Otherwise, just return the value
244
+ # @param [Object] value Any valid value
245
+ # @return [Hash] Returns the value in the form of hash
246
+ def _to_hash(value)
247
+ if value.is_a?(Array)
248
+ value.compact.map { |v| _to_hash(v) }
249
+ elsif value.is_a?(Hash)
250
+ {}.tap do |hash|
251
+ value.each { |k, v| hash[k] = _to_hash(v) }
252
+ end
253
+ elsif value.respond_to? :to_hash
254
+ value.to_hash
255
+ else
256
+ value
257
+ end
258
+ end
259
+
260
+ end
261
+
262
+ end