svix 1.15.0 → 1.17.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,277 @@
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 InboundPathParams
18
+ # The app's ID or UID
19
+ attr_accessor :app_id
20
+
21
+ attr_accessor :inbound_token
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'app_id' => :'app_id',
27
+ :'inbound_token' => :'inbound_token'
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
+ :'app_id' => :'String',
40
+ :'inbound_token' => :'String'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::InboundPathParams` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::InboundPathParams`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'app_id')
66
+ self.app_id = attributes[:'app_id']
67
+ end
68
+
69
+ if attributes.key?(:'inbound_token')
70
+ self.inbound_token = attributes[:'inbound_token']
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ invalid_properties = Array.new
78
+ if @app_id.nil?
79
+ invalid_properties.push('invalid value for "app_id", app_id cannot be nil.')
80
+ end
81
+
82
+ if @app_id.to_s.length > 256
83
+ invalid_properties.push('invalid value for "app_id", the character length must be smaller than or equal to 256.')
84
+ end
85
+
86
+ if @app_id.to_s.length < 1
87
+ invalid_properties.push('invalid value for "app_id", the character length must be great than or equal to 1.')
88
+ end
89
+
90
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
91
+ if @app_id !~ pattern
92
+ invalid_properties.push("invalid value for \"app_id\", must conform to the pattern #{pattern}.")
93
+ end
94
+
95
+ if @inbound_token.nil?
96
+ invalid_properties.push('invalid value for "inbound_token", inbound_token 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 @app_id.nil?
106
+ return false if @app_id.to_s.length > 256
107
+ return false if @app_id.to_s.length < 1
108
+ return false if @app_id !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
109
+ return false if @inbound_token.nil?
110
+ true
111
+ end
112
+
113
+ # Custom attribute writer method with validation
114
+ # @param [Object] app_id Value to be assigned
115
+ def app_id=(app_id)
116
+ if app_id.nil?
117
+ fail ArgumentError, 'app_id cannot be nil'
118
+ end
119
+
120
+ if app_id.to_s.length > 256
121
+ fail ArgumentError, 'invalid value for "app_id", the character length must be smaller than or equal to 256.'
122
+ end
123
+
124
+ if app_id.to_s.length < 1
125
+ fail ArgumentError, 'invalid value for "app_id", the character length must be great than or equal to 1.'
126
+ end
127
+
128
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
129
+ if app_id !~ pattern
130
+ fail ArgumentError, "invalid value for \"app_id\", must conform to the pattern #{pattern}."
131
+ end
132
+
133
+ @app_id = app_id
134
+ end
135
+
136
+ # Checks equality by comparing each attribute.
137
+ # @param [Object] Object to be compared
138
+ def ==(o)
139
+ return true if self.equal?(o)
140
+ self.class == o.class &&
141
+ app_id == o.app_id &&
142
+ inbound_token == o.inbound_token
143
+ end
144
+
145
+ # @see the `==` method
146
+ # @param [Object] Object to be compared
147
+ def eql?(o)
148
+ self == o
149
+ end
150
+
151
+ # Calculates hash code according to all attributes.
152
+ # @return [Integer] Hash code
153
+ def hash
154
+ [app_id, inbound_token].hash
155
+ end
156
+
157
+ # Builds the object from hash
158
+ # @param [Hash] attributes Model attributes in the form of hash
159
+ # @return [Object] Returns the model itself
160
+ def self.build_from_hash(attributes)
161
+ new.build_from_hash(attributes)
162
+ end
163
+
164
+ # Builds the object from hash
165
+ # @param [Hash] attributes Model attributes in the form of hash
166
+ # @return [Object] Returns the model itself
167
+ def build_from_hash(attributes)
168
+ return nil unless attributes.is_a?(Hash)
169
+ self.class.openapi_types.each_pair do |key, type|
170
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
171
+ self.send("#{key}=", nil)
172
+ elsif type =~ /\AArray<(.*)>/i
173
+ # check to ensure the input is an array given that the attribute
174
+ # is documented as an array but the input is not
175
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
176
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
177
+ end
178
+ elsif !attributes[self.class.attribute_map[key]].nil?
179
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
180
+ end
181
+ end
182
+
183
+ self
184
+ end
185
+
186
+ # Deserializes the data based on type
187
+ # @param string type Data type
188
+ # @param string value Value to be deserialized
189
+ # @return [Object] Deserialized data
190
+ def _deserialize(type, value)
191
+ case type.to_sym
192
+ when :Time
193
+ Time.parse(value)
194
+ when :Date
195
+ Date.parse(value)
196
+ when :String
197
+ value.to_s
198
+ when :Integer
199
+ value.to_i
200
+ when :Float
201
+ value.to_f
202
+ when :Boolean
203
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
204
+ true
205
+ else
206
+ false
207
+ end
208
+ when :Object
209
+ # generic object (usually a Hash), return directly
210
+ value
211
+ when /\AArray<(?<inner_type>.+)>\z/
212
+ inner_type = Regexp.last_match[:inner_type]
213
+ value.map { |v| _deserialize(inner_type, v) }
214
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
215
+ k_type = Regexp.last_match[:k_type]
216
+ v_type = Regexp.last_match[:v_type]
217
+ {}.tap do |hash|
218
+ value.each do |k, v|
219
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
220
+ end
221
+ end
222
+ else # model
223
+ # models (e.g. Pet) or oneOf
224
+ klass = Svix.const_get(type)
225
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
226
+ end
227
+ end
228
+
229
+ # Returns the string representation of the object
230
+ # @return [String] String presentation of the object
231
+ def to_s
232
+ to_hash.to_s
233
+ end
234
+
235
+ # to_body is an alias to to_hash (backward compatibility)
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_body
238
+ to_hash
239
+ end
240
+
241
+ # Returns the object in the form of hash
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_hash
244
+ hash = {}
245
+ self.class.attribute_map.each_pair do |attr, param|
246
+ value = self.send(attr)
247
+ if value.nil?
248
+ is_nullable = self.class.openapi_nullable.include?(attr)
249
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
250
+ end
251
+
252
+ hash[param] = _to_hash(value)
253
+ end
254
+ hash
255
+ end
256
+
257
+ # Outputs non-array value in the form of hash
258
+ # For object, use to_hash. Otherwise, just return the value
259
+ # @param [Object] value Any valid value
260
+ # @return [Hash] Returns the value in the form of hash
261
+ def _to_hash(value)
262
+ if value.is_a?(Array)
263
+ value.compact.map { |v| _to_hash(v) }
264
+ elsif value.is_a?(Hash)
265
+ {}.tap do |hash|
266
+ value.each { |k, v| hash[k] = _to_hash(v) }
267
+ end
268
+ elsif value.respond_to? :to_hash
269
+ value.to_hash
270
+ else
271
+ value
272
+ end
273
+ end
274
+
275
+ end
276
+
277
+ end
@@ -33,6 +33,9 @@ module Svix
33
33
  # List of free-form tags that can be filtered by when listing messages
34
34
  attr_accessor :tags
35
35
 
36
+ # Extra parameters to pass to Transformations (for future use)
37
+ attr_accessor :transformations_params
38
+
36
39
  # Attribute mapping from ruby-style variable name to JSON key.
37
40
  def self.attribute_map
38
41
  {
@@ -42,7 +45,8 @@ module Svix
42
45
  :'event_type' => :'eventType',
43
46
  :'payload' => :'payload',
44
47
  :'payload_retention_period' => :'payloadRetentionPeriod',
45
- :'tags' => :'tags'
48
+ :'tags' => :'tags',
49
+ :'transformations_params' => :'transformationsParams'
46
50
  }
47
51
  end
48
52
 
@@ -60,7 +64,8 @@ module Svix
60
64
  :'event_type' => :'String',
61
65
  :'payload' => :'Object',
62
66
  :'payload_retention_period' => :'Integer',
63
- :'tags' => :'Array<String>'
67
+ :'tags' => :'Array<String>',
68
+ :'transformations_params' => :'Object'
64
69
  }
