svix 1.15.0 → 1.17.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.
@@ -0,0 +1,237 @@
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 CompletionMessage
18
+ attr_accessor :content
19
+
20
+ attr_accessor :role
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'content' => :'content',
26
+ :'role' => :'role'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'content' => :'String',
39
+ :'role' => :'String'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::CompletionMessage` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::CompletionMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'content')
65
+ self.content = attributes[:'content']
66
+ end
67
+
68
+ if attributes.key?(:'role')
69
+ self.role = attributes[:'role']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ if @content.nil?
78
+ invalid_properties.push('invalid value for "content", content cannot be nil.')
79
+ end
80
+
81
+ if @role.nil?
82
+ invalid_properties.push('invalid value for "role", role cannot be nil.')
83
+ end
84
+
85
+ invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ return false if @content.nil?
92
+ return false if @role.nil?
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ content == o.content &&
102
+ role == o.role
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [content, role].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def self.build_from_hash(attributes)
121
+ new.build_from_hash(attributes)
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ self.class.openapi_types.each_pair do |key, type|
130
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
131
+ self.send("#{key}=", nil)
132
+ elsif type =~ /\AArray<(.*)>/i
133
+ # check to ensure the input is an array given that the attribute
134
+ # is documented as an array but the input is not
135
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
136
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
137
+ end
138
+ elsif !attributes[self.class.attribute_map[key]].nil?
139
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
140
+ end
141
+ end
142
+
143
+ self
144
+ end
145
+
146
+ # Deserializes the data based on type
147
+ # @param string type Data type
148
+ # @param string value Value to be deserialized
149
+ # @return [Object] Deserialized data
150
+ def _deserialize(type, value)
151
+ case type.to_sym
152
+ when :Time
153
+ Time.parse(value)
154
+ when :Date
155
+ Date.parse(value)
156
+ when :String
157
+ value.to_s
158
+ when :Integer
159
+ value.to_i
160
+ when :Float
161
+ value.to_f
162
+ when :Boolean
163
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
164
+ true
165
+ else
166
+ false
167
+ end
168
+ when :Object
169
+ # generic object (usually a Hash), return directly
170
+ value
171
+ when /\AArray<(?<inner_type>.+)>\z/
172
+ inner_type = Regexp.last_match[:inner_type]
173
+ value.map { |v| _deserialize(inner_type, v) }
174
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
175
+ k_type = Regexp.last_match[:k_type]
176
+ v_type = Regexp.last_match[:v_type]
177
+ {}.tap do |hash|
178
+ value.each do |k, v|
179
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
180
+ end
181
+ end
182
+ else # model
183
+ # models (e.g. Pet) or oneOf
184
+ klass = Svix.const_get(type)
185
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
186
+ end
187
+ end
188
+
189
+ # Returns the string representation of the object
190
+ # @return [String] String presentation of the object
191
+ def to_s
192
+ to_hash.to_s
193
+ end
194
+
195
+ # to_body is an alias to to_hash (backward compatibility)
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_body
198
+ to_hash
199
+ end
200
+
201
+ # Returns the object in the form of hash
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_hash
204
+ hash = {}
205
+ self.class.attribute_map.each_pair do |attr, param|
206
+ value = self.send(attr)
207
+ if value.nil?
208
+ is_nullable = self.class.openapi_nullable.include?(attr)
209
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
210
+ end
211
+
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ # Outputs non-array value in the form of hash
218
+ # For object, use to_hash. Otherwise, just return the value
219
+ # @param [Object] value Any valid value
220
+ # @return [Hash] Returns the value in the form of hash
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map { |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+
235
+ end
236
+
237
+ end
@@ -21,8 +21,14 @@ module Svix
21
21
 
22
22
  attr_accessor :background_secondary
23
23
 
24
+ attr_accessor :button_primary
25
+
24
26
  attr_accessor :interactive_accent
25
27
 
28
+ attr_accessor :navigation_accent
29
+
30
+ attr_accessor :primary
31
+
26
32
  attr_accessor :text_danger
27
33
 
28
34
  attr_accessor :text_primary
@@ -33,7 +39,10 @@ module Svix
33
39
  :'background_hover' => :'backgroundHover',
34
40
  :'background_primary' => :'backgroundPrimary',
35
41
  :'background_secondary' => :'backgroundSecondary',
42
+ :'button_primary' => :'buttonPrimary',
36
43
  :'interactive_accent' => :'interactiveAccent',
44
+ :'navigation_accent' => :'navigationAccent',
45
+ :'primary' => :'primary',
37
46
  :'text_danger' => :'textDanger',
38
47
  :'text_primary' => :'textPrimary'
39
48
  }
@@ -50,7 +59,10 @@ module Svix
50
59
  :'background_hover' => :'String',
51
60
  :'background_primary' => :'String',
52
61
  :'background_secondary' => :'String',
62
+ :'button_primary' => :'String',
53
63
  :'interactive_accent' => :'String',
64
+ :'navigation_accent' => :'String',
65
+ :'primary' => :'String',
54
66
  :'text_danger' => :'String',
55
67
  :'text_primary' => :'String'
56
68
  }
@@ -59,12 +71,6 @@ module Svix
59
71
  # List of attributes with nullable: true
60
72
  def self.openapi_nullable
61
73
  Set.new([
62
- :'background_hover',
63
- :'background_primary',
64
- :'background_secondary',
65
- :'interactive_accent',
66
- :'text_danger',
67
- :'text_primary'
68
74
  ])
69
75
  end
70
76
 
@@ -95,10 +101,22 @@ module Svix
95
101
  self.background_secondary = attributes[:'background_secondary']
96
102
  end
97
103
 
104
+ if attributes.key?(:'button_primary')
105
+ self.button_primary = attributes[:'button_primary']
106
+ end
107
+
98
108
  if attributes.key?(:'interactive_accent')
99
109
  self.interactive_accent = attributes[:'interactive_accent']
100
110
  end
101
111
 
112
+ if attributes.key?(:'navigation_accent')
113
+ self.navigation_accent = attributes[:'navigation_accent']
114
+ end
115
+
116
+ if attributes.key?(:'primary')
117
+ self.primary = attributes[:'primary']
118
+ end
119
+
102
120
  if attributes.key?(:'text_danger')
103
121
  self.text_danger = attributes[:'text_danger']
104
122
  end
@@ -129,7 +147,10 @@ module Svix
129
147
  background_hover == o.background_hover &&
130
148
  background_primary == o.background_primary &&
131
149
  background_secondary == o.background_secondary &&
150
+ button_primary == o.button_primary &&
132
151
  interactive_accent == o.interactive_accent &&
152
+ navigation_accent == o.navigation_accent &&
153
+ primary == o.primary &&
133
154
  text_danger == o.text_danger &&
134
155
  text_primary == o.text_primary
135
156
  end
@@ -143,7 +164,7 @@ module Svix
143
164
  # Calculates hash code according to all attributes.
144
165
  # @return [Integer] Hash code
145
166
  def hash
146
- [background_hover, background_primary, background_secondary, interactive_accent, text_danger, text_primary].hash
167
+ [background_hover, background_primary, background_secondary, button_primary, interactive_accent, navigation_accent, primary, text_danger, text_primary].hash
147
168
  end
148
169
 
149
170
  # Builds the object from hash
@@ -0,0 +1,275 @@
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 Duration
18
+ attr_accessor :nanos
19
+
20
+ attr_accessor :secs
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'nanos' => :'nanos',
26
+ :'secs' => :'secs'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'nanos' => :'Integer',
39
+ :'secs' => :'Integer'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::Duration` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::Duration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'nanos')
65
+ self.nanos = attributes[:'nanos']
66
+ end
67
+
68
+ if attributes.key?(:'secs')
69
+ self.secs = attributes[:'secs']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ if @nanos.nil?
78
+ invalid_properties.push('invalid value for "nanos", nanos cannot be nil.')
79
+ end
80
+
81
+ if @nanos < 0
82
+ invalid_properties.push('invalid value for "nanos", must be greater than or equal to 0.')
83
+ end
84
+
85
+ if @secs.nil?
86
+ invalid_properties.push('invalid value for "secs", secs cannot be nil.')
87
+ end
88
+
89
+ if @secs < 0
90
+ invalid_properties.push('invalid value for "secs", must be greater than or equal to 0.')
91
+ end
92
+
93
+ invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+ return false if @nanos.nil?
100
+ return false if @nanos < 0
101
+ return false if @secs.nil?
102
+ return false if @secs < 0
103
+ true
104
+ end
105
+
106
+ # Custom attribute writer method with validation
107
+ # @param [Object] nanos Value to be assigned
108
+ def nanos=(nanos)
109
+ if nanos.nil?
110
+ fail ArgumentError, 'nanos cannot be nil'
111
+ end
112
+
113
+ if nanos < 0
114
+ fail ArgumentError, 'invalid value for "nanos", must be greater than or equal to 0.'
115
+ end
116
+
117
+ @nanos = nanos
118
+ end
119
+
120
+ # Custom attribute writer method with validation
121
+ # @param [Object] secs Value to be assigned
122
+ def secs=(secs)
123
+ if secs.nil?
124
+ fail ArgumentError, 'secs cannot be nil'
125
+ end
126
+
127
+ if secs < 0
128
+ fail ArgumentError, 'invalid value for "secs", must be greater than or equal to 0.'
129
+ end
130
+
131
+ @secs = secs
132
+ end
133
+
134
+ # Checks equality by comparing each attribute.
135
+ # @param [Object] Object to be compared
136
+ def ==(o)
137
+ return true if self.equal?(o)
138
+ self.class == o.class &&
139
+ nanos == o.nanos &&
140
+ secs == o.secs
141
+ end
142
+
143
+ # @see the `==` method
144
+ # @param [Object] Object to be compared
145
+ def eql?(o)
146
+ self == o
147
+ end
148
+
149
+ # Calculates hash code according to all attributes.
150
+ # @return [Integer] Hash code
151
+ def hash
152
+ [nanos, secs].hash
153
+ end
154
+
155
+ # Builds the object from hash
156
+ # @param [Hash] attributes Model attributes in the form of hash
157
+ # @return [Object] Returns the model itself
158
+ def self.build_from_hash(attributes)
159
+ new.build_from_hash(attributes)
160
+ end
161
+
162
+ # Builds the object from hash
163
+ # @param [Hash] attributes Model attributes in the form of hash
164
+ # @return [Object] Returns the model itself
165
+ def build_from_hash(attributes)
166
+ return nil unless attributes.is_a?(Hash)
167
+ self.class.openapi_types.each_pair do |key, type|
168
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
169
+ self.send("#{key}=", nil)
170
+ elsif type =~ /\AArray<(.*)>/i
171
+ # check to ensure the input is an array given that the attribute
172
+ # is documented as an array but the input is not
173
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
174
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
175
+ end
176
+ elsif !attributes[self.class.attribute_map[key]].nil?
177
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
178
+ end
179
+ end
180
+
181
+ self
182
+ end
183
+
184
+ # Deserializes the data based on type
185
+ # @param string type Data type
186
+ # @param string value Value to be deserialized
187
+ # @return [Object] Deserialized data
188
+ def _deserialize(type, value)
189
+ case type.to_sym
190
+ when :Time
191
+ Time.parse(value)
192
+ when :Date
193
+ Date.parse(value)
194
+ when :String
195
+ value.to_s
196
+ when :Integer
197
+ value.to_i
198
+ when :Float
199
+ value.to_f
200
+ when :Boolean
201
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
202
+ true
203
+ else
204
+ false
205
+ end
206
+ when :Object
207
+ # generic object (usually a Hash), return directly
208
+ value
209
+ when /\AArray<(?<inner_type>.+)>\z/
210
+ inner_type = Regexp.last_match[:inner_type]
211
+ value.map { |v| _deserialize(inner_type, v) }
212
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
213
+ k_type = Regexp.last_match[:k_type]
214
+ v_type = Regexp.last_match[:v_type]
215
+ {}.tap do |hash|
216
+ value.each do |k, v|
217
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
218
+ end
219
+ end
220
+ else # model
221
+ # models (e.g. Pet) or oneOf
222
+ klass = Svix.const_get(type)
223
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
224
+ end
225
+ end
226
+
227
+ # Returns the string representation of the object
228
+ # @return [String] String presentation of the object
229
+ def to_s
230
+ to_hash.to_s
231
+ end
232
+
233
+ # to_body is an alias to to_hash (backward compatibility)
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_body
236
+ to_hash
237
+ end
238
+
239
+ # Returns the object in the form of hash
240
+ # @return [Hash] Returns the object in the form of hash
241
+ def to_hash
242
+ hash = {}
243
+ self.class.attribute_map.each_pair do |attr, param|
244
+ value = self.send(attr)
245
+ if value.nil?
246
+ is_nullable = self.class.openapi_nullable.include?(attr)
247
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
248
+ end
249
+
250
+ hash[param] = _to_hash(value)
251
+ end
252
+ hash
253
+ end
254
+
255
+ # Outputs non-array value in the form of hash
256
+ # For object, use to_hash. Otherwise, just return the value
257
+ # @param [Object] value Any valid value
258
+ # @return [Hash] Returns the value in the form of hash
259
+ def _to_hash(value)
260
+ if value.is_a?(Array)
261
+ value.compact.map { |v| _to_hash(v) }
262
+ elsif value.is_a?(Hash)
263
+ {}.tap do |hash|
264
+ value.each { |k, v| hash[k] = _to_hash(v) }
265
+ end
266
+ elsif value.respond_to? :to_hash
267
+ value.to_hash
268
+ else
269
+ value
270
+ end
271
+ end
272
+
273
+ end
274
+
275
+ end
@@ -34,6 +34,8 @@ module Svix
34
34
 
