svix 0.83.0 → 0.84.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/svix/api/application_api.rb +247 -181
  4. data/lib/svix/api/authentication_api.rb +82 -82
  5. data/lib/svix/api/background_tasks_api.rb +161 -0
  6. data/lib/svix/api/endpoint_api.rb +561 -485
  7. data/lib/svix/api/environment_api.rb +16 -16
  8. data/lib/svix/api/environment_settings_api.rb +7 -10
  9. data/lib/svix/api/event_type_api.rb +152 -81
  10. data/lib/svix/api/health_api.rb +6 -9
  11. data/lib/svix/api/integration_api.rb +123 -134
  12. data/lib/svix/api/message_api.rb +96 -102
  13. data/lib/svix/api/message_attempt_api.rb +382 -406
  14. data/lib/svix/api/statistics_api.rb +107 -45
  15. data/lib/svix/api_client.rb +0 -1
  16. data/lib/svix/application_api.rb +22 -22
  17. data/lib/svix/authentication_api.rb +3 -3
  18. data/lib/svix/configuration.rb +0 -7
  19. data/lib/svix/endpoint_api.rb +16 -16
  20. data/lib/svix/event_type_api.rb +19 -19
  21. data/lib/svix/integration_api.rb +26 -26
  22. data/lib/svix/message_api.rb +4 -4
  23. data/lib/svix/message_attempt_api.rb +8 -8
  24. data/lib/svix/models/app_portal_access_in.rb +1 -0
  25. data/lib/svix/models/application_in.rb +34 -1
  26. data/lib/svix/models/application_out.rb +20 -2
  27. data/lib/svix/models/application_patch.rb +299 -0
  28. data/lib/svix/models/application_stats.rb +0 -1
  29. data/lib/svix/models/{webhook_types.rb → background_task_out.rb} +40 -69
  30. data/lib/svix/models/background_task_out_common.rb +251 -0
  31. data/lib/svix/models/background_task_status.rb +38 -0
  32. data/lib/svix/models/background_task_type.rb +38 -0
  33. data/lib/svix/models/calculate_app_stats_in.rb +255 -0
  34. data/lib/svix/models/endpoint_created_event.rb +5 -0
  35. data/lib/svix/models/endpoint_created_event_data.rb +0 -2
  36. data/lib/svix/models/endpoint_deleted_event.rb +5 -0
  37. data/lib/svix/models/endpoint_deleted_event_data.rb +0 -2
  38. data/lib/svix/models/endpoint_disabled_event.rb +5 -0
  39. data/lib/svix/models/endpoint_disabled_event_data.rb +1 -2
  40. data/lib/svix/models/endpoint_in.rb +19 -10
  41. data/lib/svix/models/endpoint_message_out.rb +1 -0
  42. data/lib/svix/models/endpoint_out.rb +33 -15
  43. data/lib/svix/models/endpoint_patch.rb +405 -0
  44. data/lib/svix/models/endpoint_secret_rotate_in.rb +2 -0
  45. data/lib/svix/models/endpoint_transformation_in.rb +0 -2
  46. data/lib/svix/models/endpoint_transformation_simulate_in.rb +6 -0
  47. data/lib/svix/models/endpoint_update.rb +19 -10
  48. data/lib/svix/models/endpoint_updated_event.rb +5 -0
  49. data/lib/svix/models/endpoint_updated_event_data.rb +0 -2
  50. data/lib/svix/models/event_type_example_out.rb +4 -2
  51. data/lib/svix/models/event_type_patch.rb +275 -0
  52. data/lib/svix/models/event_type_schema_in.rb +0 -1
  53. data/lib/svix/models/http_validation_error.rb +5 -0
  54. data/lib/svix/models/list_response_application_stats.rb +15 -5
  55. data/lib/svix/models/list_response_background_task_out.rb +259 -0
  56. data/lib/svix/models/list_response_integration_out.rb +15 -5
  57. data/lib/svix/models/list_response_message_endpoint_out.rb +15 -5
  58. data/lib/svix/models/message_attempt_exhausted_event.rb +5 -0
  59. data/lib/svix/models/message_attempt_exhausted_event_data.rb +1 -2
  60. data/lib/svix/models/message_attempt_failing_event.rb +5 -0
  61. data/lib/svix/models/message_attempt_failing_event_data.rb +1 -2
  62. data/lib/svix/models/message_attempt_headers_out.rb +27 -1
  63. data/lib/svix/models/message_endpoint_out.rb +45 -29
  64. data/lib/svix/models/message_in.rb +0 -1
  65. data/lib/svix/models/recover_out.rb +251 -0
  66. data/lib/svix/models/replay_out.rb +251 -0
  67. data/lib/svix/models/transformation_http_method.rb +1 -1
  68. data/lib/svix/models/validation_error.rb +4 -0
  69. data/lib/svix/version.rb +1 -1
  70. metadata +14 -3
