svix 1.13.0 → 1.14.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17b5d97f7e6c49e08bdd186ffc37d7df93e1ef4fee429a9ce546ea0fb3b0da18
4
- data.tar.gz: aa249d2de965495213c584a96cae7400028dbd20b81920906aa2b5efb50dffaf
3
+ metadata.gz: d64085aefdf468273eede3dc68655f48abac3a682d01d7bb182e5abace37fbd3
4
+ data.tar.gz: e1bad67f258a28268b31f1d10418c593f8ef033cc91a5ea99006cb1eb72d7c2c
5
5
  SHA512:
6
- metadata.gz: 3b3f7094ea9ed99dc168a1f23934c6a5ced2f36c08c032d90f573402603ac5d2f56b2c6d9841982eda6759baf42d7f8d08c4028686fe96bec3c0a8434e457857
7
- data.tar.gz: 50c97cbb777efc0b1aa5d3eb6fd94d367ab1db413643e4ed3d9e108abe2b88f8748cf49beea6a358c5b32b2e214020cf871559b9919d89837f86ad35500deb3d
6
+ metadata.gz: 4d5d3697998262c85cb220125a5ba82798e0ea2163187816d23b4879a7e6268a17c04cc357766702822802cece5db1da0207f69cf9d889709b4ceac2e6a7b1c0
7
+ data.tar.gz: 485b6eb5fd8cb140e1c38e6baedf10f5c24c4b910fdc2ffd154900f927946ee10aded4d66cef9db3c88de06fb9ab291a88f3814d166d37c36512eef31d78e4bd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- svix (1.13.0)
4
+ svix (1.14.0)
5
5
  typhoeus (~> 1.0, >= 1.0.1)
6
6
 
7
7
  GEM
@@ -162,6 +162,66 @@ module Svix
162
162
  return data, status_code, headers
163
163
  end
164
164
 
