svix 1.13.0 → 1.15.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.
@@ -19,6 +19,8 @@ module Svix
19
19
  ENDPOINT_RECOVER = "endpoint.recover".freeze
20
20
  APPLICATION_STATS = "application.stats".freeze
21
21
  MESSAGE_BROADCAST = "message.broadcast".freeze
22
+ SDK_GENERATE = "sdk.generate".freeze
23
+ EVENT_TYPE_AGGREGATE = "event-type.aggregate".freeze
22
24
 
23
25
  # Builds the enum from string
24
26
  # @param [String] The enum value in the form of the string
@@ -0,0 +1,251 @@
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 ExportEventTypeOut
18
+ attr_accessor :id
19
+
20
+ attr_accessor :status
21
+
22
+ attr_accessor :task
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'id' => :'id',
28
+ :'status' => :'status',
29
+ :'task' => :'task'
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
+ :'id' => :'String',
42
+ :'status' => :'BackgroundTaskStatus',
43
+ :'task' => :'BackgroundTaskType'
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::ExportEventTypeOut` 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::ExportEventTypeOut`. 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?(:'id')
69
+ self.id = attributes[:'id']
70
+ end
71
+
72
+ if attributes.key?(:'status')
73
+ self.status = attributes[:'status']
74
+ end
75
+
76
+ if attributes.key?(:'task')
77
+ self.task = attributes[:'task']
78
+ end
79
+ end
80
+
81
+ # Show invalid properties with the reasons. Usually used together with valid?
82
+ # @return Array for valid properties with the reasons
83
+ def list_invalid_properties
84
+ invalid_properties = Array.new
85
+ if @id.nil?
86
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
87
+ end
88
+
89
+ if @status.nil?
90
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
91
+ end
92
+
93
+ if @task.nil?
94
+ invalid_properties.push('invalid value for "task", task cannot be nil.')
95
+ end
96
+
97
+ invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ return false if @id.nil?
104
+ return false if @status.nil?
105
+ return false if @task.nil?
106
+ true
107
+ end
108
+
109
+ # Checks equality by comparing each attribute.
110
+ # @param [Object] Object to be compared
111
+ def ==(o)
112
+ return true if self.equal?(o)
113
+ self.class == o.class &&
114
+ id == o.id &&
115
+ status == o.status &&
116
+ task == o.task
117
+ end
118
+
119
+ # @see the `==` method
120
+ # @param [Object] Object to be compared
121
+ def eql?(o)
122
+ self == o
123
+ end
124
+
125
+ # Calculates hash code according to all attributes.
126
+ # @return [Integer] Hash code
127
+ def hash
128
+ [id, status, task].hash
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def self.build_from_hash(attributes)
135
+ new.build_from_hash(attributes)
136
+ end
137
+
138
+ # Builds the object from hash
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ # @return [Object] Returns the model itself
141
+ def build_from_hash(attributes)
142
+ return nil unless attributes.is_a?(Hash)
143
+ self.class.openapi_types.each_pair do |key, type|
144
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
145
+ self.send("#{key}=", nil)
146
+ elsif type =~ /\AArray<(.*)>/i
147
+ # check to ensure the input is an array given that the attribute
148
+ # is documented as an array but the input is not
149
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
150
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
151
+ end
152
+ elsif !attributes[self.class.attribute_map[key]].nil?
153
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
154
+ end
155
+ end
156
+
157
+ self
158
+ end
159
+
160
+ # Deserializes the data based on type
161
+ # @param string type Data type
162
+ # @param string value Value to be deserialized
163
+ # @return [Object] Deserialized data
164
+ def _deserialize(type, value)
165
+ case type.to_sym
166
+ when :Time
167
+ Time.parse(value)
168
+ when :Date
169
+ Date.parse(value)
170
+ when :String
171
+ value.to_s
172
+ when :Integer
173
+ value.to_i
174
+ when :Float
175
+ value.to_f
176
+ when :Boolean
177
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
178
+ true
179
+ else
180
+ false
181
+ end
182
+ when :Object
183
+ # generic object (usually a Hash), return directly
184
+ value
185
+ when /\AArray<(?<inner_type>.+)>\z/
186
+ inner_type = Regexp.last_match[:inner_type]
187
+ value.map { |v| _deserialize(inner_type, v) }
188
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
189
+ k_type = Regexp.last_match[:k_type]
190
+ v_type = Regexp.last_match[:v_type]
191
+ {}.tap do |hash|
192
+ value.each do |k, v|
193
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
194
+ end
195
+ end
196
+ else # model
197
+ # models (e.g. Pet) or oneOf
198
+ klass = Svix.const_get(type)
199
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
200
+ end
201
+ end
202
+
203
+ # Returns the string representation of the object
204
+ # @return [String] String presentation of the object
205
+ def to_s
206
+ to_hash.to_s
207
+ end
208
+
209
+ # to_body is an alias to to_hash (backward compatibility)
210
+ # @return [Hash] Returns the object in the form of hash
211
+ def to_body
212
+ to_hash
213
+ end
214
+
215
+ # Returns the object in the form of hash
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_hash
218
+ hash = {}
219
+ self.class.attribute_map.each_pair do |attr, param|
220
+ value = self.send(attr)
221
+ if value.nil?
222
+ is_nullable = self.class.openapi_nullable.include?(attr)
223
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
224
+ end
225
+
226
+ hash[param] = _to_hash(value)
227
+ end
228
+ hash
229
+ end
230
+
231
+ # Outputs non-array value in the form of hash
232
+ # For object, use to_hash. Otherwise, just return the value
233
+ # @param [Object] value Any valid value
234
+ # @return [Hash] Returns the value in the form of hash
235
+ def _to_hash(value)
236
+ if value.is_a?(Array)
237
+ value.compact.map { |v| _to_hash(v) }
238
+ elsif value.is_a?(Hash)
239
+ {}.tap do |hash|
240
+ value.each { |k, v| hash[k] = _to_hash(v) }
241
+ end
242
+ elsif value.respond_to? :to_hash
243
+ value.to_hash
244
+ else
245
+ value
246
+ end
247
+ end
248
+
249
+ end
250
+
251
+ 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
@@ -15,6 +15,8 @@ require 'time'
15
15
 
