svix 1.39.0 → 1.40.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,254 @@
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
+ Generator version: 7.9.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Svix
17
+ class StreamEventTypePatch
18
+ attr_accessor :description
19
+
20
+ # The event type's name
21
+ attr_accessor :name
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'description' => :'description',
27
+ :'name' => :'name'
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
+ :'description' => :'String',
40
+ :'name' => :'String'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ :'description',
48
+ :'name'
49
+ ])
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if (!attributes.is_a?(Hash))
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::StreamEventTypePatch` initialize method"
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!self.class.attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::StreamEventTypePatch`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'description')
68
+ self.description = attributes[:'description']
69
+ else
70
+ self.description = nil
71
+ end
72
+
73
+ if attributes.key?(:'name')
74
+ self.name = attributes[:'name']
75
+ end
76
+ end
77
+
78
+ # Show invalid properties with the reasons. Usually used together with valid?
79
+ # @return Array for valid properties with the reasons
80
+ def list_invalid_properties
81
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
82
+ invalid_properties = Array.new
83
+ if !@name.nil? && @name.to_s.length > 256
84
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 256.')
85
+ end
86
+
87
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
88
+ if !@name.nil? && @name !~ pattern
89
+ invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
90
+ end
91
+
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ warn '[DEPRECATED] the `valid?` method is obsolete'
99
+ return false if !@name.nil? && @name.to_s.length > 256
100
+ return false if !@name.nil? && @name !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
101
+ true
102
+ end
103
+
104
+ # Custom attribute writer method with validation
105
+ # @param [Object] name Value to be assigned
106
+ def name=(name)
107
+ if !name.nil? && name.to_s.length > 256
108
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 256.'
109
+ end
110
+
111
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
112
+ if !name.nil? && name !~ pattern
113
+ fail ArgumentError, "invalid value for \"name\", must conform to the pattern #{pattern}."
114
+ end
115
+
116
+ @name = name
117
+ end
118
+
119
+ # Checks equality by comparing each attribute.
120
+ # @param [Object] Object to be compared
121
+ def ==(o)
122
+ return true if self.equal?(o)
123
+ self.class == o.class &&
124
+ description == o.description &&
125
+ name == o.name
126
+ end
127
+
128
+ # @see the `==` method
129
+ # @param [Object] Object to be compared
130
+ def eql?(o)
131
+ self == o
132
+ end
133
+
134
+ # Calculates hash code according to all attributes.
135
+ # @return [Integer] Hash code
136
+ def hash
137
+ [description, name].hash
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 self.build_from_hash(attributes)
144
+ return nil unless attributes.is_a?(Hash)
145
+ attributes = attributes.transform_keys(&:to_sym)
146
+ transformed_hash = {}
147
+ openapi_types.each_pair do |key, type|
148
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
149
+ transformed_hash["#{key}"] = nil
150
+ elsif type =~ /\AArray<(.*)>/i
151
+ # check to ensure the input is an array given that the attribute
152
+ # is documented as an array but the input is not
153
+ if attributes[attribute_map[key]].is_a?(Array)
154
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
155
+ end
156
+ elsif !attributes[attribute_map[key]].nil?
157
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
158
+ end
159
+ end
160
+ new(transformed_hash)
161
+ end
162
+
163
+ # Deserializes the data based on type
164
+ # @param string type Data type
165
+ # @param string value Value to be deserialized
166
+ # @return [Object] Deserialized data
167
+ def self._deserialize(type, value)
168
+ case type.to_sym
169
+ when :Time
170
+ Time.parse(value)
171
+ when :Date
172
+ Date.parse(value)
173
+ when :String
174
+ value.to_s
175
+ when :Integer
176
+ value.to_i
177
+ when :Float
178
+ value.to_f
179
+ when :Boolean
180
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
181
+ true
182
+ else
183
+ false
184
+ end
185
+ when :Object
186
+ # generic object (usually a Hash), return directly
187
+ value
188
+ when /\AArray<(?<inner_type>.+)>\z/
189
+ inner_type = Regexp.last_match[:inner_type]
190
+ value.map { |v| _deserialize(inner_type, v) }
191
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
192
+ k_type = Regexp.last_match[:k_type]
193
+ v_type = Regexp.last_match[:v_type]
194
+ {}.tap do |hash|
195
+ value.each do |k, v|
196
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
197
+ end
198
+ end
199
+ else # model
200
+ # models (e.g. Pet) or oneOf
201
+ klass = Svix.const_get(type)
202
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
203
+ end
204
+ end
205
+
206
+ # Returns the string representation of the object
207
+ # @return [String] String presentation of the object
208
+ def to_s
209
+ to_hash.to_s
210
+ end
211
+
212
+ # to_body is an alias to to_hash (backward compatibility)
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_body
215
+ to_hash
216
+ end
217
+
218
+ # Returns the object in the form of hash
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_hash
221
+ hash = {}
222
+ self.class.attribute_map.each_pair do |attr, param|
223
+ value = self.send(attr)
224
+ if value.nil?
225
+ is_nullable = self.class.openapi_nullable.include?(attr)
226
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
227
+ end
228
+
229
+ hash[param] = _to_hash(value)
230
+ end
231
+ hash
232
+ end
233
+
234
+ # Outputs non-array value in the form of hash
235
+ # For object, use to_hash. Otherwise, just return the value
236
+ # @param [Object] value Any valid value
237
+ # @return [Hash] Returns the value in the form of hash
238
+ def _to_hash(value)
239
+ if value.is_a?(Array)
240
+ value.compact.map { |v| _to_hash(v) }
241
+ elsif value.is_a?(Hash)
242
+ {}.tap do |hash|
243
+ value.each { |k, v| hash[k] = _to_hash(v) }
244
+ end
245
+ elsif value.respond_to? :to_hash
246
+ value.to_hash
247
+ else
248
+ value
249
+ end
250
+ end
251
+
252
+ end
253
+
254
+ end
data/lib/svix/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Svix
4
- VERSION = "1.39.0"
4
+ VERSION = "1.40.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svix
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.39.0
4
+ version: 1.40.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Svix
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-06 00:00:00.000000000 Z
11
+ date: 2024-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -84,9 +84,9 @@ files:
84
84
  - lib/svix/api/integration_api.rb
