svix 1.60.1 → 1.61.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.
Files changed (279) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +5 -1
  3. data/Gemfile.lock +35 -21
  4. data/README.md +0 -7
  5. data/lib/svix/api/application.rb +96 -0
  6. data/lib/svix/api/authentication.rb +65 -0
  7. data/lib/svix/api/background_task.rb +39 -0
  8. data/lib/svix/api/endpoint.rb +202 -0
  9. data/lib/svix/api/environment.rb +39 -0
  10. data/lib/svix/api/event_type.rb +99 -0
  11. data/lib/svix/api/health.rb +21 -0
  12. data/lib/svix/api/integration.rb +91 -0
  13. data/lib/svix/api/message.rb +112 -0
  14. data/lib/svix/api/message_attempt.rb +123 -0
  15. data/lib/svix/api/operational_webhook_endpoint.rb +109 -0
  16. data/lib/svix/api/statistics.rb +36 -0
  17. data/lib/svix/api_error.rb +7 -17
  18. data/lib/svix/errors.rb +9 -9
  19. data/lib/svix/http_error_out.rb +18 -0
  20. data/lib/svix/http_validation_error.rb +18 -0
  21. data/lib/svix/internal.rb +0 -9
  22. data/lib/svix/models/aggregate_event_types_out.rb +32 -292
  23. data/lib/svix/models/app_portal_access_in.rb +31 -278
  24. data/lib/svix/models/app_portal_access_out.rb +27 -243
  25. data/lib/svix/models/app_usage_stats_in.rb +30 -234
  26. data/lib/svix/models/app_usage_stats_out.rb +31 -320
  27. data/lib/svix/models/application_in.rb +31 -298
  28. data/lib/svix/models/application_out.rb +37 -371
  29. data/lib/svix/models/application_patch.rb +31 -272
  30. data/lib/svix/models/application_token_expire_in.rb +28 -219
  31. data/lib/svix/models/background_task_out.rb +31 -307
  32. data/lib/svix/models/background_task_status.rb +14 -25
  33. data/lib/svix/models/background_task_type.rb +23 -26
  34. data/lib/svix/models/connector_in.rb +58 -385
  35. data/lib/svix/models/connector_kind.rb +28 -26
  36. data/lib/svix/models/dashboard_access_out.rb +27 -243
  37. data/lib/svix/models/endpoint_headers_in.rb +25 -202
  38. data/lib/svix/models/endpoint_headers_out.rb +30 -230
  39. data/lib/svix/models/endpoint_headers_patch_in.rb +28 -202
  40. data/lib/svix/models/endpoint_in.rb +61 -449
  41. data/lib/svix/models/endpoint_message_out.rb +48 -467
  42. data/lib/svix/models/endpoint_out.rb +67 -528
  43. data/lib/svix/models/endpoint_patch.rb +61 -383
  44. data/lib/svix/models/endpoint_secret_out.rb +25 -222
  45. data/lib/svix/models/endpoint_secret_rotate_in.rb +28 -212
  46. data/lib/svix/models/endpoint_stats.rb +31 -245
  47. data/lib/svix/models/endpoint_transformation_in.rb +30 -226
  48. data/lib/svix/models/endpoint_transformation_out.rb +30 -228
  49. data/lib/svix/models/endpoint_update.rb +58 -422
  50. data/lib/svix/models/environment_in.rb +31 -212
  51. data/lib/svix/models/environment_out.rb +35 -255
  52. data/lib/svix/models/event_example_in.rb +27 -261
  53. data/lib/svix/models/event_type_from_open_api.rb +35 -341
  54. data/lib/svix/models/event_type_import_open_api_in.rb +37 -228
  55. data/lib/svix/models/event_type_import_open_api_out.rb +28 -200
  56. data/lib/svix/models/event_type_import_open_api_out_data.rb +31 -211
  57. data/lib/svix/models/event_type_in.rb +37 -347
  58. data/lib/svix/models/event_type_out.rb +58 -389
  59. data/lib/svix/models/event_type_patch.rb +35 -289
  60. data/lib/svix/models/event_type_update.rb +35 -301
  61. data/lib/svix/models/expung_all_contents_out.rb +29 -292
  62. data/lib/svix/models/integration_in.rb +27 -239
  63. data/lib/svix/models/integration_key_out.rb +25 -200
  64. data/lib/svix/models/integration_out.rb +33 -324
  65. data/lib/svix/models/integration_update.rb +27 -239
  66. data/lib/svix/models/list_response_application_out.rb +34 -237
  67. data/lib/svix/models/list_response_background_task_out.rb +34 -237
  68. data/lib/svix/models/list_response_endpoint_message_out.rb +34 -237
  69. data/lib/svix/models/list_response_endpoint_out.rb +34 -237
  70. data/lib/svix/models/list_response_event_type_out.rb +34 -237
  71. data/lib/svix/models/list_response_integration_out.rb +34 -237
  72. data/lib/svix/models/list_response_message_attempt_out.rb +34 -237
  73. data/lib/svix/models/list_response_message_endpoint_out.rb +34 -237
  74. data/lib/svix/models/list_response_message_out.rb +34 -237
  75. data/lib/svix/models/list_response_operational_webhook_endpoint_out.rb +34 -237
  76. data/lib/svix/models/message_attempt_out.rb +64 -521
  77. data/lib/svix/models/message_attempt_trigger_type.rb +20 -28
  78. data/lib/svix/models/message_endpoint_out.rb +70 -557
  79. data/lib/svix/models/message_in.rb +58 -450
  80. data/lib/svix/models/message_out.rb +37 -414
  81. data/lib/svix/models/message_status.rb +24 -30
  82. data/lib/svix/models/operational_webhook_endpoint_headers_in.rb +28 -202
  83. data/lib/svix/models/operational_webhook_endpoint_headers_out.rb +30 -229
  84. data/lib/svix/models/operational_webhook_endpoint_in.rb +42 -380
  85. data/lib/svix/models/operational_webhook_endpoint_out.rb +64 -458
  86. data/lib/svix/models/operational_webhook_endpoint_secret_in.rb +28 -212
  87. data/lib/svix/models/operational_webhook_endpoint_secret_out.rb +28 -222
  88. data/lib/svix/models/operational_webhook_endpoint_update.rb +40 -353
  89. data/lib/svix/models/ordering.rb +15 -25
  90. data/lib/svix/models/recover_in.rb +28 -210
  91. data/lib/svix/models/recover_out.rb +29 -292
  92. data/lib/svix/models/replay_in.rb +28 -210
  93. data/lib/svix/models/replay_out.rb +29 -292
  94. data/lib/svix/models/status_code_class.rb +28 -32
  95. data/lib/svix/models/template_out.rb +70 -514
  96. data/lib/svix/svix.rb +50 -50
  97. data/lib/svix/svix_http_client.rb +110 -0
  98. data/lib/svix/util.rb +44 -25
  99. data/lib/svix/validation_error.rb +28 -0
  100. data/lib/svix/version.rb +1 -1
  101. data/lib/svix/webhook.rb +69 -65
  102. data/lib/svix.rb +51 -37
  103. data/svix.gemspec +1 -10
  104. metadata +22 -194
  105. data/lib/svix/api/application_api.rb +0 -772
  106. data/lib/svix/api/authentication_api.rb +0 -791
  107. data/lib/svix/api/background_tasks_api.rb +0 -191
  108. data/lib/svix/api/broadcast_api.rb +0 -93
  109. data/lib/svix/api/endpoint_api.rb +0 -2752
  110. data/lib/svix/api/environment_api.rb +0 -153
  111. data/lib/svix/api/environment_settings_api.rb +0 -79
  112. data/lib/svix/api/event_type_api.rb +0 -852
  113. data/lib/svix/api/events_api.rb +0 -102
  114. data/lib/svix/api/health_api.rb +0 -79
  115. data/lib/svix/api/inbound_api.rb +0 -209
  116. data/lib/svix/api/integration_api.rb +0 -707
  117. data/lib/svix/api/message_api.rb +0 -1192
  118. data/lib/svix/api/message_attempt_api.rb +0 -1245
  119. data/lib/svix/api/statistics_api.rb +0 -333
  120. data/lib/svix/api/stream_api.rb +0 -659
  121. data/lib/svix/api/stream_event_types_api.rb +0 -486
  122. data/lib/svix/api/transformation_template_api.rb +0 -967
  123. data/lib/svix/api/webhook_endpoint_api.rb +0 -748
  124. data/lib/svix/api_client.rb +0 -423
  125. data/lib/svix/application_api.rb +0 -35
  126. data/lib/svix/authentication_api.rb +0 -21
  127. data/lib/svix/background_tasks_api.rb +0 -17
  128. data/lib/svix/configuration.rb +0 -312
  129. data/lib/svix/endpoint_api.rb +0 -80
  130. data/lib/svix/event_type_api.rb +0 -37
  131. data/lib/svix/integration_api.rb +0 -38
  132. data/lib/svix/message_api.rb +0 -54
  133. data/lib/svix/message_attempt_api.rb +0 -51
  134. data/lib/svix/models/active_application_out.rb +0 -373
  135. data/lib/svix/models/active_endpoint_out.rb +0 -355
  136. data/lib/svix/models/aggregated_event_types.rb +0 -305
  137. data/lib/svix/models/application_message_failure.rb +0 -277
  138. data/lib/svix/models/application_message_id_pair.rb +0 -317
  139. data/lib/svix/models/application_stats.rb +0 -323
  140. data/lib/svix/models/application_stats_out.rb +0 -324
  141. data/lib/svix/models/attempt_statistics_data.rb +0 -229
  142. data/lib/svix/models/attempt_statistics_response.rb +0 -291
  143. data/lib/svix/models/auth_token_out.rb +0 -325
  144. data/lib/svix/models/azure_blob_storage_config.rb +0 -253
  145. data/lib/svix/models/background_task_finished_event.rb +0 -272
  146. data/lib/svix/models/background_task_finished_event2.rb +0 -331
  147. data/lib/svix/models/big_query_config.rb +0 -271
  148. data/lib/svix/models/border_radius_config.rb +0 -254
  149. data/lib/svix/models/border_radius_enum.rb +0 -43
  150. data/lib/svix/models/client_secret_jwt_params_in.rb +0 -297
  151. data/lib/svix/models/completion_choice.rb +0 -253
  152. data/lib/svix/models/completion_message.rb +0 -237
  153. data/lib/svix/models/count_out.rb +0 -258
  154. data/lib/svix/models/create_stream_in.rb +0 -232
  155. data/lib/svix/models/create_token_in.rb +0 -248
  156. data/lib/svix/models/custom_color_palette.rb +0 -295
  157. data/lib/svix/models/custom_strings_override.rb +0 -235
  158. data/lib/svix/models/custom_theme_override.rb +0 -223
  159. data/lib/svix/models/data.rb +0 -108
  160. data/lib/svix/models/data_any_of.rb +0 -240
  161. data/lib/svix/models/data_any_of1.rb +0 -223
  162. data/lib/svix/models/data_any_of2.rb +0 -241
  163. data/lib/svix/models/data_any_of3.rb +0 -223
  164. data/lib/svix/models/data_any_of4.rb +0 -240
  165. data/lib/svix/models/duration.rb +0 -275
  166. data/lib/svix/models/endpoint_created_event.rb +0 -272
  167. data/lib/svix/models/endpoint_created_event_data.rb +0 -410
  168. data/lib/svix/models/endpoint_deleted_event.rb +0 -272
  169. data/lib/svix/models/endpoint_deleted_event_data.rb +0 -410
  170. data/lib/svix/models/endpoint_disabled_event.rb +0 -272
  171. data/lib/svix/models/endpoint_disabled_event_data.rb +0 -451
  172. data/lib/svix/models/endpoint_disabled_trigger.rb +0 -40
  173. data/lib/svix/models/endpoint_enabled_event.rb +0 -272
  174. data/lib/svix/models/endpoint_enabled_event_data.rb +0 -410
  175. data/lib/svix/models/endpoint_mtls_config_in.rb +0 -233
  176. data/lib/svix/models/endpoint_mtls_config_out.rb +0 -215
  177. data/lib/svix/models/endpoint_oauth_config_in.rb +0 -350
  178. data/lib/svix/models/endpoint_oauth_config_out.rb +0 -315
  179. data/lib/svix/models/endpoint_transformation_simulate_in.rb +0 -330
  180. data/lib/svix/models/endpoint_transformation_simulate_out.rb +0 -296
  181. data/lib/svix/models/endpoint_updated_event.rb +0 -272
  182. data/lib/svix/models/endpoint_updated_event_data.rb +0 -410
  183. data/lib/svix/models/environment_settings_out.rb +0 -455
  184. data/lib/svix/models/event_in.rb +0 -258
  185. data/lib/svix/models/event_out.rb +0 -274
  186. data/lib/svix/models/event_stream_out.rb +0 -255
  187. data/lib/svix/models/event_type_example_out.rb +0 -221
  188. data/lib/svix/models/event_type_schema_in.rb +0 -221
  189. data/lib/svix/models/export_event_type_out.rb +0 -315
  190. data/lib/svix/models/font_size_config.rb +0 -230
  191. data/lib/svix/models/generate_in.rb +0 -221
  192. data/lib/svix/models/generate_out.rb +0 -287
  193. data/lib/svix/models/google_cloud_storage_config.rb +0 -239
  194. data/lib/svix/models/http_error_out.rb +0 -237
  195. data/lib/svix/models/http_validation_error.rb +0 -223
  196. data/lib/svix/models/hubspot_oauth_config_in.rb +0 -221
  197. data/lib/svix/models/inbound_path_params.rb +0 -277
  198. data/lib/svix/models/incoming_webhook_payload_out.rb +0 -235
  199. data/lib/svix/models/kafka_security_protocol_type.rb +0 -41
  200. data/lib/svix/models/list_response_active_application_out.rb +0 -261
  201. data/lib/svix/models/list_response_application_stats.rb +0 -261
  202. data/lib/svix/models/list_response_message_attempt_endpoint_out.rb +0 -261
  203. data/lib/svix/models/list_response_sink_out.rb +0 -261
  204. data/lib/svix/models/list_response_stream_event_type_out.rb +0 -261
  205. data/lib/svix/models/list_response_stream_out.rb +0 -261
  206. data/lib/svix/models/list_response_stream_sink_out.rb +0 -261
  207. data/lib/svix/models/list_response_template_out.rb +0 -261
  208. data/lib/svix/models/message_attempt_endpoint_out.rb +0 -545
  209. data/lib/svix/models/message_attempt_exhausted_event.rb +0 -272
  210. data/lib/svix/models/message_attempt_exhausted_event_data.rb +0 -482
  211. data/lib/svix/models/message_attempt_failed_data.rb +0 -293
  212. data/lib/svix/models/message_attempt_failing_event.rb +0 -272
  213. data/lib/svix/models/message_attempt_failing_event_data.rb +0 -482
  214. data/lib/svix/models/message_attempt_headers_out.rb +0 -263
  215. data/lib/svix/models/message_attempt_recovered_event.rb +0 -272
  216. data/lib/svix/models/message_attempt_recovered_event_data.rb +0 -482
  217. data/lib/svix/models/message_broadcast_in.rb +0 -423
  218. data/lib/svix/models/message_broadcast_out.rb +0 -315
  219. data/lib/svix/models/message_events_out.rb +0 -255
  220. data/lib/svix/models/message_precheck_in.rb +0 -288
  221. data/lib/svix/models/message_precheck_out.rb +0 -221
  222. data/lib/svix/models/message_raw_payload_out.rb +0 -221
  223. data/lib/svix/models/message_subscriber_auth_token_out.rb +0 -237
  224. data/lib/svix/models/o_auth_payload_in.rb +0 -237
  225. data/lib/svix/models/o_auth_payload_out.rb +0 -235
  226. data/lib/svix/models/oauth2_auth_method_in_out.rb +0 -41
  227. data/lib/svix/models/oauth2_grant_type_in_out.rb +0 -40
  228. data/lib/svix/models/oauth_jws_signing_algorithm.rb +0 -39
  229. data/lib/svix/models/one_time_token_in.rb +0 -221
  230. data/lib/svix/models/one_time_token_out.rb +0 -221
  231. data/lib/svix/models/polling_endpoint_message_out.rb +0 -454
  232. data/lib/svix/models/polling_endpoint_out.rb +0 -255
  233. data/lib/svix/models/redshift_config.rb +0 -317
  234. data/lib/svix/models/retry_schedule_in_out.rb +0 -216
  235. data/lib/svix/models/rotate_poller_token_in.rb +0 -280
  236. data/lib/svix/models/rotated_url_out.rb +0 -221
  237. data/lib/svix/models/s3_config.rb +0 -269
  238. data/lib/svix/models/sink_http_config.rb +0 -242
  239. data/lib/svix/models/sink_in.rb +0 -108
  240. data/lib/svix/models/sink_in_one_of.rb +0 -287
  241. data/lib/svix/models/sink_in_one_of1.rb +0 -319
  242. data/lib/svix/models/sink_in_one_of2.rb +0 -325
  243. data/lib/svix/models/sink_in_one_of3.rb +0 -271
  244. data/lib/svix/models/sink_in_one_of4.rb +0 -255
  245. data/lib/svix/models/sink_otel_v1_config.rb +0 -221
  246. data/lib/svix/models/sink_out.rb +0 -108
  247. data/lib/svix/models/sink_payload_format.rb +0 -39
  248. data/lib/svix/models/sink_secret_out.rb +0 -233
  249. data/lib/svix/models/sink_status.rb +0 -41
  250. data/lib/svix/models/sink_status_in.rb +0 -40
  251. data/lib/svix/models/sink_transform_in.rb +0 -248
  252. data/lib/svix/models/sink_transformation_out.rb +0 -226
  253. data/lib/svix/models/snowflake_config.rb +0 -287
  254. data/lib/svix/models/statistics_period.rb +0 -40
  255. data/lib/svix/models/stream_event_type_in.rb +0 -262
  256. data/lib/svix/models/stream_event_type_out.rb +0 -294
  257. data/lib/svix/models/stream_event_type_patch.rb +0 -254
  258. data/lib/svix/models/stream_in.rb +0 -287
  259. data/lib/svix/models/stream_out.rb +0 -350
  260. data/lib/svix/models/stream_patch.rb +0 -261
  261. data/lib/svix/models/stream_portal_access_in.rb +0 -293
  262. data/lib/svix/models/stream_sink_in.rb +0 -111
  263. data/lib/svix/models/stream_sink_in_one_of.rb +0 -271
  264. data/lib/svix/models/stream_sink_in_one_of1.rb +0 -271
  265. data/lib/svix/models/stream_sink_in_one_of2.rb +0 -271
  266. data/lib/svix/models/stream_sink_in_one_of3.rb +0 -271
  267. data/lib/svix/models/stream_sink_in_one_of4.rb +0 -271
  268. data/lib/svix/models/stream_sink_in_one_of5.rb +0 -271
  269. data/lib/svix/models/stream_sink_in_one_of6.rb +0 -271
  270. data/lib/svix/models/stream_sink_in_one_of7.rb +0 -271
  271. data/lib/svix/models/stream_sink_out.rb +0 -111
  272. data/lib/svix/models/stream_sink_patch.rb +0 -111
  273. data/lib/svix/models/template_patch.rb +0 -382
  274. data/lib/svix/models/template_update.rb +0 -402
  275. data/lib/svix/models/transformation_http_method.rb +0 -41
  276. data/lib/svix/models/transformation_simulate_in.rb +0 -330
  277. data/lib/svix/models/transformation_simulate_out.rb +0 -296
  278. data/lib/svix/models/validation_error.rb +0 -259
  279. data/lib/svix/statistics_api.rb +0 -17