16
16
  module Svix
17
17
  class MessageAttemptHeadersOut
18
+ attr_accessor :response_headers
19
+
18
20
  attr_accessor :sensitive
19
21
 
20
22
  attr_accessor :sent_headers
@@ -22,6 +24,7 @@ module Svix
22
24
  # Attribute mapping from ruby-style variable name to JSON key.
23
25
  def self.attribute_map
24
26
  {
27
+ :'response_headers' => :'responseHeaders',
25
28
  :'sensitive' => :'sensitive',
26
29
  :'sent_headers' => :'sentHeaders'
27
30
  }
@@ -35,6 +38,7 @@ module Svix
35
38
  # Attribute type mapping.
36
39
  def self.openapi_types
37
40
  {
41
+ :'response_headers' => :'Array<Array<String>>',
38
42
  :'sensitive' => :'Array<String>',
39
43
  :'sent_headers' => :'Hash<String, String>'
40
44
  }
@@ -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
+ :'response_headers',
46
51
  ])
47
52
  end
48
53
 
@@ -61,6 +66,12 @@ module Svix
61
66
  h[k.to_sym] = v
62
67
  }
63
68
 
69
+ if attributes.key?(:'response_headers')
70
+ if (value = attributes[:'response_headers']).is_a?(Array)
71
+ self.response_headers = value
72
+ end
73
+ end
74
+
64
75
  if attributes.key?(:'sensitive')
65
76
  if (value = attributes[:'sensitive']).is_a?(Array)
66
77
  self.sensitive = value
@@ -112,6 +123,7 @@ module Svix
112
123
  def ==(o)
113
124
  return true if self.equal?(o)
114
125
  self.class == o.class &&
126
+ response_headers == o.response_headers &&
115
127
  sensitive == o.sensitive &&
116
128
  sent_headers == o.sent_headers
117
129
  end
@@ -125,7 +137,7 @@ module Svix
125
137
  # Calculates hash code according to all attributes.
126
138
  # @return [Integer] Hash code
127
139
  def hash
128
- [sensitive, sent_headers].hash
140
+ [response_headers, sensitive, sent_headers].hash
129
141
  end
130
142
 
