svix 1.38.0 → 1.39.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +5 -5
  3. data/README.md +8 -1
  4. data/lib/svix/api/application_api.rb +23 -14
  5. data/lib/svix/api/authentication_api.rb +23 -11
  6. data/lib/svix/api/background_tasks_api.rb +3 -3
  7. data/lib/svix/api/broadcast_api.rb +6 -3
  8. data/lib/svix/api/endpoint_api.rb +86 -44
  9. data/lib/svix/api/environment_api.rb +8 -5
  10. data/lib/svix/api/environment_settings_api.rb +2 -2
  11. data/lib/svix/api/event_type_api.rb +39 -21
  12. data/lib/svix/api/events_api.rb +2 -2
  13. data/lib/svix/api/health_api.rb +2 -2
  14. data/lib/svix/api/inbound_api.rb +7 -4
  15. data/lib/svix/api/integration_api.rb +16 -10
  16. data/lib/svix/api/message_api.rb +21 -15
  17. data/lib/svix/api/message_attempt_api.rb +25 -25
  18. data/lib/svix/api/sink_api.rb +7 -4
  19. data/lib/svix/api/statistics_api.rb +9 -6
  20. data/lib/svix/api/stream_api.rb +19 -10
  21. data/lib/svix/api/transformation_template_api.rb +49 -22
  22. data/lib/svix/api/webhook_endpoint_api.rb +572 -0
  23. data/lib/svix/api_client.rb +45 -28
  24. data/lib/svix/api_error.rb +2 -1
  25. data/lib/svix/configuration.rb +42 -12
  26. data/lib/svix/models/aggregate_event_types_out.rb +43 -19
  27. data/lib/svix/models/app_portal_access_in.rb +19 -19
  28. data/lib/svix/models/app_portal_access_out.rb +19 -19
  29. data/lib/svix/models/app_usage_stats_in.rb +19 -19
  30. data/lib/svix/models/app_usage_stats_out.rb +43 -19
  31. data/lib/svix/models/application_in.rb +17 -19
  32. data/lib/svix/models/application_out.rb +25 -19
  33. data/lib/svix/models/application_patch.rb +15 -19
  34. data/lib/svix/models/application_stats.rb +19 -19
  35. data/lib/svix/models/application_token_expire_in.rb +15 -19
  36. data/lib/svix/models/attempt_statistics_data.rb +15 -19
  37. data/lib/svix/models/attempt_statistics_response.rb +45 -19
  38. data/lib/svix/models/auth_token_out.rb +21 -19
  39. data/lib/svix/models/azure_blob_storage_config.rb +21 -19
  40. data/lib/svix/models/background_task_out.rb +45 -19
  41. data/lib/svix/models/background_task_status.rb +7 -4
  42. data/lib/svix/models/background_task_type.rb +7 -4
  43. data/lib/svix/models/big_query_config.rb +271 -0
  44. data/lib/svix/models/border_radius_config.rb +37 -19
  45. data/lib/svix/models/border_radius_enum.rb +7 -4
  46. data/lib/svix/models/client_secret_jwt_params_in.rb +41 -19
  47. data/lib/svix/models/completion_choice.rb +21 -19
  48. data/lib/svix/models/completion_message.rb +19 -19
  49. data/lib/svix/models/create_message_token_in.rb +17 -19
  50. data/lib/svix/models/create_stream_in.rb +30 -23
  51. data/lib/svix/models/custom_color_palette.rb +15 -19
  52. data/lib/svix/models/custom_strings_override.rb +15 -19
  53. data/lib/svix/models/custom_theme_override.rb +15 -19
  54. data/lib/svix/models/dashboard_access_out.rb +19 -19
  55. data/lib/svix/models/duration.rb +19 -19
  56. data/lib/svix/models/endpoint_created_event.rb +17 -19
  57. data/lib/svix/models/endpoint_created_event_data.rb +19 -19
  58. data/lib/svix/models/endpoint_deleted_event.rb +17 -19
  59. data/lib/svix/models/endpoint_deleted_event_data.rb +19 -19
  60. data/lib/svix/models/endpoint_disabled_event.rb +17 -19
  61. data/lib/svix/models/endpoint_disabled_event_data.rb +21 -19
  62. data/lib/svix/models/endpoint_headers_in.rb +17 -19
  63. data/lib/svix/models/endpoint_headers_out.rb +19 -19
  64. data/lib/svix/models/endpoint_headers_patch_in.rb +17 -19
  65. data/lib/svix/models/endpoint_in.rb +17 -19
  66. data/lib/svix/models/endpoint_message_out.rb +47 -19
  67. data/lib/svix/models/endpoint_mtls_config_in.rb +17 -19
  68. data/lib/svix/models/endpoint_oauth_config_in.rb +45 -19
  69. data/lib/svix/models/endpoint_out.rb +29 -19
  70. data/lib/svix/models/endpoint_patch.rb +20 -20
  71. data/lib/svix/models/endpoint_secret_out.rb +17 -19
  72. data/lib/svix/models/endpoint_secret_rotate_in.rb +15 -21
  73. data/lib/svix/models/endpoint_stats.rb +23 -19
  74. data/lib/svix/models/endpoint_transformation_in.rb +15 -19
  75. data/lib/svix/models/endpoint_transformation_out.rb +15 -19
  76. data/lib/svix/models/endpoint_transformation_simulate_in.rb +21 -19
  77. data/lib/svix/models/endpoint_transformation_simulate_out.rb +41 -19
  78. data/lib/svix/models/endpoint_update.rb +17 -19
  79. data/lib/svix/models/endpoint_updated_event.rb +17 -19
  80. data/lib/svix/models/endpoint_updated_event_data.rb +19 -19
  81. data/lib/svix/models/environment_in.rb +19 -19
  82. data/lib/svix/models/environment_out.rb +21 -19
  83. data/lib/svix/models/environment_settings_out.rb +15 -19
  84. data/lib/svix/models/event_example_in.rb +17 -19
  85. data/lib/svix/models/event_in.rb +17 -19
  86. data/lib/svix/models/event_out.rb +19 -19
  87. data/lib/svix/models/event_stream_out.rb +21 -19
  88. data/lib/svix/models/event_type_example_out.rb +17 -19
  89. data/lib/svix/models/event_type_from_open_api.rb +95 -20
  90. data/lib/svix/models/event_type_import_open_api_in.rb +15 -19
  91. data/lib/svix/models/event_type_import_open_api_out.rb +17 -19
  92. data/lib/svix/models/event_type_import_open_api_out_data.rb +17 -19
  93. data/lib/svix/models/event_type_in.rb +19 -19
  94. data/lib/svix/models/event_type_out.rb +25 -19
  95. data/lib/svix/models/event_type_patch.rb +15 -19
  96. data/lib/svix/models/event_type_schema_in.rb +17 -19
  97. data/lib/svix/models/event_type_update.rb +17 -19
  98. data/lib/svix/models/export_event_type_out.rb +43 -19
  99. data/lib/svix/models/font_size_config.rb +15 -19
  100. data/lib/svix/models/generate_in.rb +17 -19
  101. data/lib/svix/models/generate_out.rb +25 -19
  102. data/lib/svix/models/google_cloud_storage_config.rb +19 -19
  103. data/lib/svix/models/http_error_out.rb +19 -19
  104. data/lib/svix/models/http_validation_error.rb +17 -19
  105. data/lib/svix/models/hubspot_oauth_config_in.rb +17 -19
  106. data/lib/svix/models/inbound_path_params.rb +19 -19
  107. data/lib/svix/models/incoming_webhook_payload_out.rb +15 -19
  108. data/lib/svix/models/integration_in.rb +17 -19
  109. data/lib/svix/models/integration_key_out.rb +17 -19
  110. data/lib/svix/models/integration_out.rb +23 -19
  111. data/lib/svix/models/integration_update.rb +17 -19
  112. data/lib/svix/models/kafka_security_protocol_type.rb +7 -4
  113. data/lib/svix/models/list_response_application_out.rb +19 -19
  114. data/lib/svix/models/list_response_application_stats.rb +19 -19
  115. data/lib/svix/models/list_response_background_task_out.rb +19 -19
  116. data/lib/svix/models/list_response_endpoint_message_out.rb +19 -19
  117. data/lib/svix/models/list_response_endpoint_out.rb +19 -19
  118. data/lib/svix/models/list_response_event_type_out.rb +19 -19
  119. data/lib/svix/models/list_response_integration_out.rb +19 -19
  120. data/lib/svix/models/list_response_message_attempt_endpoint_out.rb +19 -19
  121. data/lib/svix/models/list_response_message_attempt_out.rb +19 -19
  122. data/lib/svix/models/list_response_message_endpoint_out.rb +19 -19
  123. data/lib/svix/models/list_response_message_out.rb +19 -19
  124. data/lib/svix/models/list_response_operational_webhook_endpoint_out.rb +259 -0
  125. data/lib/svix/models/list_response_sink_out.rb +19 -19
  126. data/lib/svix/models/list_response_stream_out.rb +19 -19
  127. data/lib/svix/models/list_response_stream_sink_out.rb +19 -19
  128. data/lib/svix/models/list_response_template_out.rb +19 -19
  129. data/lib/svix/models/message_attempt_endpoint_out.rb +57 -19
  130. data/lib/svix/models/message_attempt_exhausted_event.rb +17 -19
  131. data/lib/svix/models/message_attempt_exhausted_event_data.rb +23 -19
  132. data/lib/svix/models/message_attempt_failed_data.rb +21 -19
  133. data/lib/svix/models/message_attempt_failing_event.rb +17 -19
  134. data/lib/svix/models/message_attempt_failing_event_data.rb +23 -19
  135. data/lib/svix/models/message_attempt_headers_out.rb +19 -19
  136. data/lib/svix/models/message_attempt_out.rb +57 -19
  137. data/lib/svix/models/message_attempt_recovered_event.rb +17 -19
  138. data/lib/svix/models/message_attempt_recovered_event_data.rb +23 -19
  139. data/lib/svix/models/message_attempt_trigger_type.rb +7 -4
  140. data/lib/svix/models/message_broadcast_in.rb +19 -19
  141. data/lib/svix/models/message_broadcast_out.rb +43 -19
  142. data/lib/svix/models/message_endpoint_out.rb +51 -19
  143. data/lib/svix/models/message_events_out.rb +21 -19
  144. data/lib/svix/models/message_in.rb +19 -19
  145. data/lib/svix/models/message_out.rb +23 -19
  146. data/lib/svix/models/message_raw_payload_out.rb +17 -19
  147. data/lib/svix/models/message_status.rb +7 -4
  148. data/lib/svix/models/message_subscriber_auth_token_out.rb +19 -19
  149. data/lib/svix/models/o_auth_payload_in.rb +19 -19
  150. data/lib/svix/models/o_auth_payload_out.rb +15 -19
  151. data/lib/svix/models/oauth2_auth_method_in.rb +7 -4
  152. data/lib/svix/models/oauth2_grant_type_in.rb +7 -4
  153. data/lib/svix/models/oauth_jws_signing_algorithm.rb +7 -4
  154. data/lib/svix/models/one_time_token_in.rb +17 -19
  155. data/lib/svix/models/one_time_token_out.rb +17 -19
  156. data/lib/svix/models/operational_webhook_endpoint_in.rb +408 -0
  157. data/lib/svix/models/operational_webhook_endpoint_out.rb +442 -0
  158. data/lib/svix/models/operational_webhook_endpoint_secret_in.rb +233 -0
  159. data/lib/svix/models/operational_webhook_endpoint_secret_out.rb +243 -0
  160. data/lib/svix/models/operational_webhook_endpoint_update.rb +380 -0
  161. data/lib/svix/models/ordering.rb +7 -4
  162. data/lib/svix/models/recover_in.rb +17 -19
  163. data/lib/svix/models/recover_out.rb +43 -19
  164. data/lib/svix/models/redshift_config.rb +25 -19
  165. data/lib/svix/models/replay_in.rb +17 -19
  166. data/lib/svix/models/replay_out.rb +43 -19
  167. data/lib/svix/models/retry_schedule_in_out.rb +15 -19
  168. data/lib/svix/models/rotated_url_out.rb +17 -19
  169. data/lib/svix/models/s3_config.rb +23 -19
  170. data/lib/svix/models/settings_in.rb +15 -19
  171. data/lib/svix/models/settings_out.rb +15 -19
  172. data/lib/svix/models/sink_http_config.rb +17 -19
  173. data/lib/svix/models/sink_in.rb +4 -4
  174. data/lib/svix/models/sink_in_one_of.rb +21 -19
  175. data/lib/svix/models/sink_in_one_of1.rb +25 -19
  176. data/lib/svix/models/sink_in_one_of2.rb +23 -19
  177. data/lib/svix/models/sink_in_one_of3.rb +19 -19
  178. data/lib/svix/models/sink_otel_v1_config.rb +17 -19
  179. data/lib/svix/models/sink_out.rb +4 -4
  180. data/lib/svix/models/sink_payload_format.rb +7 -4
  181. data/lib/svix/models/sink_status.rb +7 -4
  182. data/lib/svix/models/sink_status_in.rb +7 -4
  183. data/lib/svix/models/sink_transform_in.rb +15 -19
  184. data/lib/svix/models/sink_transformation_out.rb +15 -19
  185. data/lib/svix/models/snowflake_config.rb +21 -19
  186. data/lib/svix/models/statistics_period.rb +7 -4
  187. data/lib/svix/models/status_code_class.rb +7 -4
  188. data/lib/svix/models/stream_in.rb +24 -22
  189. data/lib/svix/models/stream_out.rb +28 -22
  190. data/lib/svix/models/stream_patch.rb +22 -22
  191. data/lib/svix/models/stream_sink_in.rb +6 -5
  192. data/lib/svix/models/stream_sink_in_one_of.rb +19 -19
  193. data/lib/svix/models/stream_sink_in_one_of1.rb +19 -19
  194. data/lib/svix/models/stream_sink_in_one_of2.rb +19 -19
  195. data/lib/svix/models/stream_sink_in_one_of3.rb +19 -19
  196. data/lib/svix/models/stream_sink_in_one_of4.rb +19 -19
  197. data/lib/svix/models/stream_sink_in_one_of5.rb +19 -19
  198. data/lib/svix/models/stream_sink_in_one_of6.rb +19 -19
  199. data/lib/svix/models/stream_sink_in_one_of7.rb +271 -0
  200. data/lib/svix/models/stream_sink_out.rb +6 -5
  201. data/lib/svix/models/stream_sink_patch.rb +6 -5
  202. data/lib/svix/models/template_in.rb +43 -21
  203. data/lib/svix/models/template_out.rb +57 -19
  204. data/lib/svix/models/template_patch.rb +43 -21
  205. data/lib/svix/models/template_update.rb +41 -19
  206. data/lib/svix/models/transformation_http_method.rb +7 -4
  207. data/lib/svix/models/transformation_simulate_in.rb +21 -19
  208. data/lib/svix/models/transformation_simulate_out.rb +41 -19
  209. data/lib/svix/models/transformation_template_kind.rb +7 -4
  210. data/lib/svix/models/validation_error.rb +21 -19
  211. data/lib/svix/operational_webhook_endpoint_api.rb +37 -0
  212. data/lib/svix/version.rb +1 -1
  213. data/svix.gemspec +12 -2
  214. metadata +40 -21
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.1.1
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.2.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -22,6 +22,10 @@ module Svix
22
22
  SDK_GENERATE = "sdk.generate".freeze