@@ -1,583 +1,96 @@
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'
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
15
4
 
16
5
  module Svix
17
6
  class MessageEndpointOut
18
- # List of message channels this endpoint listens to (omit for all).
19
7
  attr_accessor :channels
20
-
21
8
  attr_accessor :created_at
22
-
23
- # An example endpoint name.
24
9
  attr_accessor :description
25
-
26
10
  attr_accessor :disabled
27
-
28
11
  attr_accessor :filter_types
29
-
30
- # The Endpoint's ID.
31
12
  attr_accessor :id
32
-
33
13
  attr_accessor :next_attempt
34
-
35
14
  attr_accessor :rate_limit
36
-
37
15
  attr_accessor :status
38
-
39
- # Optional unique identifier for the endpoint.
40
16
  attr_accessor :uid
41
-
42
17
  attr_accessor :updated_at
43
-
44
18
  attr_accessor :url
45
-
46
19
  attr_accessor :version
47
20
 
48
- class EnumAttributeValidator
49
- attr_reader :datatype
50
- attr_reader :allowable_values
51
-
52
- def initialize(datatype, allowable_values)
53
- @allowable_values = allowable_values.map do |value|
54
- case datatype.to_s
55
- when /Integer/i
56
- value.to_i
57
- when /Float/i
58
- value.to_f
59
- else
60
- value
61
- end
62
- end
63
- end
64
-
65
- def valid?(value)
66
- !value || allowable_values.include?(value)
67
- end
68
- end
21
+ ALL_FIELD ||= [
22
+ "channels",
23
+ "created_at",
24
+ "description",
25
+ "disabled",
26
+ "filter_types",
27
+ "id",
28
+ "next_attempt",
29
+ "rate_limit",
30
+ "status",
31
+ "uid",
32
+ "updated_at",
33
+ "url",
34
+ "version"
35
+ ].freeze
36
+ private_constant :ALL_FIELD
69
37
 