65
70
  end
66
71
 
@@ -69,7 +74,8 @@ module Svix
69
74
  Set.new([
70
75
  :'channels',
71
76
  :'event_id',
72
- :'tags'
77
+ :'tags',
78
+ :'transformations_params'
73
79
  ])
74
80
  end
75
81
 
@@ -121,6 +127,10 @@ module Svix
121
127
  self.tags = value
122
128
  end
123
129
  end
130
+
131
+ if attributes.key?(:'transformations_params')
132
+ self.transformations_params = attributes[:'transformations_params']
133
+ end
124
134
  end
125
135
 
126
136
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -294,7 +304,8 @@ module Svix
294
304
  event_type == o.event_type &&
295
305
  payload == o.payload &&
296
306
  payload_retention_period == o.payload_retention_period &&
297
- tags == o.tags
307
+ tags == o.tags &&
308
+ transformations_params == o.transformations_params
298
309
  end
299
310
 
300
311
  # @see the `==` method
@@ -306,7 +317,7 @@ module Svix
306
317
  # Calculates hash code according to all attributes.
307
318
  # @return [Integer] Hash code
308
319
  def hash
309
- [application, channels, event_id, event_type, payload, payload_retention_period, tags].hash
320
+ [application, channels, event_id, event_type, payload, payload_retention_period, tags, transformations_params].hash
310
321
  end