85
85
  - lib/svix/api/message_api.rb
86
86
  - lib/svix/api/message_attempt_api.rb
87
- - lib/svix/api/sink_api.rb
88
87
  - lib/svix/api/statistics_api.rb
89
88
  - lib/svix/api/stream_api.rb
89
+ - lib/svix/api/stream_event_types_api.rb
90
90
  - lib/svix/api/transformation_template_api.rb
91
91
  - lib/svix/api/webhook_endpoint_api.rb
92
92
  - lib/svix/api_client.rb
@@ -202,6 +202,7 @@ files:
202
202
  - lib/svix/models/list_response_message_out.rb
203
203
  - lib/svix/models/list_response_operational_webhook_endpoint_out.rb
204
204
  - lib/svix/models/list_response_sink_out.rb
205
+ - lib/svix/models/list_response_stream_event_type_out.rb
205
206
  - lib/svix/models/list_response_stream_out.rb
206
207
  - lib/svix/models/list_response_stream_sink_out.rb
207
208
  - lib/svix/models/list_response_template_out.rb
@@ -264,6 +265,9 @@ files:
264
265
  - lib/svix/models/snowflake_config.rb
265
266
  - lib/svix/models/statistics_period.rb
266
267
  - lib/svix/models/status_code_class.rb
268
+ - lib/svix/models/stream_event_type_in.rb
269
+ - lib/svix/models/stream_event_type_out.rb
270
+ - lib/svix/models/stream_event_type_patch.rb
267
271
  - lib/svix/models/stream_in.rb
268
272
  - lib/svix/models/stream_out.rb
269
273
  - lib/svix/models/stream_patch.rb