23
23
  EVENT_TYPE_AGGREGATE = "event-type.aggregate".freeze
24
24
 
25
+ def self.all_vars
26
+ @all_vars ||= [ENDPOINT_REPLAY, ENDPOINT_RECOVER, APPLICATION_STATS, MESSAGE_BROADCAST, SDK_GENERATE, EVENT_TYPE_AGGREGATE].freeze
27
+ end
28
+
25
29
  # Builds the enum from string
26
30
  # @param [String] The enum value in the form of the string
27
31
  # @return [String] The enum value
@@ -33,9 +37,8 @@ module Svix
33
37
  # @param [String] The enum value in the form of the string
34
38
  # @return [String] The enum value
35
39
  def build_from_hash(value)
36
- constantValues = BackgroundTaskType.constants.select { |c| BackgroundTaskType::const_get(c) == value }
37
- raise "Invalid ENUM value #{value} for class #BackgroundTaskType" if constantValues.empty?
38
- value
40
+ return value if BackgroundTaskType.all_vars.include?(value)
41
+ raise "Invalid ENUM value #{value} for class #BackgroundTaskType"
39
42
  end
40
43
  end
41
44
  end
@@ -0,0 +1,271 @@
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
+ # Configuration for a Google Cloud BigQuery sink.
18
+ class BigQueryConfig
19
+ # Google Cloud Credentials JSON Object as a string.
20
+ attr_accessor :credentials
21
+
22
+ attr_accessor :dataset_id
23
+
24
+ attr_accessor :project_id
25
+
26
+ attr_accessor :table_id
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'credentials' => :'credentials',
32
+ :'dataset_id' => :'datasetId',
33
+ :'project_id' => :'projectId',
34
+ :'table_id' => :'tableId'
35
+ }
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'credentials' => :'String',
47
+ :'dataset_id' => :'String',
48
+ :'project_id' => :'String',
49
+ :'table_id' => :'String'
50
+ }
51
+ end
52
+
53
+ # List of attributes with nullable: true
54
+ def self.openapi_nullable
55
+ Set.new([
56
+ ])
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ if (!attributes.is_a?(Hash))
63
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::BigQueryConfig` initialize method"
64
+ end
65
+
66
+ # check to see if the attribute exists and convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!self.class.attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::BigQueryConfig`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'credentials')
75
+ self.credentials = attributes[:'credentials']
76
+ else
77
+ self.credentials = nil
78
+ end
79
+
80
+ if attributes.key?(:'dataset_id')
81
+ self.dataset_id = attributes[:'dataset_id']
82
+ else
83
+ self.dataset_id = nil
84
+ end
85
+
86
+ if attributes.key?(:'project_id')
87
+ self.project_id = attributes[:'project_id']
88
+ else
89
+ self.project_id = nil
90
+ end
91
+
92
+ if attributes.key?(:'table_id')
93
+ self.table_id = attributes[:'table_id']
94
+ else
95
+ self.table_id = nil
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
103
+ invalid_properties = Array.new
104
+ if @credentials.nil?
105
+ invalid_properties.push('invalid value for "credentials", credentials cannot be nil.')
106
+ end
107
+
108
+ if @dataset_id.nil?
109
+ invalid_properties.push('invalid value for "dataset_id", dataset_id cannot be nil.')
110
+ end
111
+
112
+ if @project_id.nil?
113
+ invalid_properties.push('invalid value for "project_id", project_id cannot be nil.')
114
+ end
115
+
116
+ if @table_id.nil?
117
+ invalid_properties.push('invalid value for "table_id", table_id cannot be nil.')
118
+ end
119
+
120
+ invalid_properties
121
+ end
122
+
123
+ # Check to see if the all the properties in the model are valid
124
+ # @return true if the model is valid
125
+ def valid?
126
+ warn '[DEPRECATED] the `valid?` method is obsolete'
127
+ return false if @credentials.nil?
128
+ return false if @dataset_id.nil?
129
+ return false if @project_id.nil?
130
+ return false if @table_id.nil?
131
+ true
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
+ credentials == o.credentials &&
140
+ dataset_id == o.dataset_id &&
141
+ project_id == o.project_id &&
142
+ table_id == o.table_id
143
+ end
144
+
145
+ # @see the `==` method
146
+ # @param [Object] Object to be compared
147
+ def eql?(o)
148
+ self == o
149
+ end
150
+
151
+ # Calculates hash code according to all attributes.
152
+ # @return [Integer] Hash code
153
+ def hash
154
+ [credentials, dataset_id, project_id, table_id].hash
155
+ end
156
+
157
+ # Builds the object from hash
158
+ # @param [Hash] attributes Model attributes in the form of hash
159
+ # @return [Object] Returns the model itself
160
+ def self.build_from_hash(attributes)
161
+ return nil unless attributes.is_a?(Hash)
162
+ attributes = attributes.transform_keys(&:to_sym)
163
+ transformed_hash = {}
164
+ openapi_types.each_pair do |key, type|
165
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
166
+ transformed_hash["#{key}"] = nil
167
+ elsif type =~ /\AArray<(.*)>/i
168
+ # check to ensure the input is an array given that the attribute
169
+ # is documented as an array but the input is not
170
+ if attributes[attribute_map[key]].is_a?(Array)
171
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
172
+ end
173
+ elsif !attributes[attribute_map[key]].nil?
174
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
175
+ end
176
+ end
177
+ new(transformed_hash)
178
+ end
179
+
180
+ # Deserializes the data based on type
181
+ # @param string type Data type
182
+ # @param string value Value to be deserialized
183
+ # @return [Object] Deserialized data
184
+ def self._deserialize(type, value)
185
+ case type.to_sym
186
+ when :Time
187
+ Time.parse(value)
188
+ when :Date
189
+ Date.parse(value)
190
+ when :String
191
+ value.to_s
192
+ when :Integer
193
+ value.to_i
194
+ when :Float
195
+ value.to_f
196
+ when :Boolean
197
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
198
+ true
199
+ else
200
+ false
201
+ end
202
+ when :Object
203
+ # generic object (usually a Hash), return directly
204
+ value
205
+ when /\AArray<(?<inner_type>.+)>\z/
206
+ inner_type = Regexp.last_match[:inner_type]
207
+ value.map { |v| _deserialize(inner_type, v) }
208
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
209
+ k_type = Regexp.last_match[:k_type]
210
+ v_type = Regexp.last_match[:v_type]
211
+ {}.tap do |hash|
212
+ value.each do |k, v|
213
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
214
+ end
215
+ end
216
+ else # model
217
+ # models (e.g. Pet) or oneOf
218
+ klass = Svix.const_get(type)
219
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
220
+ end
221
+ end
222
+
223
+ # Returns the string representation of the object
224
+ # @return [String] String presentation of the object
225
+ def to_s
226
+ to_hash.to_s
227
+ end
228
+
229
+ # to_body is an alias to to_hash (backward compatibility)
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_body
232
+ to_hash
233
+ end
234
+
235
+ # Returns the object in the form of hash
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_hash
238
+ hash = {}
239
+ self.class.attribute_map.each_pair do |attr, param|
240
+ value = self.send(attr)
241
+ if value.nil?
242
+ is_nullable = self.class.openapi_nullable.include?(attr)
243
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
244
+ end
245
+
246
+ hash[param] = _to_hash(value)
247
+ end
248
+ hash
249
+ end
250
+
251
+ # Outputs non-array value in the form of hash
252
+ # For object, use to_hash. Otherwise, just return the value
253
+ # @param [Object] value Any valid value
254
+ # @return [Hash] Returns the value in the form of hash
255
+ def _to_hash(value)
256
+ if value.is_a?(Array)
257
+ value.compact.map { |v| _to_hash(v) }
258
+ elsif value.is_a?(Hash)
259
+ {}.tap do |hash|
260
+ value.each { |k, v| hash[k] = _to_hash(v) }
261
+ end
262
+ elsif value.respond_to? :to_hash
263
+ value.to_hash
264
+ else
265
+ value
266
+ end
267
+ end
268
+
269
+ end
270
+
271
+ end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.1.1
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.2.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -21,6 +21,28 @@ module Svix
21
21
 