165
+ # Event Type Export From Openapi
166
+ # Exports event type definitions based on the OpenAPI schemas associated with each existing event type
167
+ # @param [Hash] opts the optional parameters
168
+ # @option opts [String] :idempotency_key The request's idempotency key
169
+ # @return [ExportEventTypeOut]
170
+ def v1_event_type_export_openapi(opts = {})
171
+ data, _status_code, _headers = v1_event_type_export_openapi_with_http_info(opts)
172
+ data
173
+ end
174
+
175
+ # Event Type Export From Openapi
176
+ # Exports event type definitions based on the OpenAPI schemas associated with each existing event type
177
+ # @param [Hash] opts the optional parameters
178
+ # @option opts [String] :idempotency_key The request's idempotency key
179
+ # @return [Array<(ExportEventTypeOut, Integer, Hash)>] ExportEventTypeOut data, response status code and response headers
180
+ def v1_event_type_export_openapi_with_http_info(opts = {})
181
+ if @api_client.config.debugging
182
+ @api_client.config.logger.debug 'Calling API: EventTypeApi.v1_event_type_export_openapi ...'
183
+ end
184
+ # resource path
185
+ local_var_path = '/api/v1/event-type/export/openapi/'
186
+
187
+ # query parameters
188
+ query_params = opts[:query_params] || {}
189
+
190
+ # header parameters
191
+ header_params = opts[:header_params] || {}
192
+ # HTTP header 'Accept' (if needed)
193
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
194
+ header_params[:'idempotency-key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
195
+
196
+ # form parameters
197
+ form_params = opts[:form_params] || {}
198
+
199
+ # http body (model)
200
+ post_body = opts[:debug_body]
201
+
202
+ # return_type
203
+ return_type = opts[:debug_return_type] || 'ExportEventTypeOut'
204
+
205
+ # auth_names
206
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
207
+
208
+ new_options = opts.merge(
209
+ :operation => :"EventTypeApi.v1_event_type_export_openapi",
210
+ :header_params => header_params,
211
+ :query_params => query_params,
212
+ :form_params => form_params,
213
+ :body => post_body,
214
+ :auth_names => auth_names,
215
+ :return_type => return_type
216
+ )
217
+
218
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
219
+ if @api_client.config.debugging
220
+ @api_client.config.logger.debug "API called: EventTypeApi#v1_event_type_export_openapi\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
221
+ end
222
+ return data, status_code, headers
223
+ end
224
+
165
225
  # Generate Schema Example
166
226
  # Generates a fake example from the given JSONSchema
167
227
  # @param event_type_schema_in [EventTypeSchemaIn]
@@ -19,30 +19,30 @@ module Svix
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
- # Calculate Aggregate App Stats
23
- # Creates a background task to calculate the message destinations for all applications in the environment.
22
+ # Aggregate App Stats
23
+ # Creates a background task to calculate the message destinations for all applications in the environment. Note that this endpoint is asynchronous. You will need to poll the `Get Background Task` endpoint to retrieve the results of the operation.
24
24
  # @param app_usage_stats_in [AppUsageStatsIn]
25
25
  # @param [Hash] opts the optional parameters
26
26
  # @option opts [String] :idempotency_key The request&#39;s idempotency key
27
27
  # @return [AppUsageStatsOut]
28
- def calculate_aggregate_app_stats(app_usage_stats_in, opts = {})
29
- data, _status_code, _headers = calculate_aggregate_app_stats_with_http_info(app_usage_stats_in, opts)
28
+ def aggregate_app_stats(app_usage_stats_in, opts = {})
29
+ data, _status_code, _headers = aggregate_app_stats_with_http_info(app_usage_stats_in, opts)
30
30
  data
31
31
  end
32
32
 
33
- # Calculate Aggregate App Stats
34
- # Creates a background task to calculate the message destinations for all applications in the environment.
33
+ # Aggregate App Stats
34
+ # Creates a background task to calculate the message destinations for all applications in the environment. Note that this endpoint is asynchronous. You will need to poll the &#x60;Get Background Task&#x60; endpoint to retrieve the results of the operation.
35
35
  # @param app_usage_stats_in [AppUsageStatsIn]
36
36
  # @param [Hash] opts the optional parameters
37
37
  # @option opts [String] :idempotency_key The request&#39;s idempotency key
38
38
  # @return [Array<(AppUsageStatsOut, Integer, Hash)>] AppUsageStatsOut data, response status code and response headers
39
- def calculate_aggregate_app_stats_with_http_info(app_usage_stats_in, opts = {})
39
+ def aggregate_app_stats_with_http_info(app_usage_stats_in, opts = {})
40
40
  if @api_client.config.debugging
41
- @api_client.config.logger.debug 'Calling API: StatisticsApi.calculate_aggregate_app_stats ...'
41
+ @api_client.config.logger.debug 'Calling API: StatisticsApi.aggregate_app_stats ...'
42
42
  end
43
43
  # verify the required parameter 'app_usage_stats_in' is set
44
44
  if @api_client.config.client_side_validation && app_usage_stats_in.nil?
45
- fail ArgumentError, "Missing the required parameter 'app_usage_stats_in' when calling StatisticsApi.calculate_aggregate_app_stats"
45
+ fail ArgumentError, "Missing the required parameter 'app_usage_stats_in' when calling StatisticsApi.aggregate_app_stats"
46
46
  end
47
47
  # resource path
48
48
  local_var_path = '/api/v1/stats/usage/app/'
@@ -71,7 +71,7 @@ module Svix
71
71
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']
72
72
 
73
73
  new_options = opts.merge(
74
- :operation => :"StatisticsApi.calculate_aggregate_app_stats",
74
+ :operation => :"StatisticsApi.aggregate_app_stats",
75
75
  :header_params => header_params,
76
76
  :query_params => query_params,
77
77
  :form_params => form_params,
@@ -82,7 +82,64 @@ module Svix
82
82
 
83
83
  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
84
84
  if @api_client.config.debugging
85
- @api_client.config.logger.debug "API called: StatisticsApi#calculate_aggregate_app_stats\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
85
+ @api_client.config.logger.debug "API called: StatisticsApi#aggregate_app_stats\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+
90
+ # Aggregate Event Types
91
+ # Creates a background task to calculate the listed event types for all apps in the organization. Note that this endpoint is asynchronous. You will need to poll the `Get Background Task` endpoint to retrieve the results of the operation.
92
+ # @param [Hash] opts the optional parameters
93
+ # @return [AggregateEventTypesOut]
94
+ def aggregate_event_types(opts = {})
95
+ data, _status_code, _headers = aggregate_event_types_with_http_info(opts)
96
+ data
97
+ end
98
+
99
+ # Aggregate Event Types
100
+ # Creates a background task to calculate the listed event types for all apps in the organization. Note that this endpoint is asynchronous. You will need to poll the &#x60;Get Background Task&#x60; endpoint to retrieve the results of the operation.
101
+ # @param [Hash] opts the optional parameters
102
+ # @return [Array<(AggregateEventTypesOut, Integer, Hash)>] AggregateEventTypesOut data, response status code and response headers
103
+ def aggregate_event_types_with_http_info(opts = {})
104
+ if @api_client.config.debugging
105
+ @api_client.config.logger.debug 'Calling API: StatisticsApi.aggregate_event_types ...'
106
+ end
107
+ # resource path
108
+ local_var_path = '/api/v1/stats/usage/event-types/'
109
+
110
+ # query parameters
111
+ query_params = opts[:query_params] || {}
112
+
113
+ # header parameters
114
+ header_params = opts[:header_params] || {}
115
+ # HTTP header 'Accept' (if needed)
116
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
117
+
118
+ # form parameters
119
+ form_params = opts[:form_params] || {}
120
+
121
+ # http body (model)
122
+ post_body = opts[:debug_body]
123
+
124
+ # return_type
125
+ return_type = opts[:debug_return_type] || 'AggregateEventTypesOut'
126
+
127
+ # auth_names
128
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
129
+
130
+ new_options = opts.merge(
131
+ :operation => :"StatisticsApi.aggregate_event_types",
132
+ :header_params => header_params,
133
+ :query_params => query_params,
134
+ :form_params => form_params,
135
+ :body => post_body,
136
+ :auth_names => auth_names,
137
+ :return_type => return_type
138
+ )
139
+
140
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
141
+ if @api_client.config.debugging
142
+ @api_client.config.logger.debug "API called: StatisticsApi#aggregate_event_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
143
  end
87
144
  return data, status_code, headers
88
145
  end
@@ -287,6 +287,142 @@ module Svix
287
287
  return data, status_code, headers
288
288
  end
289
289
 
290
+ # Authorize Discord
291
+ # Get Discord Incoming webhook URL
292
+ # @param oauth_payload_in [OauthPayloadIn]
293
+ # @param [Hash] opts the optional parameters
294
+ # @option opts [String] :idempotency_key The request&#39;s idempotency key
295
+ # @return [OauthPayloadOut]
296
+ def v1_transformation_template_oauth_discord(oauth_payload_in, opts = {})
297
+ data, _status_code, _headers = v1_transformation_template_oauth_discord_with_http_info(oauth_payload_in, opts)
298
+ data
299
+ end
300
+
301
+ # Authorize Discord
302
+ # Get Discord Incoming webhook URL
303
+ # @param oauth_payload_in [OauthPayloadIn]
304
+ # @param [Hash] opts the optional parameters
305
+ # @option opts [String] :idempotency_key The request&#39;s idempotency key
306
+ # @return [Array<(OauthPayloadOut, Integer, Hash)>] OauthPayloadOut data, response status code and response headers
307
+ def v1_transformation_template_oauth_discord_with_http_info(oauth_payload_in, opts = {})
308
+ if @api_client.config.debugging
309
+ @api_client.config.logger.debug 'Calling API: TransformationTemplateApi.v1_transformation_template_oauth_discord ...'
310
+ end
311
+ # verify the required parameter 'oauth_payload_in' is set
312
+ if @api_client.config.client_side_validation && oauth_payload_in.nil?
313
+ fail ArgumentError, "Missing the required parameter 'oauth_payload_in' when calling TransformationTemplateApi.v1_transformation_template_oauth_discord"
314
+ end
315
+ # resource path
316
+ local_var_path = '/api/v1/transformation-template/oauth/discord'
317
+
318
+ # query parameters
319
+ query_params = opts[:query_params] || {}
320
+
321
+ # header parameters
322
+ header_params = opts[:header_params] || {}
323
+ # HTTP header 'Accept' (if needed)
324
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
325
+ # HTTP header 'Content-Type'
326
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
327
+ header_params[:'idempotency-key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
328
+
329
+ # form parameters
330
+ form_params = opts[:form_params] || {}
331
+
332
+ # http body (model)
333
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(oauth_payload_in)
334
+
335
+ # return_type
336
+ return_type = opts[:debug_return_type] || 'OauthPayloadOut'
337
+
338
+ # auth_names
339
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
340
+
341
+ new_options = opts.merge(
342
+ :operation => :"TransformationTemplateApi.v1_transformation_template_oauth_discord",
343
+ :header_params => header_params,
344
+ :query_params => query_params,
345
+ :form_params => form_params,
346
+ :body => post_body,
347
+ :auth_names => auth_names,
348
+ :return_type => return_type
349
+ )
350
+
351
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
352
+ if @api_client.config.debugging
353
+ @api_client.config.logger.debug "API called: TransformationTemplateApi#v1_transformation_template_oauth_discord\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
354
+ end
355
+ return data, status_code, headers
356
+ end
357
+
358
+ # Authorize Slack
359
+ # Get Slack Incoming webhook URL
360
+ # @param oauth_payload_in [OauthPayloadIn]
361
+ # @param [Hash] opts the optional parameters
362
+ # @option opts [String] :idempotency_key The request&#39;s idempotency key
363
+ # @return [OauthPayloadOut]
364
+ def v1_transformation_template_oauth_slack(oauth_payload_in, opts = {})
365
+ data, _status_code, _headers = v1_transformation_template_oauth_slack_with_http_info(oauth_payload_in, opts)
366
+ data
367
+ end
368
+
369
+ # Authorize Slack
370
+ # Get Slack Incoming webhook URL
371
+ # @param oauth_payload_in [OauthPayloadIn]
372
+ # @param [Hash] opts the optional parameters
373
+ # @option opts [String] :idempotency_key The request&#39;s idempotency key
374
+ # @return [Array<(OauthPayloadOut, Integer, Hash)>] OauthPayloadOut data, response status code and response headers
375
+ def v1_transformation_template_oauth_slack_with_http_info(oauth_payload_in, opts = {})
376
+ if @api_client.config.debugging
377
+ @api_client.config.logger.debug 'Calling API: TransformationTemplateApi.v1_transformation_template_oauth_slack ...'
378
+ end
379
+ # verify the required parameter 'oauth_payload_in' is set
380
+ if @api_client.config.client_side_validation && oauth_payload_in.nil?
381
+ fail ArgumentError, "Missing the required parameter 'oauth_payload_in' when calling TransformationTemplateApi.v1_transformation_template_oauth_slack"
382
+ end
383
+ # resource path
384
+ local_var_path = '/api/v1/transformation-template/oauth/slack'
385
+
386
+ # query parameters
387
+ query_params = opts[:query_params] || {}
388
+
389
+ # header parameters
390
+ header_params = opts[:header_params] || {}
391
+ # HTTP header 'Accept' (if needed)
392
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
393
+ # HTTP header 'Content-Type'
394
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
395
+ header_params[:'idempotency-key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
396
+
397
+ # form parameters
398
+ form_params = opts[:form_params] || {}
399
+
400
+ # http body (model)
401
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(oauth_payload_in)
402
+
403
+ # return_type
404
+ return_type = opts[:debug_return_type] || 'OauthPayloadOut'
405
+
406
+ # auth_names
407
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
408
+
409
+ new_options = opts.merge(
410
+ :operation => :"TransformationTemplateApi.v1_transformation_template_oauth_slack",
411
+ :header_params => header_params,
412
+ :query_params => query_params,
413
+ :form_params => form_params,
414
+ :body => post_body,
415
+ :auth_names => auth_names,
416
+ :return_type => return_type
417
+ )
418
+
419
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
420
+ if @api_client.config.debugging
421
+ @api_client.config.logger.debug "API called: TransformationTemplateApi#v1_transformation_template_oauth_slack\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
422
+ end
423
+ return data, status_code, headers
424
+ end
425
+
290
426
  # Patch Transformation Template
291
427
  # Partially update a transformation template
292
428
  # @param transformation_template_id [String]
@@ -14,8 +14,8 @@ module Svix
14
14
  return @api.v1_message_create(app_id, message_in, options)
15
15
  end
16
16
 
17
- def get(app_id, msg_id)
18
- return @api.v1_message_get(app_id, msg_id)
17
+ def get(app_id, msg_id, options = {})
18
+ return @api.v1_message_get(app_id, msg_id, options)
19
19
  end
20
20
 
21
21
  def expunge_content(app_id, msg_id)
@@ -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 AggregateEventTypesOut
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::AggregateEventTypesOut` 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::AggregateEventTypesOut`. 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
@@ -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