70
- # Attribute mapping from ruby-style variable name to JSON key.
71
- def self.attribute_map
72
- {
73
- :'channels' => :'channels',
74
- :'created_at' => :'createdAt',
75
- :'description' => :'description',
76
- :'disabled' => :'disabled',
77
- :'filter_types' => :'filterTypes',
78
- :'id' => :'id',
79
- :'next_attempt' => :'nextAttempt',
80
- :'rate_limit' => :'rateLimit',
81
- :'status' => :'status',
82
- :'uid' => :'uid',
83
- :'updated_at' => :'updatedAt',
84
- :'url' => :'url',
85
- :'version' => :'version'
86
- }
87
- end
88
-
89
- # Returns all the JSON keys this model knows about
90
- def self.acceptable_attributes
91
- attribute_map.values
92
- end
93
-
94
- # Attribute type mapping.
95
- def self.openapi_types
96
- {
97
- :'channels' => :'Array<String>',
98
- :'created_at' => :'Time',
99
- :'description' => :'String',
100
- :'disabled' => :'Boolean',
101
- :'filter_types' => :'Array<String>',
102
- :'id' => :'String',
103
- :'next_attempt' => :'Time',
104
- :'rate_limit' => :'Integer',
105
- :'status' => :'MessageStatus',
106
- :'uid' => :'String',
107
- :'updated_at' => :'Time',
108
- :'url' => :'String',
109
- :'version' => :'Integer'
110
- }
111
- end
112
-
113
- # List of attributes with nullable: true
114
- def self.openapi_nullable
115
- Set.new([
116
- :'channels',
117
- :'filter_types',
118
- :'next_attempt',
119
- :'rate_limit',
120
- :'uid',
121
- ])
122
- end
123
-
124
- # Initializes the object
125
- # @param [Hash] attributes Model attributes in the form of hash
126
38
  def initialize(attributes = {})