131
143
  # 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,9 @@ 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
+
33
36
  # Attribute mapping from ruby-style variable name to JSON key.
34
37
  def self.attribute_map
35
38
  {
@@ -38,7 +41,8 @@ module Svix
38
41
  :'event_id' => :'eventId',
39
42
  :'event_type' => :'eventType',
40
43
  :'payload' => :'payload',
41
- :'payload_retention_period' => :'payloadRetentionPeriod'
44
+ :'payload_retention_period' => :'payloadRetentionPeriod',
45
+ :'tags' => :'tags'
42
46
  }
43
47
  end
44
48
 
@@ -55,7 +59,8 @@ module Svix
55
59
  :'event_id' => :'String',
56
60
  :'event_type' => :'String',
57
61
  :'payload' => :'Object',
58
- :'payload_retention_period' => :'Integer'
62
+ :'payload_retention_period' => :'Integer',
63
+ :'tags' => :'Array<String>'
59
64
  }
60
65
  end
61
66
 
@@ -64,6 +69,7 @@ module Svix
64
69
  Set.new([
65
70
  :'channels',
66
71
  :'event_id',
72
+ :'tags'
67
73
  ])
68
74
  end
69
75
 
@@ -109,6 +115,12 @@ module Svix
109
115
  else
110
116
  self.payload_retention_period = 90
111
117
  end
118
+
119
+ if attributes.key?(:'tags')
120
+ if (value = attributes[:'tags']).is_a?(Array)
121
+ self.tags = value
122
+ end
123
+ end
112
124
  end
113
125
 
114
126
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -161,6 +173,14 @@ module Svix
161
173
  invalid_properties.push('invalid value for "payload_retention_period", must be greater than or equal to 5.')
162
174
  end
163
175
 
176
+ if !@tags.nil? && @tags.length > 5
177
+ invalid_properties.push('invalid value for "tags", number of items must be less than or equal to 5.')
178
+ end
179
+
180
+ if !@tags.nil? && @tags.length < 1
181
+ invalid_properties.push('invalid value for "tags", number of items must be greater than or equal to 1.')
182
+ end
183
+
164
184
  invalid_properties
165
185
  end
166
186
 
@@ -178,6 +198,8 @@ module Svix
178
198
  return false if @payload.nil?
179
199
  return false if !@payload_retention_period.nil? && @payload_retention_period > 90
180
200
  return false if !@payload_retention_period.nil? && @payload_retention_period < 5
201
+ return false if !@tags.nil? && @tags.length > 5
202
+ return false if !@tags.nil? && @tags.length < 1
181
203
  true
182
204
  end
183
205
 
@@ -247,6 +269,20 @@ module Svix
247
269
  @payload_retention_period = payload_retention_period
248
270
  end
249
271
 
272
+ # Custom attribute writer method with validation
273
+ # @param [Object] tags Value to be assigned
274
+ def tags=(tags)
275
+ if !tags.nil? && tags.length > 5
276
+ fail ArgumentError, 'invalid value for "tags", number of items must be less than or equal to 5.'
277
+ end
278
+
279
+ if !tags.nil? && tags.length < 1
280
+ fail ArgumentError, 'invalid value for "tags", number of items must be greater than or equal to 1.'
281
+ end
282
+
283
+ @tags = tags
284
+ end
285
+
250
286
  # Checks equality by comparing each attribute.
251
287
  # @param [Object] Object to be compared
252
288
  def ==(o)
@@ -257,7 +293,8 @@ module Svix
257
293
  event_id == o.event_id &&
258
294
  event_type == o.event_type &&
259
295
  payload == o.payload &&
260
- payload_retention_period == o.payload_retention_period
296
+ payload_retention_period == o.payload_retention_period &&
297
+ tags == o.tags
261
298
  end
262
299
 
263
300
  # @see the `==` method
@@ -269,7 +306,7 @@ module Svix
269
306
  # Calculates hash code according to all attributes.
270
307
  # @return [Integer] Hash code
271
308
  def hash
272
- [application, channels, event_id, event_type, payload, payload_retention_period].hash
309
+ [application, channels, event_id, event_type, payload, payload_retention_period, tags].hash
273
310
  end
274
311
 
275
312
  # Builds the object from hash