35
35
  attr_accessor :status
36
36
 
37
+ attr_accessor :tags
38
+
37
39
  attr_accessor :timestamp
38
40
 
39
41
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -46,6 +48,7 @@ module Svix
46
48
  :'next_attempt' => :'nextAttempt',
47
49
  :'payload' => :'payload',
48
50
  :'status' => :'status',
51
+ :'tags' => :'tags',
49
52
  :'timestamp' => :'timestamp'
50
53
  }
51
54
  end
@@ -65,6 +68,7 @@ module Svix
65
68
  :'next_attempt' => :'Time',
66
69
  :'payload' => :'Object',
67
70
  :'status' => :'MessageStatus',
71
+ :'tags' => :'Array<String>',
68
72
  :'timestamp' => :'Time'
69
73
  }
70
74
  end
@@ -75,6 +79,7 @@ module Svix
75
79
  :'channels',
76
80
  :'event_id',
77
81
  :'next_attempt',
82
+ :'tags',
78
83
  ])
79
84
  end
80
85
 
@@ -123,6 +128,12 @@ module Svix
123
128
  self.status = attributes[:'status']
124
129
  end
125
130
 
131
+ if attributes.key?(:'tags')
132
+ if (value = attributes[:'tags']).is_a?(Array)
133
+ self.tags = value
134
+ end
135
+ end
136
+
126
137
  if attributes.key?(:'timestamp')
127
138
  self.timestamp = attributes[:'timestamp']
128
139
  end
@@ -255,6 +266,12 @@ module Svix
255
266
  @event_type = event_type
256
267
  end
257
268
 
269
+ # Custom attribute writer method with validation
270
+ # @param [Object] tags Value to be assigned
271
+ def tags=(tags)
272
+ @tags = tags
273
+ end
274
+
258
275
  # Checks equality by comparing each attribute.
259
276
  # @param [Object] Object to be compared
260
277
  def ==(o)
@@ -267,6 +284,7 @@ module Svix
267
284
  next_attempt == o.next_attempt &&
268
285
  payload == o.payload &&
269
286
  status == o.status &&
287
+ tags == o.tags &&
270
288
  timestamp == o.timestamp
271
289
  end
272
290
 
@@ -279,7 +297,7 @@ module Svix
279
297
  # Calculates hash code according to all attributes.
280
298
  # @return [Integer] Hash code
281
299
  def hash
282
- [channels, event_id, event_type, id, next_attempt, payload, status, timestamp].hash
300
+ [channels, event_id, event_type, id, next_attempt, payload, status, tags, timestamp].hash
283
301
  end
284
302
 
285
303
  # Builds the object from hash