svix 1.14.0 → 1.16.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
@@ -21,6 +21,8 @@ module Svix
21
21
  # The attempt's ID
22
22
  attr_accessor :id
23
23
 
24
+ attr_accessor :msg
25
+
24
26
  # The msg's ID
25
27
  attr_accessor :msg_id
26
28
 
@@ -41,6 +43,7 @@ module Svix
41
43
  {
42
44
  :'endpoint_id' => :'endpointId',
43
45
  :'id' => :'id',
46
+ :'msg' => :'msg',
44
47
  :'msg_id' => :'msgId',
45
48
  :'response' => :'response',
46
49
  :'response_status_code' => :'responseStatusCode',
@@ -61,6 +64,7 @@ module Svix
61
64
  {
62
65
  :'endpoint_id' => :'String',
63
66
  :'id' => :'String',
67
+ :'msg' => :'MessageOut',
64
68
  :'msg_id' => :'String',
65
69
  :'response' => :'String',
66
70
  :'response_status_code' => :'Integer',
@@ -100,6 +104,10 @@ module Svix
100
104
  self.id = attributes[:'id']
101
105
  end
102
106
 
107
+ if attributes.key?(:'msg')
108
+ self.msg = attributes[:'msg']
109
+ end
110
+
103
111
  if attributes.key?(:'msg_id')
104
112
  self.msg_id = attributes[:'msg_id']
105
113
  end
@@ -222,6 +230,7 @@ module Svix
222
230
  self.class == o.class &&
223
231
  endpoint_id == o.endpoint_id &&
224
232
  id == o.id &&
233
+ msg == o.msg &&
225
234
  msg_id == o.msg_id &&
226
235
  response == o.response &&
227
236
  response_status_code == o.response_status_code &&
@@ -240,7 +249,7 @@ module Svix
240
249
  # Calculates hash code according to all attributes.
241
250
  # @return [Integer] Hash code
242
251
  def hash
243
- [endpoint_id, id, msg_id, response, response_status_code, status, timestamp, trigger_type, url].hash
252
+ [endpoint_id, id, msg, msg_id, response, response_status_code, status, timestamp, trigger_type, url].hash
244
253
  end
245
254
 
246
255
  # Builds the object from hash
@@ -21,6 +21,8 @@ module Svix
21
21
  # The attempt's ID
22
22
  attr_accessor :id
23
23
 
24
+ attr_accessor :msg
25
+
24
26
  # The msg's ID
25
27
  attr_accessor :msg_id
26
28
 
@@ -41,6 +43,7 @@ module Svix
41
43
  {
42
44
  :'endpoint_id' => :'endpointId',
43
45
  :'id' => :'id',
46
+ :'msg' => :'msg',
44
47
  :'msg_id' => :'msgId',
45
48
  :'response' => :'response',
46
49
  :'response_status_code' => :'responseStatusCode',
@@ -61,6 +64,7 @@ module Svix
61
64
  {
62
65
  :'endpoint_id' => :'String',
63
66
  :'id' => :'String',
67
+ :'msg' => :'MessageOut',
64
68
  :'msg_id' => :'String',
65
69
  :'response' => :'String',
66
70
  :'response_status_code' => :'Integer',
@@ -100,6 +104,10 @@ module Svix
100
104
  self.id = attributes[:'id']
101
105
  end
102
106
 
107
+ if attributes.key?(:'msg')
108
+ self.msg = attributes[:'msg']
109
+ end
110
+
103
111
  if attributes.key?(:'msg_id')
104
112
  self.msg_id = attributes[:'msg_id']
105
113
  end
@@ -222,6 +230,7 @@ module Svix
222
230
  self.class == o.class &&
223
231
  endpoint_id == o.endpoint_id &&
224
232
  id == o.id &&
233
+ msg == o.msg &&
225
234
  msg_id == o.msg_id &&
226
235
  response == o.response &&
227
236
  response_status_code == o.response_status_code &&
@@ -240,7 +249,7 @@ module Svix
240
249
  # Calculates hash code according to all attributes.
241
250
  # @return [Integer] Hash code
242
251
  def hash
243
- [endpoint_id, id, msg_id, response, response_status_code, status, timestamp, trigger_type, url].hash
252
+ [endpoint_id, id, msg, msg_id, response, response_status_code, status, timestamp, trigger_type, url].hash
244
253
  end
245
254
 
246
255
  # Builds the object from hash
@@ -30,6 +30,12 @@ module Svix
30
30
 
31
31
  attr_accessor :payload_retention_period
32
32
 
33
+ # List of free-form tags that can be filtered by when listing messages
34
+ attr_accessor :tags
35
+
36
+ # Extra parameters to pass to Transformations (for future use)
37
+ attr_accessor :transformations_params
38
+
33
39
  # Attribute mapping from ruby-style variable name to JSON key.
34
40
  def self.attribute_map
35
41
  {
@@ -38,7 +44,9 @@ module Svix
38
44
  :'event_id' => :'eventId',
39
45
  :'event_type' => :'eventType',
40
46
  :'payload' => :'payload',
41
- :'payload_retention_period' => :'payloadRetentionPeriod'
47
+ :'payload_retention_period' => :'payloadRetentionPeriod',
48
+ :'tags' => :'tags',
49
+ :'transformations_params' => :'transformationsParams'
42
50
  }
43
51
  end
44
52
 
@@ -55,7 +63,9 @@ module Svix
55
63
  :'event_id' => :'String',
56
64
  :'event_type' => :'String',
57
65
  :'payload' => :'Object',
58
- :'payload_retention_period' => :'Integer'
66
+ :'payload_retention_period' => :'Integer',
67
+ :'tags' => :'Array<String>',
68
+ :'transformations_params' => :'Object'
59
69
  }
60
70
  end
61
71
 
@@ -64,6 +74,8 @@ module Svix
64
74
  Set.new([
65
75
  :'channels',
66
76
  :'event_id',
77
+ :'tags',
78
+ :'transformations_params'
67
79
  ])
68
80
  end
69
81
 
@@ -109,6 +121,16 @@ module Svix
109
121
  else
110
122
  self.payload_retention_period = 90
111
123
  end
124
+
125
+ if attributes.key?(:'tags')
126
+ if (value = attributes[:'tags']).is_a?(Array)
127
+ self.tags = value
128
+ end
129
+ end
130
+
131
+ if attributes.key?(:'transformations_params')
132
+ self.transformations_params = attributes[:'transformations_params']
133
+ end
112
134
  end
113
135
 
114
136
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -161,6 +183,14 @@ module Svix
161
183
  invalid_properties.push('invalid value for "payload_retention_period", must be greater than or equal to 5.')
162
184
  end
163
185
 
186
+ if !@tags.nil? && @tags.length > 5
187
+ invalid_properties.push('invalid value for "tags", number of items must be less than or equal to 5.')
188
+ end
189
+
190
+ if !@tags.nil? && @tags.length < 1
191
+ invalid_properties.push('invalid value for "tags", number of items must be greater than or equal to 1.')
192
+ end
193
+
164
194
  invalid_properties
165
195
  end
166
196
 
@@ -178,6 +208,8 @@ module Svix
178
208
  return false if @payload.nil?
179
209
  return false if !@payload_retention_period.nil? && @payload_retention_period > 90
180
210
  return false if !@payload_retention_period.nil? && @payload_retention_period < 5
211
+ return false if !@tags.nil? && @tags.length > 5
212
+ return false if !@tags.nil? && @tags.length < 1
181
213
  true
182
214
  end
183
215
 
@@ -247,6 +279,20 @@ module Svix
247
279
  @payload_retention_period = payload_retention_period
248
280
  end
249
281
 
282
+ # Custom attribute writer method with validation
283
+ # @param [Object] tags Value to be assigned
284
+ def tags=(tags)
285
+ if !tags.nil? && tags.length > 5
286
+ fail ArgumentError, 'invalid value for "tags", number of items must be less than or equal to 5.'
287
+ end
288
+
289
+ if !tags.nil? && tags.length < 1
290
+ fail ArgumentError, 'invalid value for "tags", number of items must be greater than or equal to 1.'
291
+ end
292
+
293
+ @tags = tags
294
+ end
295
+
250
296
  # Checks equality by comparing each attribute.
251
297
  # @param [Object] Object to be compared
252
298
  def ==(o)
@@ -257,7 +303,9 @@ module Svix
257
303
  event_id == o.event_id &&
258
304
  event_type == o.event_type &&
259
305
  payload == o.payload &&
260
- payload_retention_period == o.payload_retention_period
306
+ payload_retention_period == o.payload_retention_period &&
307
+ tags == o.tags &&
308
+ transformations_params == o.transformations_params
261
309
  end
262
310
 
263
311
  # @see the `==` method
@@ -269,7 +317,7 @@ module Svix
269
317
  # Calculates hash code according to all attributes.
270
318
  # @return [Integer] Hash code
271
319
  def hash
272
- [application, channels, event_id, event_type, payload, payload_retention_period].hash
320
+ [application, channels, event_id, event_type, payload, payload_retention_period, tags, transformations_params].hash
273
321
  end
274
322
 
275
323
  # Builds the object from hash