hooksniff 0.3.0 → 1.0.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 (209) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -0
  3. data/Gemfile.lock +56 -0
  4. data/README.md +23 -199
  5. data/Rakefile +2 -0
  6. data/hooksniff.gemspec +48 -0
  7. data/lib/hooksniff/api/authentication.rb +36 -0
  8. data/lib/hooksniff/api/endpoint.rb +102 -0
  9. data/lib/hooksniff/api/event_type.rb +66 -0
  10. data/lib/hooksniff/api/health.rb +16 -0
  11. data/lib/hooksniff/api/message.rb +48 -0
  12. data/lib/hooksniff/api/message_attempt.rb +38 -0
  13. data/lib/hooksniff/api/statistics.rb +37 -0
  14. data/lib/{openapi_client → hooksniff}/api_error.rb +8 -18
  15. data/lib/hooksniff/errors.rb +129 -0
  16. data/lib/hooksniff/hooksniff.rb +36 -0
  17. data/lib/hooksniff/hooksniff_http_client.rb +128 -0
  18. data/lib/hooksniff/http_error_out.rb +18 -0
  19. data/lib/hooksniff/http_validation_error.rb +18 -0
  20. data/lib/hooksniff/internal.rb +7 -0
  21. data/lib/hooksniff/models/aggregate_event_types_out.rb +59 -0
  22. data/lib/hooksniff/models/endpoint_created_event.rb +50 -0
  23. data/lib/hooksniff/models/endpoint_created_event_data.rb +63 -0
  24. data/lib/hooksniff/models/endpoint_deleted_event.rb +50 -0
  25. data/lib/hooksniff/models/endpoint_deleted_event_data.rb +63 -0
  26. data/lib/hooksniff/models/endpoint_disabled_event.rb +53 -0
  27. data/lib/hooksniff/models/endpoint_disabled_event_data.rb +69 -0
  28. data/lib/hooksniff/models/endpoint_enabled_event.rb +50 -0
  29. data/lib/hooksniff/models/endpoint_enabled_event_data.rb +63 -0
  30. data/lib/hooksniff/models/endpoint_headers_in.rb +46 -0
  31. data/lib/hooksniff/models/endpoint_headers_out.rb +52 -0
  32. data/lib/hooksniff/models/endpoint_headers_patch_in.rb +53 -0
  33. data/lib/hooksniff/models/endpoint_in.rb +102 -0
  34. data/lib/hooksniff/models/endpoint_out.rb +104 -0
  35. data/lib/hooksniff/models/endpoint_patch.rb +97 -0
  36. data/lib/hooksniff/models/endpoint_secret_out.rb +50 -0
  37. data/lib/hooksniff/models/endpoint_secret_rotate_in.rb +53 -0
  38. data/lib/hooksniff/models/endpoint_update.rb +90 -0
  39. data/lib/hooksniff/models/endpoint_updated_event.rb +50 -0
  40. data/lib/hooksniff/models/endpoint_updated_event_data.rb +63 -0
  41. data/lib/hooksniff/models/event_in.rb +50 -0
  42. data/lib/hooksniff/models/event_out.rb +53 -0
  43. data/lib/hooksniff/models/event_type_in.rb +80 -0
  44. data/lib/hooksniff/models/event_type_out.rb +87 -0
  45. data/lib/hooksniff/models/event_type_patch.rb +66 -0
  46. data/lib/hooksniff/models/event_type_update.rb +67 -0
  47. data/lib/hooksniff/models/list_response_endpoint_out.rb +58 -0
  48. data/lib/hooksniff/models/list_response_event_type_out.rb +58 -0
  49. data/lib/hooksniff/models/list_response_message_attempt_out.rb +58 -0
  50. data/lib/hooksniff/models/list_response_message_out.rb +58 -0
  51. data/lib/hooksniff/models/message_attempt_exhausted_event.rb +53 -0
  52. data/lib/hooksniff/models/message_attempt_exhausted_event_data.rb +70 -0
  53. data/lib/hooksniff/models/message_attempt_failed_data.rb +56 -0
  54. data/lib/hooksniff/models/message_attempt_failing_event.rb +54 -0
  55. data/lib/hooksniff/models/message_attempt_failing_event_data.rb +70 -0
  56. data/lib/hooksniff/models/message_attempt_log.rb +112 -0
  57. data/lib/hooksniff/models/message_attempt_log_event.rb +53 -0
  58. data/lib/hooksniff/models/message_attempt_out.rb +96 -0
  59. data/lib/hooksniff/models/message_attempt_recovered_event.rb +53 -0
  60. data/lib/hooksniff/models/message_attempt_recovered_event_data.rb +70 -0
  61. data/lib/hooksniff/models/message_attempt_trigger_type.rb +33 -0
  62. data/lib/hooksniff/models/message_endpoint_out.rb +112 -0
  63. data/lib/hooksniff/models/message_in.rb +100 -0
  64. data/lib/hooksniff/models/message_out.rb +71 -0
  65. data/lib/hooksniff/models/message_status.rb +39 -0
  66. data/lib/hooksniff/models/message_status_text.rb +32 -0
  67. data/lib/hooksniff/models/ordering.rb +30 -0
  68. data/lib/hooksniff/models/status_code_class.rb +41 -0
  69. data/lib/hooksniff/util.rb +69 -0
  70. data/lib/hooksniff/validation_error.rb +28 -0
  71. data/lib/hooksniff/version.rb +5 -0
  72. data/lib/hooksniff/webhook.rb +84 -0
  73. data/lib/hooksniff.rb +78 -0
  74. data/test/test_hooksniff.rb +86 -0
  75. metadata +127 -163
  76. data/lib/openapi_client/api/admin_api.rb +0 -452
  77. data/lib/openapi_client/api/alerts_api.rb +0 -322
  78. data/lib/openapi_client/api/analytics_api.rb +0 -208
  79. data/lib/openapi_client/api/api_keys_api.rb +0 -252
  80. data/lib/openapi_client/api/audit_log_api.rb +0 -140
  81. data/lib/openapi_client/api/auth_api.rb +0 -1080
  82. data/lib/openapi_client/api/billing_api.rb +0 -500
  83. data/lib/openapi_client/api/contact_api.rb +0 -88
  84. data/lib/openapi_client/api/custom_domains_api.rb +0 -253
  85. data/lib/openapi_client/api/customer_portal_api.rb +0 -700
  86. data/lib/openapi_client/api/delivery_details_api.rb +0 -146
  87. data/lib/openapi_client/api/devices_api.rb +0 -202
  88. data/lib/openapi_client/api/embed_api.rb +0 -128
  89. data/lib/openapi_client/api/endpoints_api.rb +0 -468
  90. data/lib/openapi_client/api/events_api.rb +0 -75
  91. data/lib/openapi_client/api/health_api.rb +0 -193
  92. data/lib/openapi_client/api/inbound_api.rb +0 -170
  93. data/lib/openapi_client/api/notifications_api.rb +0 -309
  94. data/lib/openapi_client/api/o_auth_api.rb +0 -181
  95. data/lib/openapi_client/api/outbound_ips_api.rb +0 -77
  96. data/lib/openapi_client/api/playground_api.rb +0 -143
  97. data/lib/openapi_client/api/rate_limits_api.rb +0 -252
  98. data/lib/openapi_client/api/routing_api.rb +0 -393
  99. data/lib/openapi_client/api/schemas_api.rb +0 -268
  100. data/lib/openapi_client/api/search_api.rb +0 -96
  101. data/lib/openapi_client/api/simulator_api.rb +0 -82
  102. data/lib/openapi_client/api/sso_api.rb +0 -241
  103. data/lib/openapi_client/api/stats_api.rb +0 -77
  104. data/lib/openapi_client/api/stream_api.rb +0 -88
  105. data/lib/openapi_client/api/teams_api.rb +0 -476
  106. data/lib/openapi_client/api/templates_api.rb +0 -213
  107. data/lib/openapi_client/api/transforms_api.rb +0 -368
  108. data/lib/openapi_client/api/webhooks_api.rb +0 -534
  109. data/lib/openapi_client/api_client.rb +0 -397
  110. data/lib/openapi_client/api_model_base.rb +0 -88
  111. data/lib/openapi_client/configuration.rb +0 -312
  112. data/lib/openapi_client/models/admin_revenue_get200_response_inner.rb +0 -165
  113. data/lib/openapi_client/models/admin_sdk_update_post_request.rb +0 -156
  114. data/lib/openapi_client/models/admin_users_id_plan_put_request.rb +0 -181
  115. data/lib/openapi_client/models/admin_users_id_status_put_request.rb +0 -147
  116. data/lib/openapi_client/models/alert_rule.rb +0 -237
  117. data/lib/openapi_client/models/api_key_info.rb +0 -185
  118. data/lib/openapi_client/models/apply_template_request.rb +0 -173
  119. data/lib/openapi_client/models/apply_template_response.rb +0 -156
  120. data/lib/openapi_client/models/auth2fa_enable_post200_response.rb +0 -156
  121. data/lib/openapi_client/models/auth_login_post200_response.rb +0 -104
  122. data/lib/openapi_client/models/auth_response.rb +0 -167
  123. data/lib/openapi_client/models/batch_replay_request.rb +0 -166
  124. data/lib/openapi_client/models/batch_response.rb +0 -160
  125. data/lib/openapi_client/models/batch_response_errors_inner.rb +0 -156
  126. data/lib/openapi_client/models/batch_webhook_request.rb +0 -166
  127. data/lib/openapi_client/models/billing_portal_post200_response.rb +0 -147
  128. data/lib/openapi_client/models/change_password_request.rb +0 -199
  129. data/lib/openapi_client/models/change_role_request.rb +0 -188
  130. data/lib/openapi_client/models/confirm2fa_request.rb +0 -182
  131. data/lib/openapi_client/models/contact_request.rb +0 -242
  132. data/lib/openapi_client/models/contact_response.rb +0 -156
  133. data/lib/openapi_client/models/create_alert_request.rb +0 -277
  134. data/lib/openapi_client/models/create_api_key_response.rb +0 -175
  135. data/lib/openapi_client/models/create_endpoint_request.rb +0 -288
  136. data/lib/openapi_client/models/create_team_request.rb +0 -164
  137. data/lib/openapi_client/models/create_transform_rule_request.rb +0 -216
  138. data/lib/openapi_client/models/create_webhook_request.rb +0 -201
  139. data/lib/openapi_client/models/custom_domains_post_request.rb +0 -147
  140. data/lib/openapi_client/models/customer_response.rb +0 -256
  141. data/lib/openapi_client/models/delivery.rb +0 -246
  142. data/lib/openapi_client/models/delivery_attempt.rb +0 -205
  143. data/lib/openapi_client/models/delivery_list_response.rb +0 -176
  144. data/lib/openapi_client/models/delivery_trend_response.rb +0 -158
  145. data/lib/openapi_client/models/delivery_trend_response_buckets_inner.rb +0 -174
  146. data/lib/openapi_client/models/device_token_response.rb +0 -174
  147. data/lib/openapi_client/models/disable2fa_request.rb +0 -164
  148. data/lib/openapi_client/models/enable2fa_request.rb +0 -164
  149. data/lib/openapi_client/models/endpoint.rb +0 -321
  150. data/lib/openapi_client/models/endpoint_health.rb +0 -183
  151. data/lib/openapi_client/models/endpoints_endpoint_id_transforms_test_post_request.rb +0 -156
  152. data/lib/openapi_client/models/endpoints_id_rotate_secret_post200_response.rb +0 -156
  153. data/lib/openapi_client/models/error.rb +0 -165
  154. data/lib/openapi_client/models/forgot_password_request.rb +0 -164
  155. data/lib/openapi_client/models/invite_request.rb +0 -207
  156. data/lib/openapi_client/models/invoice_response.rb +0 -183
  157. data/lib/openapi_client/models/latency_trend_response.rb +0 -167
  158. data/lib/openapi_client/models/latency_trend_response_buckets_inner.rb +0 -165
  159. data/lib/openapi_client/models/login_request.rb +0 -190
  160. data/lib/openapi_client/models/notification.rb +0 -193
  161. data/lib/openapi_client/models/notification_list_response.rb +0 -167
  162. data/lib/openapi_client/models/notification_preferences.rb +0 -201
  163. data/lib/openapi_client/models/notifications_unread_count_get200_response.rb +0 -147
  164. data/lib/openapi_client/models/outbound_ips_response.rb +0 -158
  165. data/lib/openapi_client/models/paginated_users.rb +0 -176
  166. data/lib/openapi_client/models/playground_get200_response.rb +0 -160
  167. data/lib/openapi_client/models/portal_notifications_put200_response.rb +0 -156
  168. data/lib/openapi_client/models/portal_profile.rb +0 -184
  169. data/lib/openapi_client/models/refresh_token_request.rb +0 -164
  170. data/lib/openapi_client/models/register_device_request.rb +0 -208
  171. data/lib/openapi_client/models/register_request.rb +0 -201
  172. data/lib/openapi_client/models/register_schema_request.rb +0 -191
  173. data/lib/openapi_client/models/resend_verification_request.rb +0 -164
  174. data/lib/openapi_client/models/reset_password_request.rb +0 -199
  175. data/lib/openapi_client/models/retry_policy.rb +0 -216
  176. data/lib/openapi_client/models/routing_info.rb +0 -193
  177. data/lib/openapi_client/models/search_result.rb +0 -158
  178. data/lib/openapi_client/models/simulator_post_request.rb +0 -165
  179. data/lib/openapi_client/models/sso_config_post_request.rb +0 -190
  180. data/lib/openapi_client/models/stats_response.rb +0 -210
  181. data/lib/openapi_client/models/stream_params.rb +0 -201
  182. data/lib/openapi_client/models/subscription_response.rb +0 -201
  183. data/lib/openapi_client/models/success_rate_response.rb +0 -183
  184. data/lib/openapi_client/models/system_stats.rb +0 -185
  185. data/lib/openapi_client/models/system_stats_plan_breakdown_inner.rb +0 -156
  186. data/lib/openapi_client/models/system_status.rb +0 -210
  187. data/lib/openapi_client/models/system_status_components_inner.rb +0 -184
  188. data/lib/openapi_client/models/team.rb +0 -165
  189. data/lib/openapi_client/models/team_detail_response.rb +0 -169
  190. data/lib/openapi_client/models/team_invite.rb +0 -174
  191. data/lib/openapi_client/models/team_member.rb +0 -193
  192. data/lib/openapi_client/models/test_webhook_request.rb +0 -199
  193. data/lib/openapi_client/models/test_webhook_response.rb +0 -174
  194. data/lib/openapi_client/models/transform_rule.rb +0 -201
  195. data/lib/openapi_client/models/two_factor_required_response.rb +0 -165
  196. data/lib/openapi_client/models/update_endpoint_request.rb +0 -278
  197. data/lib/openapi_client/models/update_notification_preferences.rb +0 -195
  198. data/lib/openapi_client/models/update_profile_request.rb +0 -190
  199. data/lib/openapi_client/models/update_routing_request.rb +0 -190
  200. data/lib/openapi_client/models/upgrade_request.rb +0 -209
  201. data/lib/openapi_client/models/upgrade_response.rb +0 -166
  202. data/lib/openapi_client/models/usage_response.rb +0 -201
  203. data/lib/openapi_client/models/user_summary.rb +0 -193
  204. data/lib/openapi_client/models/validate_event_request.rb +0 -164
  205. data/lib/openapi_client/models/verify2fa_request.rb +0 -208
  206. data/lib/openapi_client/models/verify_email_request.rb +0 -164
  207. data/lib/openapi_client/models/webhook_template.rb +0 -183
  208. data/lib/openapi_client/version.rb +0 -15
  209. data/lib/openapi_client.rb +0 -169