311
322
 
312
323
  # Builds the object from hash
@@ -29,6 +29,8 @@ module Svix
29
29
 
30
30
  attr_accessor :payload
31
31
 
32
+ attr_accessor :tags
33
+
32
34
  attr_accessor :timestamp
33
35
 
34
36
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -39,6 +41,7 @@ module Svix
39
41
  :'event_type' => :'eventType',
40
42
  :'id' => :'id',
41
43
  :'payload' => :'payload',
44
+ :'tags' => :'tags',
42
45
  :'timestamp' => :'timestamp'
43
46
  }
44
47
  end
@@ -56,6 +59,7 @@ module Svix
56
59
  :'event_type' => :'String',
57
60
  :'id' => :'String',
58
61
  :'payload' => :'Object',
62
+ :'tags' => :'Array<String>',
59
63
  :'timestamp' => :'Time'
60
64
  }
61
65
  end
@@ -65,6 +69,7 @@ module Svix
65
69
  Set.new([
66
70
  :'channels',
67
71
  :'event_id',
72
+ :'tags',
68
73
  ])
69
74
  end
70
75
 
@@ -105,6 +110,12 @@ module Svix
105
110
  self.payload = attributes[:'payload']
106
111
  end
107
112
 
113
+ if attributes.key?(:'tags')
114
+ if (value = attributes[:'tags']).is_a?(Array)
115
+ self.tags = value
116
+ end
117
+ end
118
+
108
119
  if attributes.key?(:'timestamp')
109
120
  self.timestamp = attributes[:'timestamp']
110
121
  end
@@ -232,6 +243,12 @@ module Svix
232
243
  @event_type = event_type
233
244
  end
234
245
 
246
+ # Custom attribute writer method with validation
247
+ # @param [Object] tags Value to be assigned
248
+ def tags=(tags)
249
+ @tags = tags
250
+ end
251
+
235
252
  # Checks equality by comparing each attribute.
236
253
  # @param [Object] Object to be compared
237
254
  def ==(o)
@@ -242,6 +259,7 @@ module Svix
242
259
  event_type == o.event_type &&
243
260
  id == o.id &&
244
261
  payload == o.payload &&
262
+ tags == o.tags &&
245
263
  timestamp == o.timestamp
246
264
  end
247
265
 
@@ -254,7 +272,7 @@ module Svix
254
272
  # Calculates hash code according to all attributes.
255
273
  # @return [Integer] Hash code
256
274
  def hash
257
- [channels, event_id, event_type, id, payload, timestamp].hash
275
+ [channels, event_id, event_type, id, payload, tags, timestamp].hash
258
276
  end
259
277
 
260
278
  # Builds the object from hash
@@ -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 MessageStreamOut
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<MessageOut>',
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::MessageStreamOut` 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::MessageStreamOut`. 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