@@ -1,179 +0,0 @@
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
- Generator version: 7.9.0
10
-
11
- =end
12
-
13
- require 'cgi'
14
-
15
- module Svix
16
- class SinkApi
17
- attr_accessor :api_client
18
-
19
- def initialize(api_client = ApiClient.default)
20
- @api_client = api_client
21
- end
22
- # Append To Stream
23
- # Creates streaming events.
24
- # @param stream_id [String]
25
- # @param create_stream_in [CreateStreamIn]
26
- # @param [Hash] opts the optional parameters
27
- # @option opts [String] :idempotency_key The request&#39;s idempotency key
28
- # @return [Object]
29
- def v1_stream_create_events(stream_id, create_stream_in, opts = {})
30
- data, _status_code, _headers = v1_stream_create_events_with_http_info(stream_id, create_stream_in, opts)
31
- data
32
- end
33
-
34
- # Append To Stream
35
- # Creates streaming events.
36
- # @param stream_id [String]
37
- # @param create_stream_in [CreateStreamIn]
38
- # @param [Hash] opts the optional parameters
39
- # @option opts [String] :idempotency_key The request&#39;s idempotency key
40
- # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
41
- def v1_stream_create_events_with_http_info(stream_id, create_stream_in, opts = {})
42
- if @api_client.config.debugging
43
- @api_client.config.logger.debug 'Calling API: SinkApi.v1_stream_create_events ...'
44
- end
45
- # verify the required parameter 'stream_id' is set
46
- if @api_client.config.client_side_validation && stream_id.nil?
47
- fail ArgumentError, "Missing the required parameter 'stream_id' when calling SinkApi.v1_stream_create_events"
48
- end
49
- # verify the required parameter 'create_stream_in' is set
50
- if @api_client.config.client_side_validation && create_stream_in.nil?
51
- fail ArgumentError, "Missing the required parameter 'create_stream_in' when calling SinkApi.v1_stream_create_events"
52
- end
53
- # resource path
54
- local_var_path = '/api/v1/stream/{stream_id}/events'.sub('{' + 'stream_id' + '}', CGI.escape(stream_id.to_s))
55
-
56
- # query parameters
57
- query_params = opts[:query_params] || {}
58
-
59
- # header parameters
60
- header_params = opts[:header_params] || {}
61
- # HTTP header 'Accept' (if needed)
62
- header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
63
- # HTTP header 'Content-Type'
64
- content_type = @api_client.select_header_content_type(['application/json'])
65
- if !content_type.nil?
66
- header_params['Content-Type'] = content_type
67
- end
68
- header_params[:'idempotency-key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
69
-
70
- # form parameters
71
- form_params = opts[:form_params] || {}
72
-
73
- # http body (model)
74
- post_body = opts[:debug_body] || @api_client.object_to_http_body(create_stream_in)
75
-
76
- # return_type
77
- return_type = opts[:debug_return_type] || 'Object'
78
-
79
- # auth_names
80
- auth_names = opts[:debug_auth_names] || ['HTTPBearer']
81
-
82
- new_options = opts.merge(
83
- :operation => :"SinkApi.v1_stream_create_events",
84
- :header_params => header_params,
85
- :query_params => query_params,
86
- :form_params => form_params,
87
- :body => post_body,
88
- :auth_names => auth_names,
89
- :return_type => return_type
90
- )
91
-
92
- data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
93
- if @api_client.config.debugging
94
- @api_client.config.logger.debug "API called: SinkApi#v1_stream_create_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
95
- end
96
- return data, status_code, headers
97
- end
98
-
99
- # Stream Events
100
- # Iterate over a stream of events.
101
- # @param stream_id [String]
102
- # @param [Hash] opts the optional parameters
103
- # @option opts [Integer] :limit Limit the number of returned items
104
- # @option opts [String] :iterator The iterator returned from a prior invocation
105
- # @option opts [Time] :after
106
- # @return [EventStreamOut]
107
- def v1_stream_events_get(stream_id, opts = {})
108
- data, _status_code, _headers = v1_stream_events_get_with_http_info(stream_id, opts)
109
- data
110
- end
111
-
112
- # Stream Events
113
- # Iterate over a stream of events.
114
- # @param stream_id [String]
115
- # @param [Hash] opts the optional parameters
116
- # @option opts [Integer] :limit Limit the number of returned items
117
- # @option opts [String] :iterator The iterator returned from a prior invocation
118
- # @option opts [Time] :after
119
- # @return [Array<(EventStreamOut, Integer, Hash)>] EventStreamOut data, response status code and response headers
120
- def v1_stream_events_get_with_http_info(stream_id, opts = {})
121
- if @api_client.config.debugging
122
- @api_client.config.logger.debug 'Calling API: SinkApi.v1_stream_events_get ...'
123
- end
124
- # verify the required parameter 'stream_id' is set
125
- if @api_client.config.client_side_validation && stream_id.nil?
126
- fail ArgumentError, "Missing the required parameter 'stream_id' when calling SinkApi.v1_stream_events_get"
127
- end
128
- if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250
129
- fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling SinkApi.v1_stream_events_get, must be smaller than or equal to 250.'
130
- end
131
-
132
- if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
133
- fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling SinkApi.v1_stream_events_get, must be greater than or equal to 1.'
134
- end
135
-
136
- # resource path
137
- local_var_path = '/api/v1/stream/{stream_id}/events'.sub('{' + 'stream_id' + '}', CGI.escape(stream_id.to_s))
138
-
139
- # query parameters
140
- query_params = opts[:query_params] || {}
141
- query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
142
- query_params[:'iterator'] = opts[:'iterator'] if !opts[:'iterator'].nil?
143
- query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
144
-
145
- # header parameters
146
- header_params = opts[:header_params] || {}
147
- # HTTP header 'Accept' (if needed)
148
- header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
149
-
150
- # form parameters
151
- form_params = opts[:form_params] || {}
152
-
153
- # http body (model)
154
- post_body = opts[:debug_body]
155
-
156
- # return_type
157
- return_type = opts[:debug_return_type] || 'EventStreamOut'
158
-
159
- # auth_names
160
- auth_names = opts[:debug_auth_names] || ['HTTPBearer']
161
-
162
- new_options = opts.merge(
163
- :operation => :"SinkApi.v1_stream_events_get",
164
- :header_params => header_params,
165
- :query_params => query_params,
166
- :form_params => form_params,
167
- :body => post_body,
168
- :auth_names => auth_names,
169
- :return_type => return_type
170
- )
171
-
172
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
173
- if @api_client.config.debugging
174
- @api_client.config.logger.debug "API called: SinkApi#v1_stream_events_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
175
- end
176
- return data, status_code, headers
177
- end
178
- end
179
- end