@@ -0,0 +1,112 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class MessageAttemptLog
7
+ # The Application's ID.
8
+ attr_accessor :app_id
9
+ # The Application's UID.
10
+ attr_accessor :app_uid
11
+ attr_accessor :attempt_count
12
+ attr_accessor :attempt_end
13
+ # The MessageAttempt's ID.
14
+ attr_accessor :attempt_id
15
+ attr_accessor :attempt_start
16
+ # The Endpoint's ID.
17
+ attr_accessor :endpoint_id
18
+ # The event type's name
19
+ attr_accessor :event_type
20
+ attr_accessor :http_times
21
+ attr_accessor :msg_created
22
+ # The Message's UID.
23
+ attr_accessor :msg_event_id
24
+ # The Message's ID.
25
+ attr_accessor :msg_id
26
+ # The Environment's ID.
27
+ attr_accessor :org_id
28
+ attr_accessor :response_status_code
29
+ attr_accessor :status
30
+
31
+ ALL_FIELD ||= [
32
+ "app_id",
33
+ "app_uid",
34
+ "attempt_count",
35
+ "attempt_end",
36
+ "attempt_id",
37
+ "attempt_start",
38
+ "endpoint_id",
39
+ "event_type",
40
+ "http_times",
41
+ "msg_created",
42
+ "msg_event_id",
43
+ "msg_id",
44
+ "org_id",
45
+ "response_status_code",
46
+ "status"
47
+ ].freeze
48
+ private_constant :ALL_FIELD
49
+
50
+ def initialize(attributes = {})
51
+ unless attributes.is_a?(Hash)
52
+ fail(ArgumentError, "The input argument (attributes) must be a hash in `HookSniff::MessageAttemptLog` new method")
53
+ end
54
+
55
+ attributes.each do |k, v|
56
+ unless ALL_FIELD.include?(k.to_s)
57
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::MessageAttemptLog")
58
+ end
59
+
60
+ instance_variable_set("@#{k}", v)
61
+ instance_variable_set("@__#{k}_is_defined", true)
62
+ end
63
+ end
64
+
65
+ def self.deserialize(attributes = {})
66
+ attributes = attributes.transform_keys(&:to_s)
67
+ attrs = Hash.new
68
+ attrs["app_id"] = attributes["appId"]
69
+ attrs["app_uid"] = attributes["appUid"]
70
+ attrs["attempt_count"] = attributes["attemptCount"]
71
+ attrs["attempt_end"] = DateTime.rfc3339(attributes["attemptEnd"]).to_time
72
+ attrs["attempt_id"] = attributes["attemptId"]
73
+ attrs["attempt_start"] = DateTime.rfc3339(attributes["attemptStart"]).to_time
74
+ attrs["endpoint_id"] = attributes["endpointId"]
75
+ attrs["event_type"] = attributes["eventType"]
76
+ attrs["http_times"] = HookSniff::HttpAttemptTimes.deserialize(attributes["httpTimes"]) if attributes["httpTimes"]
77
+ attrs["msg_created"] = DateTime.rfc3339(attributes["msgCreated"]).to_time
78
+ attrs["msg_event_id"] = attributes["msgEventId"]
79
+ attrs["msg_id"] = attributes["msgId"]
80
+ attrs["org_id"] = attributes["orgId"]
81
+ attrs["response_status_code"] = attributes["responseStatusCode"]
82
+ attrs["status"] = HookSniff::MessageStatus.deserialize(attributes["status"])
83
+ new(attrs)
84
+ end
85
+
86
+ def serialize
87
+ out = Hash.new
88
+ out["appId"] = HookSniff::serialize_primitive(@app_id) if @app_id
89
+ out["appUid"] = HookSniff::serialize_primitive(@app_uid) if @app_uid
90
+ out["attemptCount"] = HookSniff::serialize_primitive(@attempt_count) if @attempt_count
91
+ out["attemptEnd"] = HookSniff::serialize_primitive(@attempt_end) if @attempt_end
92
+ out["attemptId"] = HookSniff::serialize_primitive(@attempt_id) if @attempt_id
93
+ out["attemptStart"] = HookSniff::serialize_primitive(@attempt_start) if @attempt_start
94
+ out["endpointId"] = HookSniff::serialize_primitive(@endpoint_id) if @endpoint_id
95
+ out["eventType"] = HookSniff::serialize_primitive(@event_type) if @event_type
96
+ out["httpTimes"] = HookSniff::serialize_schema_ref(@http_times) if @http_times
97
+ out["msgCreated"] = HookSniff::serialize_primitive(@msg_created) if @msg_created
98
+ out["msgEventId"] = HookSniff::serialize_primitive(@msg_event_id) if @msg_event_id
99
+ out["msgId"] = HookSniff::serialize_primitive(@msg_id) if @msg_id
100
+ out["orgId"] = HookSniff::serialize_primitive(@org_id) if @org_id
101
+ out["responseStatusCode"] = HookSniff::serialize_primitive(@response_status_code) if @response_status_code
102
+ out["status"] = HookSniff::serialize_schema_ref(@status) if @status
103
+ out
104
+ end
105
+
106
+ # Serializes the object to a json string
107
+ # @return String
108
+ def to_json
109
+ JSON.dump(serialize)
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ # Sent after message attempts are made. Contains metadata about message attempts and their results. In order to reduce the frequency of webhooks, these are sent in batches periodically.
7
+ class MessageAttemptLogEvent
8
+ attr_accessor :data
9
+ attr_accessor :type
10
+
11
+ ALL_FIELD ||= ["data", "type"].freeze
12
+ private_constant :ALL_FIELD
13
+
14
+ def initialize(attributes = {})
15
+ unless attributes.is_a?(Hash)
16
+ fail(
17
+ ArgumentError,
18
+ "The input argument (attributes) must be a hash in `HookSniff::MessageAttemptLogEvent` new method"
19
+ )
20
+ end
21
+
22
+ attributes.each do |k, v|
23
+ unless ALL_FIELD.include?(k.to_s)
24
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::MessageAttemptLogEvent")
25
+ end
26
+
27
+ instance_variable_set("@#{k}", v)
28
+ instance_variable_set("@__#{k}_is_defined", true)
29
+ end
30
+ end
31
+
32
+ def self.deserialize(attributes = {})
33
+ attributes = attributes.transform_keys(&:to_s)
34
+ attrs = Hash.new
35
+ attrs["data"] = attributes["data"].map { |v| HookSniff::MessageAttemptLog.deserialize(v) }
36
+ attrs["type"] = attributes["type"]
37
+ new(attrs)
38
+ end
39
+
40
+ def serialize
41
+ out = Hash.new
42
+ out["data"] = @data.map { |v| v.serialize } if @data
43
+ out["type"] = HookSniff::serialize_primitive(@type) if @type
44
+ out
45
+ end
46
+
47
+ # Serializes the object to a json string
48
+ # @return String
49
+ def to_json
50
+ JSON.dump(serialize)
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class MessageAttemptOut
7
+ # The Endpoint's ID.
8
+ attr_accessor :endpoint_id
9
+ # The MessageAttempt's ID.
10
+ attr_accessor :id
11
+ attr_accessor :msg
12
+ # The Message's ID.
13
+ attr_accessor :msg_id
14
+ attr_accessor :response
15
+ # Response duration in milliseconds.
16
+ attr_accessor :response_duration_ms
17
+ attr_accessor :response_status_code
18
+ attr_accessor :status
19
+ attr_accessor :status_text
20
+ attr_accessor :timestamp
21
+ attr_accessor :trigger_type
22
+ attr_accessor :url
23
+
24
+ ALL_FIELD ||= [
25
+ "endpoint_id",
26
+ "id",
27
+ "msg",
28
+ "msg_id",
29
+ "response",
30
+ "response_duration_ms",
31
+ "response_status_code",
32
+ "status",
33
+ "status_text",
34
+ "timestamp",
35
+ "trigger_type",
36
+ "url"
37
+ ].freeze
38
+ private_constant :ALL_FIELD
39
+
40
+ def initialize(attributes = {})
41
+ unless attributes.is_a?(Hash)
42
+ fail(ArgumentError, "The input argument (attributes) must be a hash in `HookSniff::MessageAttemptOut` new method")
43
+ end
44
+
45
+ attributes.each do |k, v|
46
+ unless ALL_FIELD.include?(k.to_s)
47
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::MessageAttemptOut")
48
+ end
49
+
50
+ instance_variable_set("@#{k}", v)
51
+ instance_variable_set("@__#{k}_is_defined", true)
52
+ end
53
+ end
54
+
55
+ def self.deserialize(attributes = {})
56
+ attributes = attributes.transform_keys(&:to_s)
57
+ attrs = Hash.new
58
+ attrs["endpoint_id"] = attributes["endpointId"]
59
+ attrs["id"] = attributes["id"]
60
+ attrs["msg"] = HookSniff::MessageOut.deserialize(attributes["msg"]) if attributes["msg"]
61
+ attrs["msg_id"] = attributes["msgId"]
62
+ attrs["response"] = attributes["response"]
63
+ attrs["response_duration_ms"] = attributes["responseDurationMs"]
64
+ attrs["response_status_code"] = attributes["responseStatusCode"]
65
+ attrs["status"] = HookSniff::MessageStatus.deserialize(attributes["status"])
66
+ attrs["status_text"] = HookSniff::MessageStatusText.deserialize(attributes["statusText"])
67
+ attrs["timestamp"] = DateTime.rfc3339(attributes["timestamp"]).to_time
68
+ attrs["trigger_type"] = HookSniff::MessageAttemptTriggerType.deserialize(attributes["triggerType"])
69
+ attrs["url"] = attributes["url"]
70
+ new(attrs)
71
+ end
72
+
73
+ def serialize
74
+ out = Hash.new
75
+ out["endpointId"] = HookSniff::serialize_primitive(@endpoint_id) if @endpoint_id
76
+ out["id"] = HookSniff::serialize_primitive(@id) if @id
77
+ out["msg"] = HookSniff::serialize_schema_ref(@msg) if @msg
78
+ out["msgId"] = HookSniff::serialize_primitive(@msg_id) if @msg_id
79
+ out["response"] = HookSniff::serialize_primitive(@response) if @response
80
+ out["responseDurationMs"] = HookSniff::serialize_primitive(@response_duration_ms) if @response_duration_ms
81
+ out["responseStatusCode"] = HookSniff::serialize_primitive(@response_status_code) if @response_status_code
82
+ out["status"] = HookSniff::serialize_schema_ref(@status) if @status
83
+ out["statusText"] = HookSniff::serialize_schema_ref(@status_text) if @status_text
84
+ out["timestamp"] = HookSniff::serialize_primitive(@timestamp) if @timestamp
85
+ out["triggerType"] = HookSniff::serialize_schema_ref(@trigger_type) if @trigger_type
86
+ out["url"] = HookSniff::serialize_primitive(@url) if @url
87
+ out
88
+ end
89
+
90
+ # Serializes the object to a json string
91
+ # @return String
92
+ def to_json
93
+ JSON.dump(serialize)
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ # Sent on a successful dispatch after an earlier failure op webhook has already been sent.
7
+ class MessageAttemptRecoveredEvent
8
+ attr_accessor :data
9
+ attr_accessor :type
10
+
11
+ ALL_FIELD ||= ["data", "type"].freeze
12
+ private_constant :ALL_FIELD
13
+
14
+ def initialize(attributes = {})
15
+ unless attributes.is_a?(Hash)
16
+ fail(
17
+ ArgumentError,
18
+ "The input argument (attributes) must be a hash in `HookSniff::MessageAttemptRecoveredEvent` new method"
19
+ )
20
+ end
21
+
22
+ attributes.each do |k, v|
23
+ unless ALL_FIELD.include?(k.to_s)
24
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::MessageAttemptRecoveredEvent")
25
+ end
26
+
27
+ instance_variable_set("@#{k}", v)
28
+ instance_variable_set("@__#{k}_is_defined", true)
29
+ end
30
+ end
31
+
32
+ def self.deserialize(attributes = {})
33
+ attributes = attributes.transform_keys(&:to_s)
34
+ attrs = Hash.new
35
+ attrs["data"] = HookSniff::MessageAttemptRecoveredEventData.deserialize(attributes["data"])
36
+ attrs["type"] = attributes["type"]
37
+ new(attrs)
38
+ end
39
+
40
+ def serialize
41
+ out = Hash.new
42
+ out["data"] = HookSniff::serialize_schema_ref(@data) if @data
43
+ out["type"] = HookSniff::serialize_primitive(@type) if @type
44
+ out
45
+ end
46
+
47
+ # Serializes the object to a json string
48
+ # @return String
49
+ def to_json
50
+ JSON.dump(serialize)
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ # Sent when a message delivery has failed (all of the retry attempts have been exhausted) as a "message.attempt.exhausted" type or after it's failed four times as a "message.attempt.failing" event.
7
+ class MessageAttemptRecoveredEventData
8
+ # The Application's ID.
9
+ attr_accessor :app_id
10
+ # The Application's UID.
11
+ attr_accessor :app_uid
12
+ # The Endpoint's ID.
13
+ attr_accessor :endpoint_id
14
+ attr_accessor :last_attempt
15
+ # The Message's UID.
16
+ attr_accessor :msg_event_id
17
+ # The Message's ID.
18
+ attr_accessor :msg_id
19
+
20
+ ALL_FIELD ||= ["app_id", "app_uid", "endpoint_id", "last_attempt", "msg_event_id", "msg_id"].freeze
21
+ private_constant :ALL_FIELD
22
+
23
+ def initialize(attributes = {})
24
+ unless attributes.is_a?(Hash)
25
+ fail(
26
+ ArgumentError,
27
+ "The input argument (attributes) must be a hash in `HookSniff::MessageAttemptRecoveredEventData` new method"
28
+ )
29
+ end
30
+
31
+ attributes.each do |k, v|
32
+ unless ALL_FIELD.include?(k.to_s)
33
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::MessageAttemptRecoveredEventData")
34
+ end
35
+
36
+ instance_variable_set("@#{k}", v)
37
+ instance_variable_set("@__#{k}_is_defined", true)
38
+ end
39
+ end
40
+
41
+ def self.deserialize(attributes = {})
42
+ attributes = attributes.transform_keys(&:to_s)
43
+ attrs = Hash.new
44
+ attrs["app_id"] = attributes["appId"]
45
+ attrs["app_uid"] = attributes["appUid"]
46
+ attrs["endpoint_id"] = attributes["endpointId"]
47
+ attrs["last_attempt"] = HookSniff::MessageAttemptFailedData.deserialize(attributes["lastAttempt"])
48
+ attrs["msg_event_id"] = attributes["msgEventId"]
49
+ attrs["msg_id"] = attributes["msgId"]
50
+ new(attrs)
51
+ end
52
+
53
+ def serialize
54
+ out = Hash.new
55
+ out["appId"] = HookSniff::serialize_primitive(@app_id) if @app_id
56
+ out["appUid"] = HookSniff::serialize_primitive(@app_uid) if @app_uid
57
+ out["endpointId"] = HookSniff::serialize_primitive(@endpoint_id) if @endpoint_id
58
+ out["lastAttempt"] = HookSniff::serialize_schema_ref(@last_attempt) if @last_attempt
59
+ out["msgEventId"] = HookSniff::serialize_primitive(@msg_event_id) if @msg_event_id
60
+ out["msgId"] = HookSniff::serialize_primitive(@msg_id) if @msg_id
61
+ out
62
+ end
63
+
64
+ # Serializes the object to a json string
65
+ # @return String
66
+ def to_json
67
+ JSON.dump(serialize)
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ module HookSniff
4
+ # The reason an attempt was made:
5
+ #
6
+ # - Scheduled = 0
7
+ # - Manual = 1
8
+ class MessageAttemptTriggerType
9
+ SCHEDULED = 0.freeze
10
+ MANUAL = 1.freeze
11
+
12
+ def self.all_vars
13
+ @all_vars ||= [SCHEDULED, MANUAL].freeze
14
+ end
15
+
16
+ def initialize(value)
17
+ unless MessageAttemptTriggerType.all_vars.include?(value)
18
+ raise "Invalid ENUM value '#{value}' for class #MessageAttemptTriggerType"
19
+ end
20
+
21
+ @value = value
22
+ end
23
+
24
+ def self.deserialize(value)
25
+ return value if MessageAttemptTriggerType.all_vars.include?(value)
26
+ raise "Invalid ENUM value '#{value}' for class #MessageAttemptTriggerType"
27
+ end
28
+
29
+ def serialize
30
+ @value
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,112 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class MessageEndpointOut
7
+ # List of message channels this endpoint listens to (omit for all).
8
+ attr_accessor :channels
9
+ attr_accessor :created_at
10
+ # An example endpoint name.
11
+ attr_accessor :description
12
+ attr_accessor :disabled
13
+ attr_accessor :filter_types
14
+ # The Endpoint's ID.
15
+ attr_accessor :id
16
+ attr_accessor :next_attempt
17
+ # Deprecated, use `throttleRate` instead.
18
+ attr_accessor :rate_limit
19
+ attr_accessor :status
20
+ attr_accessor :status_text
21
+ # Maximum messages per second to send to this endpoint.
22
+ #
23
+ # Outgoing messages will be throttled to this rate.
24
+ attr_accessor :throttle_rate
25
+ # Optional unique identifier for the endpoint.
26
+ attr_accessor :uid
27
+ attr_accessor :updated_at
28
+ attr_accessor :url
29
+ attr_accessor :version
30
+
31
+ ALL_FIELD ||= [
32
+ "channels",
33
+ "created_at",
34
+ "description",
35
+ "disabled",
36
+ "filter_types",
37
+ "id",
38
+ "next_attempt",
39
+ "rate_limit",
40
+ "status",
41
+ "status_text",
42
+ "throttle_rate",
43
+ "uid",
44
+ "updated_at",
45
+ "url",
46
+ "version"
47
+ ].freeze
48
+ private_constant :ALL_FIELD
49
+
50
+ def initialize(attributes = {})
51
+ unless attributes.is_a?(Hash)
52
+ fail(ArgumentError, "The input argument (attributes) must be a hash in `HookSniff::MessageEndpointOut` new method")
53
+ end
54
+
55
+ attributes.each do |k, v|
56
+ unless ALL_FIELD.include?(k.to_s)
57
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::MessageEndpointOut")
58
+ end
59
+
60
+ instance_variable_set("@#{k}", v)
61
+ instance_variable_set("@__#{k}_is_defined", true)
62
+ end
63
+ end
64
+
65
+ def self.deserialize(attributes = {})
66
+ attributes = attributes.transform_keys(&:to_s)
67
+ attrs = Hash.new
68
+ attrs["channels"] = attributes["channels"]
69
+ attrs["created_at"] = DateTime.rfc3339(attributes["createdAt"]).to_time
70
+ attrs["description"] = attributes["description"]
71
+ attrs["disabled"] = attributes["disabled"]
72
+ attrs["filter_types"] = attributes["filterTypes"]
73
+ attrs["id"] = attributes["id"]
74
+ attrs["next_attempt"] = DateTime.rfc3339(attributes["nextAttempt"]).to_time if attributes["nextAttempt"]
75
+ attrs["rate_limit"] = attributes["rateLimit"]
76
+ attrs["status"] = HookSniff::MessageStatus.deserialize(attributes["status"])
77
+ attrs["status_text"] = HookSniff::MessageStatusText.deserialize(attributes["statusText"])
78
+ attrs["throttle_rate"] = attributes["throttleRate"]
79
+ attrs["uid"] = attributes["uid"]
80
+ attrs["updated_at"] = DateTime.rfc3339(attributes["updatedAt"]).to_time
81
+ attrs["url"] = attributes["url"]
82
+ attrs["version"] = attributes["version"]
83
+ new(attrs)
84
+ end
85
+
86
+ def serialize
87
+ out = Hash.new
88
+ out["channels"] = HookSniff::serialize_primitive(@channels) if @channels
89
+ out["createdAt"] = HookSniff::serialize_primitive(@created_at) if @created_at
90
+ out["description"] = HookSniff::serialize_primitive(@description) if @description
91
+ out["disabled"] = HookSniff::serialize_primitive(@disabled) if @disabled
92
+ out["filterTypes"] = HookSniff::serialize_primitive(@filter_types) if @filter_types
93
+ out["id"] = HookSniff::serialize_primitive(@id) if @id
94
+ out["nextAttempt"] = HookSniff::serialize_primitive(@next_attempt) if @next_attempt
95
+ out["rateLimit"] = HookSniff::serialize_primitive(@rate_limit) if @rate_limit
96
+ out["status"] = HookSniff::serialize_schema_ref(@status) if @status
97
+ out["statusText"] = HookSniff::serialize_schema_ref(@status_text) if @status_text
98
+ out["throttleRate"] = HookSniff::serialize_primitive(@throttle_rate) if @throttle_rate
99
+ out["uid"] = HookSniff::serialize_primitive(@uid) if @uid
100
+ out["updatedAt"] = HookSniff::serialize_primitive(@updated_at) if @updated_at
101
+ out["url"] = HookSniff::serialize_primitive(@url) if @url
102
+ out["version"] = HookSniff::serialize_primitive(@version) if @version
103
+ out
104
+ end
105
+
106
+ # Serializes the object to a json string
107
+ # @return String
108
+ def to_json
109
+ JSON.dump(serialize)
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,100 @@
1
+ # frozen_string_literal: true
2
+ # This file is @generated
3
+ require "json"
4
+
5
+ module HookSniff
6
+ class MessageIn
7
+ # Optionally creates a new application alongside the message.
8
+ #
9
+ # If the application id or uid that is used in the path already exists, this argument is ignored.
10
+ attr_accessor :application
11
+ # List of free-form identifiers that endpoints can filter by
12
+ attr_accessor :channels
13
+ # The date and time at which the message will be delivered.
14
+ #
15
+ # Note that this time is best-effort-only. Must be at least one minute and no more than 24 hours in the future.
16
+ attr_accessor :deliver_at
17
+ # Optional unique identifier for the message
18
+ attr_accessor :event_id
19
+ # The event type's name
20
+ attr_accessor :event_type
21
+ # JSON payload to send as the request body of the webhook.
22
+ #
23
+ # We also support sending non-JSON payloads. Please contact us for more information.
24
+ attr_accessor :payload
25
+ # Optional number of hours to retain the message payload. Note that this is mutually exclusive with `payloadRetentionPeriod`.
26
+ attr_accessor :payload_retention_hours
27
+ # Optional number of days to retain the message payload. Defaults to 90. Note that this is mutually exclusive with `payloadRetentionHours`.
28
+ attr_accessor :payload_retention_period
29
+ # List of free-form tags that can be filtered by when listing messages
30
+ attr_accessor :tags
31
+ # Extra parameters to pass to Transformations (for future use)
32
+ attr_accessor :transformations_params
33
+
34
+ ALL_FIELD ||= [
35
+ "application",
36
+ "channels",
37
+ "deliver_at",
38
+ "event_id",
39
+ "event_type",
40
+ "payload",
41
+ "payload_retention_hours",
42
+ "payload_retention_period",
43
+ "tags",
44
+ "transformations_params"
45
+ ].freeze
46
+ private_constant :ALL_FIELD
47
+
48
+ def initialize(attributes = {})
49
+ unless attributes.is_a?(Hash)
50
+ fail(ArgumentError, "The input argument (attributes) must be a hash in `HookSniff::MessageIn` new method")
51
+ end
52
+
53
+ attributes.each do |k, v|
54
+ unless ALL_FIELD.include?(k.to_s)
55
+ fail(ArgumentError, "The field #{k} is not part of HookSniff::MessageIn")
56
+ end
57
+
58
+ instance_variable_set("@#{k}", v)
59
+ instance_variable_set("@__#{k}_is_defined", true)
60
+ end
61
+ end
62
+
63
+ def self.deserialize(attributes = {})
64
+ attributes = attributes.transform_keys(&:to_s)
65
+ attrs = Hash.new
66
+ attrs["application"] = HookSniff::ApplicationIn.deserialize(attributes["application"]) if attributes["application"]
67
+ attrs["channels"] = attributes["channels"]
68
+ attrs["deliver_at"] = DateTime.rfc3339(attributes["deliverAt"]).to_time if attributes["deliverAt"]
69
+ attrs["event_id"] = attributes["eventId"]
70
+ attrs["event_type"] = attributes["eventType"]
71
+ attrs["payload"] = attributes["payload"]
72
+ attrs["payload_retention_hours"] = attributes["payloadRetentionHours"]
73
+ attrs["payload_retention_period"] = attributes["payloadRetentionPeriod"]
74
+ attrs["tags"] = attributes["tags"]
75
+ attrs["transformations_params"] = attributes["transformationsParams"]
76
+ new(attrs)
77
+ end
78
+
79
+ def serialize
80
+ out = Hash.new
81
+ out["application"] = HookSniff::serialize_schema_ref(@application) if @application
82
+ out["channels"] = HookSniff::serialize_primitive(@channels) if @channels
83
+ out["deliverAt"] = HookSniff::serialize_primitive(@deliver_at) if @deliver_at
84
+ out["eventId"] = HookSniff::serialize_primitive(@event_id) if @event_id
85
+ out["eventType"] = HookSniff::serialize_primitive(@event_type) if @event_type
86
+ out["payload"] = HookSniff::serialize_primitive(@payload) if @payload
87
+ out["payloadRetentionHours"] = HookSniff::serialize_primitive(@payload_retention_hours) if @payload_retention_hours
88
+ out["payloadRetentionPeriod"] = HookSniff::serialize_primitive(@payload_retention_period) if @payload_retention_period
89
+ out["tags"] = HookSniff::serialize_primitive(@tags) if @tags
90
+ out["transformationsParams"] = HookSniff::serialize_primitive(@transformations_params) if @transformations_params
91
+ out
92
+ end
93
+
94
+ # Serializes the object to a json string
95
+ # @return String
96
+ def to_json
97
+ JSON.dump(serialize)
98
+ end
99
+ end
100
+ end