127
- if (!attributes.is_a?(Hash))
128
- fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::MessageEndpointOut` initialize method"
129
- end
130
-
131
- # check to see if the attribute exists and convert string to symbol for hash key
132
- attributes = attributes.each_with_object({}) { |(k, v), h|
133
- if (!self.class.attribute_map.key?(k.to_sym))
134
- fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::MessageEndpointOut`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
135
- end
136
- h[k.to_sym] = v
137
- }
138
-
139
- if attributes.key?(:'channels')
140
- if (value = attributes[:'channels']).is_a?(Array)
141
- self.channels = value
142
- end
143
- end
144
-
145
- if attributes.key?(:'created_at')
146
- self.created_at = attributes[:'created_at']
147
- else
148
- self.created_at = nil
149
- end
150
-
151
- if attributes.key?(:'description')
152
- self.description = attributes[:'description']
153
- else
154
- self.description = nil
155
- end
156
-
157
- if attributes.key?(:'disabled')
158
- self.disabled = attributes[:'disabled']
159
- else
160
- self.disabled = false
161
- end
162
-
163
- if attributes.key?(:'filter_types')
164
- if (value = attributes[:'filter_types']).is_a?(Array)
165
- self.filter_types = value
166
- end
167
- end
168
-
169
- if attributes.key?(:'id')
170
- self.id = attributes[:'id']
171
- else
172
- self.id = nil
173
- end
174
-
175
- if attributes.key?(:'next_attempt')
176
- self.next_attempt = attributes[:'next_attempt']
177
- end
178
-
179
- if attributes.key?(:'rate_limit')
180
- self.rate_limit = attributes[:'rate_limit']
181
- end
182
-
183
- if attributes.key?(:'status')
184
- self.status = attributes[:'status']
185
- else
186
- self.status = nil
187
- end
188
-
189
- if attributes.key?(:'uid')
190
- self.uid = attributes[:'uid']
191
- end
192
-
193
- if attributes.key?(:'updated_at')
194
- self.updated_at = attributes[:'updated_at']
195
- else
196
- self.updated_at = nil
197
- end
198
-
199
- if attributes.key?(:'url')
200
- self.url = attributes[:'url']
201
- else
202
- self.url = nil
203
- end
204
-
205
- if attributes.key?(:'version')
206
- self.version = attributes[:'version']
207
- else
208
- self.version = nil
209
- end
210
- end
211
-
212
- # Show invalid properties with the reasons. Usually used together with valid?
213
- # @return Array for valid properties with the reasons
214
- def list_invalid_properties
215
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
216
- invalid_properties = Array.new
217
- if !@channels.nil? && @channels.length > 10
218
- invalid_properties.push('invalid value for "channels", number of items must be less than or equal to 10.')
219
- end
220
-
221
- if !@channels.nil? && @channels.length < 1
222
- invalid_properties.push('invalid value for "channels", number of items must be greater than or equal to 1.')
223
- end
224
-
225
- if @created_at.nil?
226
- invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
227
- end
228
-
229
- if @description.nil?
230
- invalid_properties.push('invalid value for "description", description cannot be nil.')
231
- end
232
-
233
- if !@filter_types.nil? && @filter_types.length < 1
234
- invalid_properties.push('invalid value for "filter_types", number of items must be greater than or equal to 1.')
235
- end
236
-
237
- if @id.nil?
238
- invalid_properties.push('invalid value for "id", id cannot be nil.')
239
- end
240
-
241
- if @id.to_s.length > 30
242
- invalid_properties.push('invalid value for "id", the character length must be smaller than or equal to 30.')
243
- end
244
-
245
- if @id.to_s.length < 30
246
- invalid_properties.push('invalid value for "id", the character length must be great than or equal to 30.')
247
- end
248
-
249
- pattern = Regexp.new(/^ep_[A-Za-z0-9]{27}$/)
250
- if @id !~ pattern
251
- invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
252
- end
253
-
254
- if !@rate_limit.nil? && @rate_limit < 0
255
- invalid_properties.push('invalid value for "rate_limit", must be greater than or equal to 0.')
256
- end
257
-
258
- if @status.nil?
259
- invalid_properties.push('invalid value for "status", status cannot be nil.')
260
- end
261
-
262
- if !@uid.nil? && @uid.to_s.length > 256
263
- invalid_properties.push('invalid value for "uid", the character length must be smaller than or equal to 256.')
264
- end
265
-
266
- if !@uid.nil? && @uid.to_s.length < 1
267
- invalid_properties.push('invalid value for "uid", the character length must be great than or equal to 1.')
268
- end
269
-
270
- pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
271
- if !@uid.nil? && @uid !~ pattern
272
- invalid_properties.push("invalid value for \"uid\", must conform to the pattern #{pattern}.")
273
- end
274
-
275
- if @updated_at.nil?
276
- invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
277
- end
278
-
279
- if @url.nil?
280
- invalid_properties.push('invalid value for "url", url cannot be nil.')
281
- end
282
-
283
- if @url.to_s.length > 65536
284
- invalid_properties.push('invalid value for "url", the character length must be smaller than or equal to 65536.')
285
- end
286
-
287
- if @url.to_s.length < 1
288
- invalid_properties.push('invalid value for "url", the character length must be great than or equal to 1.')
289
- end
290
-
291
- if @version.nil?
292
- invalid_properties.push('invalid value for "version", version cannot be nil.')
293
- end
294
-
295
- if @version < 1
296
- invalid_properties.push('invalid value for "version", must be greater than or equal to 1.')
297
- end
298
-
299
- invalid_properties
300
- end
301
-
302
- # Check to see if the all the properties in the model are valid
303
- # @return true if the model is valid
304
- def valid?
305
- warn '[DEPRECATED] the `valid?` method is obsolete'
306
- return false if !@channels.nil? && @channels.length > 10
307
- return false if !@channels.nil? && @channels.length < 1
308
- return false if @created_at.nil?
309
- return false if @description.nil?
310
- return false if !@filter_types.nil? && @filter_types.length < 1
311
- return false if @id.nil?
312
- return false if @id.to_s.length > 30
313
- return false if @id.to_s.length < 30
314
- return false if @id !~ Regexp.new(/^ep_[A-Za-z0-9]{27}$/)
315
- return false if !@rate_limit.nil? && @rate_limit < 0
316
- return false if @status.nil?
317
- return false if !@uid.nil? && @uid.to_s.length > 256
318
- return false if !@uid.nil? && @uid.to_s.length < 1
319
- return false if !@uid.nil? && @uid !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
320
- return false if @updated_at.nil?
321
- return false if @url.nil?
322
- return false if @url.to_s.length > 65536
323
- return false if @url.to_s.length < 1
324
- return false if @version.nil?
325
- return false if @version < 1
326
- true
327
- end
328
-
329
- # Custom attribute writer method with validation
330
- # @param [Object] channels Value to be assigned
331
- def channels=(channels)
332
- if !channels.nil? && channels.length > 10
333
- fail ArgumentError, 'invalid value for "channels", number of items must be less than or equal to 10.'
334
- end
335
-
336
- if !channels.nil? && channels.length < 1
337
- fail ArgumentError, 'invalid value for "channels", number of items must be greater than or equal to 1.'
338
- end
339
-
340
- @channels = channels
341
- end
342
-
343
- # Custom attribute writer method with validation
344
- # @param [Object] filter_types Value to be assigned
345
- def filter_types=(filter_types)
346
- if !filter_types.nil? && filter_types.length < 1
347
- fail ArgumentError, 'invalid value for "filter_types", number of items must be greater than or equal to 1.'
348
- end
349
-
350
- @filter_types = filter_types
351
- end
352
-
353
- # Custom attribute writer method with validation
354
- # @param [Object] id Value to be assigned
355
- def id=(id)
356
- if id.nil?
357
- fail ArgumentError, 'id cannot be nil'
358
- end
359
-
360
- if id.to_s.length > 30
361
- fail ArgumentError, 'invalid value for "id", the character length must be smaller than or equal to 30.'
362
- end
363
-
364
- if id.to_s.length < 30
365
- fail ArgumentError, 'invalid value for "id", the character length must be great than or equal to 30.'
366
- end
367
-
368
- pattern = Regexp.new(/^ep_[A-Za-z0-9]{27}$/)
369
- if id !~ pattern
370
- fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
371
- end
372
-
373
- @id = id
374
- end
375
-
376
- # Custom attribute writer method with validation
377
- # @param [Object] rate_limit Value to be assigned
378
- def rate_limit=(rate_limit)
379
- if !rate_limit.nil? && rate_limit < 0
380
- fail ArgumentError, 'invalid value for "rate_limit", must be greater than or equal to 0.'
381
- end
382
-
383
- @rate_limit = rate_limit
384
- end
385
-
386
- # Custom attribute writer method with validation
387
- # @param [Object] uid Value to be assigned
388
- def uid=(uid)
389
- if !uid.nil? && uid.to_s.length > 256
390
- fail ArgumentError, 'invalid value for "uid", the character length must be smaller than or equal to 256.'
391
- end
392
-
393
- if !uid.nil? && uid.to_s.length < 1
394
- fail ArgumentError, 'invalid value for "uid", the character length must be great than or equal to 1.'
39
+ unless attributes.is_a?(Hash)
40
+ fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::MessageEndpointOut` new method")
395
41
  end
396
42
 
397
- pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
398
- if !uid.nil? && uid !~ pattern
399
- fail ArgumentError, "invalid value for \"uid\", must conform to the pattern #{pattern}."
400
- end
401
-
402
- @uid = uid
403
- end
404
-
405
- # Custom attribute writer method with validation
406
- # @param [Object] url Value to be assigned
407
- def url=(url)
408
- if url.nil?
409
- fail ArgumentError, 'url cannot be nil'
410
- end
411
-
412
- if url.to_s.length > 65536
413
- fail ArgumentError, 'invalid value for "url", the character length must be smaller than or equal to 65536.'
414
- end
415
-
416
- if url.to_s.length < 1
417
- fail ArgumentError, 'invalid value for "url", the character length must be great than or equal to 1.'
418
- end
419
-
420
- @url = url
421
- end
422
-
423
- # Custom attribute writer method with validation
424
- # @param [Object] version Value to be assigned
425
- def version=(version)
426
- if version.nil?
427
- fail ArgumentError, 'version cannot be nil'
428
- end
429
-
430
- if version < 1
431
- fail ArgumentError, 'invalid value for "version", must be greater than or equal to 1.'
432
- end
433
-
434
- @version = version
435
- end
436
-
437
- # Checks equality by comparing each attribute.
438
- # @param [Object] Object to be compared
439
- def ==(o)
440
- return true if self.equal?(o)
441
- self.class == o.class &&
442
- channels == o.channels &&
443
- created_at == o.created_at &&
444
- description == o.description &&
445
- disabled == o.disabled &&
446
- filter_types == o.filter_types &&
447
- id == o.id &&
448
- next_attempt == o.next_attempt &&
449
- rate_limit == o.rate_limit &&
450
- status == o.status &&
451
- uid == o.uid &&
452
- updated_at == o.updated_at &&
453
- url == o.url &&
454
- version == o.version
455
- end
456
-
457
- # @see the `==` method
458
- # @param [Object] Object to be compared
459
- def eql?(o)
460
- self == o
461
- end
462
-
463
- # Calculates hash code according to all attributes.
464
- # @return [Integer] Hash code
465
- def hash
466
- [channels, created_at, description, disabled, filter_types, id, next_attempt, rate_limit, status, uid, updated_at, url, version].hash
467
- end
468
-
469
- # Builds the object from hash
470
- # @param [Hash] attributes Model attributes in the form of hash
471
- # @return [Object] Returns the model itself
472
- def self.build_from_hash(attributes)
473
- return nil unless attributes.is_a?(Hash)
474
- attributes = attributes.transform_keys(&:to_sym)
475
- transformed_hash = {}
476
- openapi_types.each_pair do |key, type|
477
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
478
- transformed_hash["#{key}"] = nil
479
- elsif type =~ /\AArray<(.*)>/i
480
- # check to ensure the input is an array given that the attribute
481
- # is documented as an array but the input is not
482
- if attributes[attribute_map[key]].is_a?(Array)
483
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
484
- end
485
- elsif !attributes[attribute_map[key]].nil?
486
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
487
- end
488
- end
489
- new(transformed_hash)
490
- end
491
-
492
- # Deserializes the data based on type
493
- # @param string type Data type
494
- # @param string value Value to be deserialized
495
- # @return [Object] Deserialized data
496
- def self._deserialize(type, value)
497
- case type.to_sym
498
- when :Time
499
- Time.parse(value)
500
- when :Date
501
- Date.parse(value)
502
- when :String
503
- value.to_s
504
- when :Integer
505
- value.to_i
506
- when :Float
507
- value.to_f
508
- when :Boolean
509
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
510
- true
511
- else
512
- false
513
- end
514
- when :Object
515
- # generic object (usually a Hash), return directly
516
- value
517
- when /\AArray<(?<inner_type>.+)>\z/
518
- inner_type = Regexp.last_match[:inner_type]
519
- value.map { |v| _deserialize(inner_type, v) }
520
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
521
- k_type = Regexp.last_match[:k_type]
522
- v_type = Regexp.last_match[:v_type]
523
- {}.tap do |hash|
524
- value.each do |k, v|
525
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
526
- end
527
- end
528
- else # model
529
- # models (e.g. Pet) or oneOf
530
- klass = Svix.const_get(type)
531
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
532
- end
533
- end
534
-
535
- # Returns the string representation of the object
536
- # @return [String] String presentation of the object
537
- def to_s
538
- to_hash.to_s
539
- end
540
-
541
- # to_body is an alias to to_hash (backward compatibility)
542
- # @return [Hash] Returns the object in the form of hash
543
- def to_body
544
- to_hash
545
- end
546
-
547
- # Returns the object in the form of hash
548
- # @return [Hash] Returns the object in the form of hash
549
- def to_hash
550
- hash = {}
551
- self.class.attribute_map.each_pair do |attr, param|
552
- value = self.send(attr)
553
- if value.nil?
554
- is_nullable = self.class.openapi_nullable.include?(attr)
555
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
43
+ attributes.each do |k, v|
44
+ unless ALL_FIELD.include?(k.to_s)
45
+ fail(ArgumentError, "The field #{k} is not part of Svix::MessageEndpointOut")
556
46
  end
557
47
 
558
- hash[param] = _to_hash(value)
559
- end
560
- hash
48
+ instance_variable_set("@#{k}", v)
49
+ instance_variable_set("@__#{k}_is_defined", true)
50
+ end
51
+ end
52
+
53
+ def self.deserialize(attributes = {})
54
+ attributes = attributes.transform_keys(&:to_s)
55
+ attrs = Hash.new
56
+ attrs["channels"] = attributes["channels"]
57
+ attrs["created_at"] = DateTime.rfc3339(attributes["createdAt"]).to_time
58
+ attrs["description"] = attributes["description"]
59
+ attrs["disabled"] = attributes["disabled"]
60
+ attrs["filter_types"] = attributes["filterTypes"]
61
+ attrs["id"] = attributes["id"]
62
+ attrs["next_attempt"] = DateTime.rfc3339(attributes["nextAttempt"]).to_time if attributes["nextAttempt"]
63
+ attrs["rate_limit"] = attributes["rateLimit"]
64
+ attrs["status"] = Svix::MessageStatus.deserialize(attributes["status"])
65
+ attrs["uid"] = attributes["uid"]
66
+ attrs["updated_at"] = DateTime.rfc3339(attributes["updatedAt"]).to_time
67
+ attrs["url"] = attributes["url"]
68
+ attrs["version"] = attributes["version"]
69
+ new(attrs)
70
+ end
71
+
72
+ def serialize
73
+ out = Hash.new
74
+ out["channels"] = Svix::serialize_primitive(@channels) if @channels
75
+ out["createdAt"] = Svix::serialize_primitive(@created_at) if @created_at
76
+ out["description"] = Svix::serialize_primitive(@description) if @description
77
+ out["disabled"] = Svix::serialize_primitive(@disabled) if @disabled
78
+ out["filterTypes"] = Svix::serialize_primitive(@filter_types) if @filter_types
79
+ out["id"] = Svix::serialize_primitive(@id) if @id
80
+ out["nextAttempt"] = Svix::serialize_primitive(@next_attempt) if @next_attempt
81
+ out["rateLimit"] = Svix::serialize_primitive(@rate_limit) if @rate_limit
82
+ out["status"] = @status.serialize if @status
83
+ out["uid"] = Svix::serialize_primitive(@uid) if @uid
84
+ out["updatedAt"] = Svix::serialize_primitive(@updated_at) if @updated_at
85
+ out["url"] = Svix::serialize_primitive(@url) if @url
86
+ out["version"] = Svix::serialize_primitive(@version) if @version
87
+ out
88
+ end
89
+
90
+ # Serializes the object to a json string
91
+ # @return String
92
+ def to_json
93
+ JSON.dump(serialize)
561
94
  end
562
-
563
- # Outputs non-array value in the form of hash
564
- # For object, use to_hash. Otherwise, just return the value
565
- # @param [Object] value Any valid value
566
- # @return [Hash] Returns the value in the form of hash
567
- def _to_hash(value)
568
- if value.is_a?(Array)
569
- value.compact.map { |v| _to_hash(v) }
570
- elsif value.is_a?(Hash)
571
- {}.tap do |hash|
572
- value.each { |k, v| hash[k] = _to_hash(v) }
573
- end
574
- elsif value.respond_to? :to_hash
575
- value.to_hash
576
- else
577
- value
578
- end
579
- end
580
-
581
95
  end
582
-
583
96
  end