@@ -20,6 +20,7 @@ module Svix
20
20
 
21
21
  attr_accessor :created_at
22
22
 
23
+ # An example endpoint name
23
24
  attr_accessor :description
24
25
 
25
26
  attr_accessor :disabled
@@ -28,8 +29,6 @@ module Svix
28
29
 
29
30
  attr_accessor :id
30
31
 
31
- attr_accessor :metadata
32
-
33
32
  attr_accessor :next_attempt
34
33
 
35
34
  attr_accessor :rate_limit
@@ -39,6 +38,8 @@ module Svix
39
38
  # Optional unique identifier for the endpoint
40
39
  attr_accessor :uid
41
40
 
41
+ attr_accessor :updated_at
42
+
42
43
  attr_accessor :url
43
44
 
44
45
  attr_accessor :version
@@ -52,11 +53,11 @@ module Svix
52
53
  :'disabled' => :'disabled',
53
54
  :'filter_types' => :'filterTypes',
54
55
  :'id' => :'id',
55
- :'metadata' => :'metadata',
56
56
  :'next_attempt' => :'nextAttempt',
57
57
  :'rate_limit' => :'rateLimit',
58
58
  :'status' => :'status',
59
59
  :'uid' => :'uid',
60
+ :'updated_at' => :'updatedAt',
60
61
  :'url' => :'url',
61
62
  :'version' => :'version'
62
63
  }
@@ -76,11 +77,11 @@ module Svix
76
77
  :'disabled' => :'Boolean',
77
78
  :'filter_types' => :'Array<String>',
78
79
  :'id' => :'String',
79
- :'metadata' => :'Hash<String, String>',
80
80
  :'next_attempt' => :'Time',
81
81
  :'rate_limit' => :'Integer',
82
82
  :'status' => :'MessageStatus',
83
83
  :'uid' => :'String',
84
+ :'updated_at' => :'Time',
84
85
  :'url' => :'String',
85
86
  :'version' => :'Integer'
86
87
  }