22
22
  attr_accessor :input
23
23
 
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
24
46
  # Attribute mapping from ruby-style variable name to JSON key.
25
47
  def self.attribute_map
26
48
  {
@@ -81,6 +103,7 @@ module Svix
81
103
  # Show invalid properties with the reasons. Usually used together with valid?
82
104
  # @return Array for valid properties with the reasons
83
105
  def list_invalid_properties
106
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
84
107
  invalid_properties = Array.new
85
108
  invalid_properties
86
109
  end
@@ -88,6 +111,7 @@ module Svix
88
111
  # Check to see if the all the properties in the model are valid
89
112
  # @return true if the model is valid
90
113
  def valid?
114
+ warn '[DEPRECATED] the `valid?` method is obsolete'
91
115
  true
92
116
  end
93
117
 
@@ -117,36 +141,30 @@ module Svix
117
141
  # @param [Hash] attributes Model attributes in the form of hash
118
142
  # @return [Object] Returns the model itself
119
143
  def self.build_from_hash(attributes)
120
- new.build_from_hash(attributes)
121
- end
122
-
123
- # Builds the object from hash
124
- # @param [Hash] attributes Model attributes in the form of hash
125
- # @return [Object] Returns the model itself
126
- def build_from_hash(attributes)
127
144
  return nil unless attributes.is_a?(Hash)
128
- self.class.openapi_types.each_pair do |key, type|
129
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
130
- self.send("#{key}=", nil)
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
131
150
  elsif type =~ /\AArray<(.*)>/i
132
151
  # check to ensure the input is an array given that the attribute
133
152
  # is documented as an array but the input is not
134
- if attributes[self.class.attribute_map[key]].is_a?(Array)
135
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
153
+ if attributes[attribute_map[key]].is_a?(Array)
154
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
136
155
  end
137
- elsif !attributes[self.class.attribute_map[key]].nil?
138
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
156
+ elsif !attributes[attribute_map[key]].nil?
157
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
139
158
  end
140
159
  end
141
-
142
- self
160
+ new(transformed_hash)
143
161
  end
144
162
 
145
163
  # Deserializes the data based on type
146
164
  # @param string type Data type
147
165
  # @param string value Value to be deserialized
148
166
  # @return [Object] Deserialized data
149
- def _deserialize(type, value)
167
+ def self._deserialize(type, value)
150
168
  case type.to_sym
151
169
  when :Time
152
170
  Time.parse(value)
@@ -181,7 +199,7 @@ module Svix
181
199
  else # model
182
200
  # models (e.g. Pet) or oneOf
183
201
  klass = Svix.const_get(type)
184
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
202
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
185
203
  end
186
204
  end
187
205
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.1.1
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.2.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -21,6 +21,10 @@ module Svix
21
21
  SM = "sm".freeze
22
22
  FULL = "full".freeze
23
23
 
24
+ def self.all_vars
25
+ @all_vars ||= [NONE, LG, MD, SM, FULL].freeze
26
+ end
27
+
24
28
  # Builds the enum from string
25
29
  # @param [String] The enum value in the form of the string
26
30
  # @return [String] The enum value
@@ -32,9 +36,8 @@ module Svix
32
36
  # @param [String] The enum value in the form of the string
33
37
  # @return [String] The enum value
34
38
  def build_from_hash(value)
35
- constantValues = BorderRadiusEnum.constants.select { |c| BorderRadiusEnum::const_get(c) == value }
36
- raise "Invalid ENUM value #{value} for class #BorderRadiusEnum" if constantValues.empty?
37
- value
39
+ return value if BorderRadiusEnum.all_vars.include?(value)
40
+ raise "Invalid ENUM value #{value} for class #BorderRadiusEnum"
38
41
  end
39
42
  end
40
43
  end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.1.1
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.2.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -26,6 +26,28 @@ module Svix
26
26
  # Optional number of seconds after which the JWT should expire. Defaults to 300 seconds.
27
27
  attr_accessor :token_expiry_secs
28
28
 
29
+ class EnumAttributeValidator
30
+ attr_reader :datatype
31
+ attr_reader :allowable_values
32
+
33
+ def initialize(datatype, allowable_values)
34
+ @allowable_values = allowable_values.map do |value|
35
+ case datatype.to_s
36
+ when /Integer/i
37
+ value.to_i
38
+ when /Float/i
39
+ value.to_f
40
+ else
41
+ value
42
+ end
43
+ end
44
+ end
45
+
46
+ def valid?(value)
47
+ !value || allowable_values.include?(value)
48
+ end
49
+ end
50
+
29
51
  # Attribute mapping from ruby-style variable name to JSON key.
30
52
  def self.attribute_map
31
53
  {
@@ -76,6 +98,8 @@ module Svix
76
98
 
77
99
  if attributes.key?(:'secret_base64')
78
100
  self.secret_base64 = attributes[:'secret_base64']
101
+ else
102
+ self.secret_base64 = nil
79
103
  end
80
104
 
81
105
  if attributes.key?(:'secret_id')
@@ -84,6 +108,8 @@ module Svix
84
108
 
85
109
  if attributes.key?(:'signing_algorithm')
86
110
  self.signing_algorithm = attributes[:'signing_algorithm']
111
+ else
112
+ self.signing_algorithm = nil
87
113
  end
88
114
 
89
115
  if attributes.key?(:'token_expiry_secs')
@@ -94,6 +120,7 @@ module Svix
94
120
  # Show invalid properties with the reasons. Usually used together with valid?
95
121
  # @return Array for valid properties with the reasons
96
122
  def list_invalid_properties
123
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
97
124
  invalid_properties = Array.new
98
125
  if @secret_base64.nil?
99
126
  invalid_properties.push('invalid value for "secret_base64", secret_base64 cannot be nil.')
@@ -113,6 +140,7 @@ module Svix
113
140
  # Check to see if the all the properties in the model are valid
114
141
  # @return true if the model is valid
115
142
  def valid?
143
+ warn '[DEPRECATED] the `valid?` method is obsolete'
116
144
  return false if @secret_base64.nil?
117
145
  return false if @signing_algorithm.nil?
118
146
  return false if !@token_expiry_secs.nil? && @token_expiry_secs < 0
@@ -156,36 +184,30 @@ module Svix
156
184
  # @param [Hash] attributes Model attributes in the form of hash
157
185
  # @return [Object] Returns the model itself
158
186
  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
187
  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)
188
+ attributes = attributes.transform_keys(&:to_sym)
189
+ transformed_hash = {}
190
+ openapi_types.each_pair do |key, type|
191
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
192
+ transformed_hash["#{key}"] = nil
170
193
  elsif type =~ /\AArray<(.*)>/i
171
194
  # check to ensure the input is an array given that the attribute
172
195
  # 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) })
196
+ if attributes[attribute_map[key]].is_a?(Array)
197
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
175
198
  end
176
- elsif !attributes[self.class.attribute_map[key]].nil?
177
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
199
+ elsif !attributes[attribute_map[key]].nil?
200
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
178
201
  end
179
202
  end
180
-
181
- self
203
+ new(transformed_hash)
182
204
  end
183
205
 
184
206
  # Deserializes the data based on type
185
207
  # @param string type Data type
186
208
  # @param string value Value to be deserialized
187
209
  # @return [Object] Deserialized data
188
- def _deserialize(type, value)
210
+ def self._deserialize(type, value)
189
211
  case type.to_sym
190
212
  when :Time
191
213
  Time.parse(value)
@@ -220,7 +242,7 @@ module Svix
220
242
  else # model
221
243
  # models (e.g. Pet) or oneOf
222
244
  klass = Svix.const_get(type)
223
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
245
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
224
246
  end
225
247
  end
226
248
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.1.1
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.2.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -67,20 +67,27 @@ module Svix
67
67
 
68
68
  if attributes.key?(:'finish_reason')
69
69
  self.finish_reason = attributes[:'finish_reason']
70
+ else
71
+ self.finish_reason = nil
70
72
  end
71
73
 
72
74
  if attributes.key?(:'index')
73
75
  self.index = attributes[:'index']
76
+ else
77
+ self.index = nil
74
78
  end
75
79
 
76
80
  if attributes.key?(:'message')
77
81
  self.message = attributes[:'message']
82
+ else
83
+ self.message = nil
78
84
  end
79
85
  end
80
86
 
81
87
  # Show invalid properties with the reasons. Usually used together with valid?
82
88
  # @return Array for valid properties with the reasons
83
89
  def list_invalid_properties
90
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
84
91
  invalid_properties = Array.new
85
92
  if @finish_reason.nil?
86
93
  invalid_properties.push('invalid value for "finish_reason", finish_reason cannot be nil.')
@@ -100,6 +107,7 @@ module Svix
100
107
  # Check to see if the all the properties in the model are valid
101
108
  # @return true if the model is valid
102
109
  def valid?
110
+ warn '[DEPRECATED] the `valid?` method is obsolete'
103
111
  return false if @finish_reason.nil?
104
112
  return false if @index.nil?
105
113
  return false if @message.nil?
@@ -132,36 +140,30 @@ module Svix
132
140
  # @param [Hash] attributes Model attributes in the form of hash
133
141
  # @return [Object] Returns the model itself
134
142
  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
143
  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)
144
+ attributes = attributes.transform_keys(&:to_sym)
145
+ transformed_hash = {}
146
+ openapi_types.each_pair do |key, type|
147
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
148
+ transformed_hash["#{key}"] = nil
146
149
  elsif type =~ /\AArray<(.*)>/i
147
150
  # check to ensure the input is an array given that the attribute
148
151
  # 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) })
152
+ if attributes[attribute_map[key]].is_a?(Array)
153
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
151
154
  end
152
- elsif !attributes[self.class.attribute_map[key]].nil?
153
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
155
+ elsif !attributes[attribute_map[key]].nil?
156
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
154
157
  end
155
158
  end
156
-
157
- self
159
+ new(transformed_hash)
158
160
  end
159
161
 
160
162
  # Deserializes the data based on type
161
163
  # @param string type Data type
162
164
  # @param string value Value to be deserialized
163
165
  # @return [Object] Deserialized data
164
- def _deserialize(type, value)
166
+ def self._deserialize(type, value)
165
167
  case type.to_sym
166
168
  when :Time
167
169
  Time.parse(value)
@@ -196,7 +198,7 @@ module Svix
196
198
  else # model
197
199
  # models (e.g. Pet) or oneOf
198
200
  klass = Svix.const_get(type)
199
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
201
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
200
202
  end
201
203
  end
202
204