@@ -91,7 +92,6 @@ module Svix
91
92
  Set.new([
92
93
  :'channels',
93
94
  :'filter_types',
94
- :'metadata',
95
95
  :'next_attempt',
96
96
  :'rate_limit',
97
97
  :'uid',
@@ -125,8 +125,6 @@ module Svix
125
125
 
126
126
  if attributes.key?(:'description')
127
127
  self.description = attributes[:'description']
128
- else
129
- self.description = ''
130
128
  end
131
129
 
132
130
  if attributes.key?(:'disabled')
@@ -145,12 +143,6 @@ module Svix
145
143
  self.id = attributes[:'id']
146
144
  end
147
145
 
148
- if attributes.key?(:'metadata')
149
- if (value = attributes[:'metadata']).is_a?(Hash)
150
- self.metadata = value
151
- end
152
- end
153
-
154
146
  if attributes.key?(:'next_attempt')
155
147
  self.next_attempt = attributes[:'next_attempt']
156
148
  end
@@ -167,6 +159,10 @@ module Svix
167
159
  self.uid = attributes[:'uid']
168
160
  end
169
161
 
162
+ if attributes.key?(:'updated_at')
163
+ self.updated_at = attributes[:'updated_at']
164
+ end
165
+
170
166
  if attributes.key?(:'url')
171
167
  self.url = attributes[:'url']
172
168
  end
@@ -192,6 +188,10 @@ module Svix
192
188
  invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
193
189
  end
194
190
 
191
+ if @description.nil?
192
+ invalid_properties.push('invalid value for "description", description cannot be nil.')
193
+ end
194
+
195
195
  if !@filter_types.nil? && @filter_types.length < 1
196
196
  invalid_properties.push('invalid value for "filter_types", number of items must be greater than or equal to 1.')
197
197
  end
@@ -200,12 +200,8 @@ module Svix
200
200
  invalid_properties.push('invalid value for "id", id cannot be nil.')
201
201
  end
202
202
 
203
- if !@rate_limit.nil? && @rate_limit > 65535
204
- invalid_properties.push('invalid value for "rate_limit", must be smaller than or equal to 65535.')
205
- end
206
-
207
- if !@rate_limit.nil? && @rate_limit < 1
208
- invalid_properties.push('invalid value for "rate_limit", must be greater than or equal to 1.')
203
+ if !@rate_limit.nil? && @rate_limit < 0
204
+ invalid_properties.push('invalid value for "rate_limit", must be greater than or equal to 0.')
209
205
  end
210
206
 
211
207
  if @status.nil?
@@ -225,6 +221,10 @@ module Svix
225
221
  invalid_properties.push("invalid value for \"uid\", must conform to the pattern #{pattern}.")
226
222
  end
227
223
 
224
+ if @updated_at.nil?
225
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
226
+ end
227
+
228
228
  if @url.nil?
229
229
  invalid_properties.push('invalid value for "url", url cannot be nil.')
230
230
  end
@@ -241,6 +241,10 @@ module Svix
241
241
  invalid_properties.push('invalid value for "version", version cannot be nil.')
242
242
  end
243
243
 
244
+ if @version < 1
245
+ invalid_properties.push('invalid value for "version", must be greater than or equal to 1.')
246
+ end
247
+
244
248
  invalid_properties
245
249
  end
246
250
 
@@ -250,18 +254,20 @@ module Svix
250
254
  return false if !@channels.nil? && @channels.length > 10
251
255
  return false if !@channels.nil? && @channels.length < 1
252
256
  return false if @created_at.nil?
257
+ return false if @description.nil?
253
258
  return false if !@filter_types.nil? && @filter_types.length < 1
254
259
  return false if @id.nil?
255
- return false if !@rate_limit.nil? && @rate_limit > 65535
256
- return false if !@rate_limit.nil? && @rate_limit < 1
260
+ return false if !@rate_limit.nil? && @rate_limit < 0
257
261
  return false if @status.nil?
258
262
  return false if !@uid.nil? && @uid.to_s.length > 256
259
263
  return false if !@uid.nil? && @uid.to_s.length < 1
260
264
  return false if !@uid.nil? && @uid !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
265
+ return false if @updated_at.nil?
261
266
  return false if @url.nil?
262
267
  return false if @url.to_s.length > 65536
263
268
  return false if @url.to_s.length < 1
264
269
  return false if @version.nil?
270
+ return false if @version < 1
265
271
  true
266
272
  end
267
273
 
@@ -292,12 +298,8 @@ module Svix
292
298
  # Custom attribute writer method with validation
293
299
  # @param [Object] rate_limit Value to be assigned
294
300
  def rate_limit=(rate_limit)
295
- if !rate_limit.nil? && rate_limit > 65535
296
- fail ArgumentError, 'invalid value for "rate_limit", must be smaller than or equal to 65535.'
297
- end
298
-
299
- if !rate_limit.nil? && rate_limit < 1
300
- fail ArgumentError, 'invalid value for "rate_limit", must be greater than or equal to 1.'
301
+ if !rate_limit.nil? && rate_limit < 0
302
+ fail ArgumentError, 'invalid value for "rate_limit", must be greater than or equal to 0.'
301
303
  end
302
304
 
303
305
  @rate_limit = rate_limit
@@ -340,6 +342,20 @@ module Svix
340
342
  @url = url
341
343
  end
342
344
 
345
+ # Custom attribute writer method with validation
346
+ # @param [Object] version Value to be assigned
347
+ def version=(version)
348
+ if version.nil?
349
+ fail ArgumentError, 'version cannot be nil'
350
+ end
351
+
352
+ if version < 1
353
+ fail ArgumentError, 'invalid value for "version", must be greater than or equal to 1.'
354
+ end
355
+
356
+ @version = version
357
+ end
358
+
343
359
  # Checks equality by comparing each attribute.
344
360
  # @param [Object] Object to be compared
345
361
  def ==(o)
@@ -351,11 +367,11 @@ module Svix
351
367
  disabled == o.disabled &&
352
368
  filter_types == o.filter_types &&
353
369
  id == o.id &&
354
- metadata == o.metadata &&
355
370
  next_attempt == o.next_attempt &&
356
371
  rate_limit == o.rate_limit &&
357
372
  status == o.status &&
358
373
  uid == o.uid &&
374
+ updated_at == o.updated_at &&
359
375
  url == o.url &&
360
376
  version == o.version
361
377
  end
@@ -369,7 +385,7 @@ module Svix
369
385
  # Calculates hash code according to all attributes.
370
386
  # @return [Integer] Hash code
371
387
  def hash
372
- [channels, created_at, description, disabled, filter_types, id, metadata, next_attempt, rate_limit, status, uid, url, version].hash
388
+ [channels, created_at, description, disabled, filter_types, id, next_attempt, rate_limit, status, uid, updated_at, url, version].hash
373
389
  end
374
390
 
375
391
  # Builds the object from hash
@@ -27,7 +27,6 @@ module Svix
27
27
 
28
28
  attr_accessor :payload
29
29
 
30
- # The retention period for the payload (in days).
31
30
  attr_accessor :payload_retention_period
32
31
 
33
32
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -0,0 +1,251 @@
1
+ =begin
2
+ #Svix API
3
+
4
+ #Welcome to the Svix API documentation! Useful links: [Homepage](https://www.svix.com) | [Support email](mailto:support+docs@svix.com) | [Blog](https://www.svix.com/blog/) | [Slack Community](https://www.svix.com/slack/) # Introduction This is the reference documentation and schemas for the [Svix webhook service](https://www.svix.com) API. For tutorials and other documentation please refer to [the documentation](https://docs.svix.com). ## Main concepts In Svix you have four important entities you will be interacting with: - `messages`: these are the webhooks being sent. They can have contents and a few other properties. - `application`: this is where `messages` are sent to. Usually you want to create one application for each user on your platform. - `endpoint`: endpoints are the URLs messages will be sent to. Each application can have multiple `endpoints` and each message sent to that application will be sent to all of them (unless they are not subscribed to the sent event type). - `event-type`: event types are identifiers denoting the type of the message being sent. Event types are primarily used to decide which events are sent to which endpoint. ## Authentication Get your authentication token (`AUTH_TOKEN`) from the [Svix dashboard](https://dashboard.svix.com) and use it as part of the `Authorization` header as such: `Authorization: Bearer ${AUTH_TOKEN}`. <SecurityDefinitions /> ## Code samples The code samples assume you already have the respective libraries installed and you know how to use them. For the latest information on how to do that, please refer to [the documentation](https://docs.svix.com/). ## Idempotency Svix supports [idempotency](https://en.wikipedia.org/wiki/Idempotence) for safely retrying requests without accidentally performing the same operation twice. This is useful when an API call is disrupted in transit and you do not receive a response. To perform an idempotent request, pass the idempotency key in the `Idempotency-Key` header to the request. The idempotency key should be a unique value generated by the client. You can create the key in however way you like, though we suggest using UUID v4, or any other string with enough entropy to avoid collisions. Svix's idempotency works by saving the resulting status code and body of the first request made for any given idempotency key for any successful request. Subsequent requests with the same key return the same result. Please note that idempotency is only supported for `POST` requests. ## Cross-Origin Resource Sharing This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.
5
+
6
+ The version of the OpenAPI document: 1.4
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 RecoverOut
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::RecoverOut` 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::RecoverOut`. 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