didit-sdk 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 (234) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +25 -0
  3. data/LICENSE +21 -0
  4. data/README.md +277 -0
  5. data/lib/didit/authentication/base64_url.rb +34 -0
  6. data/lib/didit/authentication/cache.rb +201 -0
  7. data/lib/didit/authentication/http.rb +150 -0
  8. data/lib/didit/authentication/issuer.rb +115 -0
  9. data/lib/didit/authentication/jws.rb +231 -0
  10. data/lib/didit/authentication/key_set.rb +89 -0
  11. data/lib/didit/authentication/pkce.rb +64 -0
  12. data/lib/didit/authentication/types.rb +175 -0
  13. data/lib/didit/authentication.rb +546 -0
  14. data/lib/didit/client.rb +211 -0
  15. data/lib/didit/errors.rb +153 -0
  16. data/lib/didit/file_part.rb +85 -0
  17. data/lib/didit/internal/config.rb +94 -0
  18. data/lib/didit/internal/errors.rb +83 -0
  19. data/lib/didit/internal/log.rb +41 -0
  20. data/lib/didit/internal/multipart.rb +60 -0
  21. data/lib/didit/internal/request.rb +322 -0
  22. data/lib/didit/internal/transport.rb +198 -0
  23. data/lib/didit/internal/util.rb +76 -0
  24. data/lib/didit/internal.rb +15 -0
  25. data/lib/didit/model.rb +199 -0
  26. data/lib/didit/page.rb +130 -0
  27. data/lib/didit/raw_response.rb +57 -0
  28. data/lib/didit/resource.rb +15 -0
  29. data/lib/didit/resources/account.rb +309 -0
  30. data/lib/didit/resources/address_validation.rb +73 -0
  31. data/lib/didit/resources/age_estimation.rb +110 -0
  32. data/lib/didit/resources/aml.rb +166 -0
  33. data/lib/didit/resources/aml_monitoring.rb +30 -0
  34. data/lib/didit/resources/analytics.rb +87 -0
  35. data/lib/didit/resources/bank.rb +65 -0
  36. data/lib/didit/resources/billing.rb +61 -0
  37. data/lib/didit/resources/biometric_templates.rb +234 -0
  38. data/lib/didit/resources/blocklist.rb +130 -0
  39. data/lib/didit/resources/business_sessions.rb +29 -0
  40. data/lib/didit/resources/businesses.rb +471 -0
  41. data/lib/didit/resources/cases.rb +2116 -0
  42. data/lib/didit/resources/customization.rb +153 -0
  43. data/lib/didit/resources/database_validation.rb +327 -0
  44. data/lib/didit/resources/document_ai.rb +145 -0
  45. data/lib/didit/resources/email.rb +254 -0
  46. data/lib/didit/resources/face_match.rb +103 -0
  47. data/lib/didit/resources/face_search.rb +103 -0
  48. data/lib/didit/resources/fraud_checks.rb +130 -0
  49. data/lib/didit/resources/id_verification.rb +163 -0
  50. data/lib/didit/resources/id_wallets.rb +1468 -0
  51. data/lib/didit/resources/investigator.rb +419 -0
  52. data/lib/didit/resources/ip.rb +68 -0
  53. data/lib/didit/resources/kyb.rb +256 -0
  54. data/lib/didit/resources/lists.rb +332 -0
  55. data/lib/didit/resources/monitoring_events.rb +466 -0
  56. data/lib/didit/resources/networks.rb +427 -0
  57. data/lib/didit/resources/passive_liveness.rb +103 -0
  58. data/lib/didit/resources/phone.rb +271 -0
  59. data/lib/didit/resources/pricing.rb +40 -0
  60. data/lib/didit/resources/proof_of_address.rb +167 -0
  61. data/lib/didit/resources/questionnaires.rb +170 -0
  62. data/lib/didit/resources/regulatory_reports.rb +314 -0
  63. data/lib/didit/resources/report_templates.rb +146 -0
  64. data/lib/didit/resources/sessions.rb +2820 -0
  65. data/lib/didit/resources/transactions.rb +981 -0
  66. data/lib/didit/resources/travel_rule.rb +1202 -0
  67. data/lib/didit/resources/users.rb +521 -0
  68. data/lib/didit/resources/wallet_screening.rb +190 -0
  69. data/lib/didit/resources/webhooks.rb +396 -0
  70. data/lib/didit/resources/workflows.rb +214 -0
  71. data/lib/didit/resources.rb +263 -0
  72. data/lib/didit/types/account.rb +11 -0
  73. data/lib/didit/types/account_components.rb +105 -0
  74. data/lib/didit/types/address_validation.rb +8 -0
  75. data/lib/didit/types/age_estimation.rb +89 -0
  76. data/lib/didit/types/aml.rb +193 -0
  77. data/lib/didit/types/aml_monitoring.rb +73 -0
  78. data/lib/didit/types/analytics.rb +62 -0
  79. data/lib/didit/types/bank.rb +8 -0
  80. data/lib/didit/types/billing.rb +18 -0
  81. data/lib/didit/types/biometric_templates.rb +292 -0
  82. data/lib/didit/types/blocklist.rb +31 -0
  83. data/lib/didit/types/businesses.rb +45 -0
  84. data/lib/didit/types/cases.rb +368 -0
  85. data/lib/didit/types/components.rb +12206 -0
  86. data/lib/didit/types/customization.rb +8 -0
  87. data/lib/didit/types/database_validation.rb +177 -0
  88. data/lib/didit/types/document_ai.rb +135 -0
  89. data/lib/didit/types/email.rb +116 -0
  90. data/lib/didit/types/face_match.rb +93 -0
  91. data/lib/didit/types/face_search.rb +129 -0
  92. data/lib/didit/types/fraud_checks.rb +8 -0
  93. data/lib/didit/types/id_verification.rb +231 -0
  94. data/lib/didit/types/id_wallets.rb +8 -0
  95. data/lib/didit/types/investigator.rb +221 -0
  96. data/lib/didit/types/ip.rb +8 -0
  97. data/lib/didit/types/kyb.rb +1391 -0
  98. data/lib/didit/types/lists.rb +111 -0
  99. data/lib/didit/types/monitoring_events.rb +235 -0
  100. data/lib/didit/types/networks.rb +120 -0
  101. data/lib/didit/types/passive_liveness.rb +95 -0
  102. data/lib/didit/types/phone.rb +69 -0
  103. data/lib/didit/types/proof_of_address.rb +166 -0
  104. data/lib/didit/types/questionnaires.rb +29 -0
  105. data/lib/didit/types/regulatory_reports.rb +100 -0
  106. data/lib/didit/types/report_templates.rb +41 -0
  107. data/lib/didit/types/sessions.rb +1441 -0
  108. data/lib/didit/types/transactions.rb +245 -0
  109. data/lib/didit/types/travel_rule.rb +168 -0
  110. data/lib/didit/types/users.rb +180 -0
  111. data/lib/didit/types/wallet_screening.rb +49 -0
  112. data/lib/didit/types/webhooks.rb +355 -0
  113. data/lib/didit/types/workflows.rb +32 -0
  114. data/lib/didit/types.rb +1681 -0
  115. data/lib/didit/version.rb +5 -0
  116. data/lib/didit/webhooks/canonical_json.rb +187 -0
  117. data/lib/didit/webhooks/client_methods.rb +23 -0
  118. data/lib/didit/webhooks/events.rb +221 -0
  119. data/lib/didit/webhooks/headers.rb +83 -0
  120. data/lib/didit/webhooks/verifier.rb +260 -0
  121. data/lib/didit/webhooks.rb +99 -0
  122. data/lib/didit-sdk.rb +4 -0
  123. data/lib/didit.rb +31 -0
  124. data/sig/didit/authentication/base64_url.rbs +10 -0
  125. data/sig/didit/authentication/cache.rbs +60 -0
  126. data/sig/didit/authentication/http.rbs +37 -0
  127. data/sig/didit/authentication/issuer.rbs +17 -0
  128. data/sig/didit/authentication/jws.rbs +41 -0
  129. data/sig/didit/authentication/jwt.rbs +14 -0
  130. data/sig/didit/authentication/key_set.rbs +25 -0
  131. data/sig/didit/authentication/pkce.rbs +20 -0
  132. data/sig/didit/authentication/types.rbs +114 -0
  133. data/sig/didit/authentication.rbs +81 -0
  134. data/sig/didit/client.rbs +61 -0
  135. data/sig/didit/errors.rbs +80 -0
  136. data/sig/didit/file_part.rbs +19 -0
  137. data/sig/didit/internal.rbs +199 -0
  138. data/sig/didit/model.rbs +42 -0
  139. data/sig/didit/page.rbs +34 -0
  140. data/sig/didit/raw_response.rbs +20 -0
  141. data/sig/didit/resource.rbs +8 -0
  142. data/sig/didit/resources/account.rbs +23 -0
  143. data/sig/didit/resources/address_validation.rbs +9 -0
  144. data/sig/didit/resources/age_estimation.rbs +9 -0
  145. data/sig/didit/resources/aml.rbs +10 -0
  146. data/sig/didit/resources/aml_monitoring.rbs +9 -0
  147. data/sig/didit/resources/analytics.rbs +9 -0
  148. data/sig/didit/resources/bank.rbs +9 -0
  149. data/sig/didit/resources/billing.rbs +10 -0
  150. data/sig/didit/resources/biometric_templates.rbs +13 -0
  151. data/sig/didit/resources/blocklist.rbs +11 -0
  152. data/sig/didit/resources/business_sessions.rbs +9 -0
  153. data/sig/didit/resources/businesses.rbs +22 -0
  154. data/sig/didit/resources/cases.rbs +103 -0
  155. data/sig/didit/resources/customization.rbs +10 -0
  156. data/sig/didit/resources/database_validation.rbs +9 -0
  157. data/sig/didit/resources/document_ai.rbs +9 -0
  158. data/sig/didit/resources/email.rbs +11 -0
  159. data/sig/didit/resources/face_match.rbs +9 -0
  160. data/sig/didit/resources/face_search.rbs +9 -0
  161. data/sig/didit/resources/fraud_checks.rbs +11 -0
  162. data/sig/didit/resources/id_verification.rbs +9 -0
  163. data/sig/didit/resources/id_wallets.rbs +37 -0
  164. data/sig/didit/resources/investigator.rbs +23 -0
  165. data/sig/didit/resources/ip.rbs +9 -0
  166. data/sig/didit/resources/kyb.rbs +12 -0
  167. data/sig/didit/resources/lists.rbs +20 -0
  168. data/sig/didit/resources/monitoring_events.rbs +16 -0
  169. data/sig/didit/resources/networks.rbs +25 -0
  170. data/sig/didit/resources/passive_liveness.rbs +9 -0
  171. data/sig/didit/resources/phone.rbs +11 -0
  172. data/sig/didit/resources/pricing.rbs +9 -0
  173. data/sig/didit/resources/proof_of_address.rbs +9 -0
  174. data/sig/didit/resources/questionnaires.rbs +13 -0
  175. data/sig/didit/resources/regulatory_reports.rbs +16 -0
  176. data/sig/didit/resources/report_templates.rbs +13 -0
  177. data/sig/didit/resources/sessions.rbs +78 -0
  178. data/sig/didit/resources/transactions.rbs +43 -0
  179. data/sig/didit/resources/travel_rule.rbs +62 -0
  180. data/sig/didit/resources/users.rbs +21 -0
  181. data/sig/didit/resources/wallet_screening.rbs +11 -0
  182. data/sig/didit/resources/webhooks.rbs +23 -0
  183. data/sig/didit/resources/workflows.rbs +13 -0
  184. data/sig/didit/resources.rbs +50 -0
  185. data/sig/didit/types/account.rbs +22 -0
  186. data/sig/didit/types/account_components.rbs +94 -0
  187. data/sig/didit/types/address_validation.rbs +7 -0
  188. data/sig/didit/types/age_estimation.rbs +80 -0
  189. data/sig/didit/types/aml.rbs +174 -0
  190. data/sig/didit/types/aml_monitoring.rbs +67 -0
  191. data/sig/didit/types/analytics.rbs +57 -0
  192. data/sig/didit/types/bank.rbs +9 -0
  193. data/sig/didit/types/billing.rbs +19 -0
  194. data/sig/didit/types/biometric_templates.rbs +268 -0
  195. data/sig/didit/types/blocklist.rbs +33 -0
  196. data/sig/didit/types/businesses.rbs +54 -0
  197. data/sig/didit/types/cases.rbs +414 -0
  198. data/sig/didit/types/components.rbs +10920 -0
  199. data/sig/didit/types/customization.rbs +7 -0
  200. data/sig/didit/types/database_validation.rbs +152 -0
  201. data/sig/didit/types/document_ai.rbs +123 -0
  202. data/sig/didit/types/email.rbs +112 -0
  203. data/sig/didit/types/face_match.rbs +86 -0
  204. data/sig/didit/types/face_search.rbs +112 -0
  205. data/sig/didit/types/fraud_checks.rbs +9 -0
  206. data/sig/didit/types/id_verification.rbs +196 -0
  207. data/sig/didit/types/id_wallets.rbs +55 -0
  208. data/sig/didit/types/investigator.rbs +212 -0
  209. data/sig/didit/types/ip.rbs +7 -0
  210. data/sig/didit/types/kyb.rbs +1254 -0
  211. data/sig/didit/types/lists.rbs +106 -0
  212. data/sig/didit/types/monitoring_events.rbs +234 -0
  213. data/sig/didit/types/networks.rbs +113 -0
  214. data/sig/didit/types/passive_liveness.rbs +87 -0
  215. data/sig/didit/types/phone.rbs +65 -0
  216. data/sig/didit/types/proof_of_address.rbs +144 -0
  217. data/sig/didit/types/questionnaires.rbs +30 -0
  218. data/sig/didit/types/regulatory_reports.rbs +101 -0
  219. data/sig/didit/types/report_templates.rbs +42 -0
  220. data/sig/didit/types/sessions.rbs +1349 -0
  221. data/sig/didit/types/transactions.rbs +273 -0
  222. data/sig/didit/types/travel_rule.rbs +188 -0
  223. data/sig/didit/types/users.rbs +181 -0
  224. data/sig/didit/types/wallet_screening.rbs +40 -0
  225. data/sig/didit/types/webhooks.rbs +311 -0
  226. data/sig/didit/types/workflows.rbs +30 -0
  227. data/sig/didit/webhooks/canonical_json.rbs +25 -0
  228. data/sig/didit/webhooks/client_methods.rbs +11 -0
  229. data/sig/didit/webhooks/events.rbs +125 -0
  230. data/sig/didit/webhooks/headers.rbs +22 -0
  231. data/sig/didit/webhooks/verifier.rbs +54 -0
  232. data/sig/didit/webhooks.rbs +37 -0
  233. data/sig/didit.rbs +20 -0
  234. metadata +300 -0
@@ -0,0 +1,466 @@
1
+ # Code generated by codegen from openapi/*.json. DO NOT EDIT.
2
+ # frozen_string_literal: true
3
+
4
+ module Didit
5
+ module Resources
6
+ # The +monitoring_events+ resource.
7
+ class MonitoringEvents < Didit::Resource
8
+ # Create monitoring event
9
+ #
10
+ # Send one non-monetary event (login, session, gameplay, bonus, affiliate, payment, dispute, security,
11
+ # responsible gambling or custom) from your backend. The event is validated against its category contract,
12
+ # stored, IP-enriched once per unique public address, and evaluated by your real-time event rules before the
13
+ # response returns; cross-subject and long-window rules run asynchronously (`correlation_pending: true`), and in
14
+ # a sandbox application no rules run. `event_id` is the idempotency key: the same `event_id` with the same
15
+ # `event_category`, `action_type`, `occurred_at`, `subject.vendor_data` and `payload` returns `200` with
16
+ # `idempotent_replay: true` and the stored outcome (other envelope fields are not compared), while different
17
+ # values return `409`. Event ingestion is opt-in per application: until it is switched on this endpoint returns
18
+ # `403` with `code: event_monitoring_disabled` and stores nothing. A scoped API key needs `transactions: write`.
19
+ # See [Event ingestion](https://docs.didit.me/transaction-monitoring/events) and [Rules on
20
+ # events](https://docs.didit.me/transaction-monitoring/event-rules); to send events from a browser or app, use
21
+ # [SDK event submission](https://docs.didit.me/transaction-monitoring/sdk-event-submission).
22
+ #
23
+ # +POST /v3/events/+
24
+ #
25
+ # @param event_id [String] Your identifier for the event, unique per application. It is the idempotency key:
26
+ # resending the same `event_category`, `action_type`, `occurred_at`, `subject.vendor_data` and `payload` under
27
+ # it is a replay, anything different is a conflict.
28
+ # @param event_category [String] Event category.
29
+ # @param action_type [String] What happened within the category. Open vocabulary; the managed actions listed in
30
+ # [Event ingestion](https://docs.didit.me/transaction-monitoring/events) (for example `login`,
31
+ # `deposit_completed`, `chargeback_opened`) unlock typed validation and managed rule fields. Leading and
32
+ # trailing whitespace is trimmed.
33
+ # @param occurred_at [Time, String] When the event happened on your side, ISO 8601 (a value without an offset is
34
+ # read as UTC). Must be no more than 7 days in the past and no more than 5 minutes in the future.
35
+ # @param subject [Hash] The user or company the event belongs to. It resolves to the user (or company) with this
36
+ # `vendor_data` in your application; one is created when none exists.
37
+ # @param time_zone [String, nil] Time zone of the occurrence on your side, for example `Europe/Madrid`. Stored
38
+ # with the event; not returned by the read endpoints.
39
+ # @param business [Hash] The business the event belongs to, when it differs from the subject. Only `vendor_data`
40
+ # is read.
41
+ # @param session [Hash] Your session context for the event.
42
+ # @param device_context [Hash] Device and network context, stored as sent and returned by `GET
43
+ # /v3/events/{event_uuid}/`. On this server lane Didit does not see the end user's connection, so the IP
44
+ # enriched and used by rules is `network_context.ip_address` as you send it.
45
+ # @param transaction_context [Hash] Money context. Non-empty values here also satisfy the required payload keys
46
+ # of the action.
47
+ # @param payload [Hash] The category's domain fields, at most 16384 bytes once JSON-encoded. Some actions
48
+ # require keys (in `payload` or `transaction_context`): `gameplay.p2p_settlement` needs `game_id`,
49
+ # `counterparty_vendor_data`, `stake_amount`, `net_result_amount`, `role` and one of `hand_id`, `round_id`,
50
+ # `match_id`; `gameplay.bet_placed` and `gameplay.bet_settled` need `game_id`; `payment.deposit_initiated`,
51
+ # `payment...
52
+ # @param custom_values [Hash{String => String, Numeric, Boolean, nil}] Up to 100 keys of your own, addressable
53
+ # from rules as `custom_values.<key>`. Values must be scalars (string, number, boolean or null); nested objects
54
+ # and arrays are rejected.
55
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
56
+ # @return [Didit::Types::MonitoringEventIngestResult]
57
+ def create(
58
+ event_id:,
59
+ event_category:,
60
+ action_type:,
61
+ occurred_at:,
62
+ subject:,
63
+ time_zone: OMIT,
64
+ business: OMIT,
65
+ session: OMIT,
66
+ device_context: OMIT,
67
+ transaction_context: OMIT,
68
+ payload: OMIT,
69
+ custom_values: OMIT,
70
+ request_options: nil
71
+ )
72
+ @client.request(
73
+ :post,
74
+ "/v3/events/",
75
+ body: {
76
+ "event_id" => event_id,
77
+ "event_category" => event_category,
78
+ "action_type" => action_type,
79
+ "occurred_at" => occurred_at,
80
+ "subject" => subject,
81
+ "time_zone" => time_zone,
82
+ "business" => business,
83
+ "session" => session,
84
+ "device_context" => device_context,
85
+ "transaction_context" => transaction_context,
86
+ "payload" => payload,
87
+ "custom_values" => custom_values
88
+ },
89
+ response: Types::MonitoringEventIngestResult,
90
+ request_options: request_options
91
+ )
92
+ end
93
+
94
+ # Create monitoring events in batch
95
+ #
96
+ # Submit 1 to 500 events in one request, each in the same envelope as `POST /v3/events/`. Every item is
97
+ # validated, stored and evaluated on its own and gets its own outcome (`accepted`, `replayed` or `rejected`), so
98
+ # one malformed event never rolls back the others: the response is `201` when no item was rejected and `207`
99
+ # when at least one was, and both mean the request was processed. Send `{"events": [...]}`; a bare JSON array of
100
+ # events is also accepted. Event ingestion must be switched on for the application, otherwise the whole request
101
+ # returns `403` with `code: event_monitoring_disabled` and nothing is stored. A scoped API key needs
102
+ # `transactions: write`. See [Batches](https://docs.didit.me/transaction-monitoring/events#batches).
103
+ #
104
+ # +POST /v3/events/batch/+
105
+ #
106
+ # @param events [Array<Hash>] 1 to 500 events. Each item follows `MonitoringEventCreateRequest`, including the
107
+ # 7-day past and 5-minute future window on `occurred_at`.
108
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
109
+ # @return [Didit::Types::MonitoringEventsCreateBatchResponse]
110
+ def create_batch(events:, request_options: nil)
111
+ @client.request(
112
+ :post,
113
+ "/v3/events/batch/",
114
+ body: {
115
+ "events" => events
116
+ },
117
+ response: Types::MonitoringEventsCreateBatchResponse,
118
+ request_options: request_options
119
+ )
120
+ end
121
+
122
+ # Mint monitoring SDK token
123
+ #
124
+ # Mint a short-lived device credential bound to one subject, so your web or mobile app can send that user's
125
+ # events straight to Didit without an API key. The app sends the returned `monitoring_token` in the
126
+ # `X-Monitoring-Token` header to the device lane (`POST /v1/events/` and `POST /v1/events/batch/`), where the
127
+ # subject is always overwritten with this `vendor_data`, events outside `allowed_event_categories` are rejected,
128
+ # each submitted event spends one use, and a request whose `Origin` does not equal `bind_to_origin` is refused.
129
+ # Call it from your backend only; minting creates the credential and nothing else (no user is created). Event
130
+ # ingestion must be switched on for the application, otherwise this endpoint returns `403` with `code:
131
+ # event_monitoring_disabled` instead of minting a credential that could never write. A scoped API key needs
132
+ # `transactions: write`. See [SDK event
133
+ # submission](https://docs.didit.me/transaction-monitoring/sdk-event-submission).
134
+ #
135
+ # +POST /v3/events/sdk-token/+
136
+ #
137
+ # @param vendor_data [String] Your id for the subject every event submitted with this credential belongs to.
138
+ # @param entity_type [String] `company` binds a company subject; any other value (default `individual`) binds an
139
+ # individual.
140
+ # @param allowed_event_categories [Array<String>] Categories the credential may submit. Omit it or send `[]` to
141
+ # allow every category.
142
+ # @param ttl_seconds [Integer] Lifetime of the credential in seconds.
143
+ # @param max_uses [Integer, nil] Number of events the credential may submit (a batch spends one use per event).
144
+ # Send `null` for no cap within the lifetime.
145
+ # @param bind_to_origin [String, nil] When set, the browser `Origin` header of every device request must equal
146
+ # this value exactly; a request without `Origin` is refused.
147
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
148
+ # @return [Didit::Types::MonitoringEventsCreateSdkTokenResponse]
149
+ def create_sdk_token(
150
+ vendor_data:,
151
+ entity_type: OMIT,
152
+ allowed_event_categories: OMIT,
153
+ ttl_seconds: OMIT,
154
+ max_uses: OMIT,
155
+ bind_to_origin: OMIT,
156
+ request_options: nil
157
+ )
158
+ @client.request(
159
+ :post,
160
+ "/v3/events/sdk-token/",
161
+ body: {
162
+ "vendor_data" => vendor_data,
163
+ "entity_type" => entity_type,
164
+ "allowed_event_categories" => allowed_event_categories,
165
+ "ttl_seconds" => ttl_seconds,
166
+ "max_uses" => max_uses,
167
+ "bind_to_origin" => bind_to_origin
168
+ },
169
+ response: Types::MonitoringEventsCreateSdkTokenResponse,
170
+ request_options: request_options
171
+ )
172
+ end
173
+
174
+ # Delete monitoring event
175
+ #
176
+ # Permanently delete one monitoring event together with its rule runs, notes and tag links, for example an event
177
+ # sent by mistake. After the `204` the event is gone from every read (retrieve returns `404`, and it no longer
178
+ # appears in the list or the subject timeline), the deletion is irreversible, and its `event_id` is free to be
179
+ # used for a new event. Not affected: the user or company the event resolved to, cases a rule opened, list
180
+ # entries a rule added, and the scores and statuses already applied to other events. To erase everything about a
181
+ # person or a company, delete the user or the company instead, which also deletes their events. A scoped API key
182
+ # needs `transactions: write`.
183
+ #
184
+ # +DELETE /v3/events/{event_uuid}/delete/+
185
+ #
186
+ # @param event_uuid [String] Didit identifier of the event (`event_uuid` from the create, batch, list or
187
+ # timeline response), not your own `event_id`.
188
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
189
+ # @return [nil]
190
+ def delete(event_uuid, request_options: nil)
191
+ @client.request(
192
+ :delete,
193
+ "/v3/events/{event_uuid}/delete/",
194
+ path_params: { "event_uuid" => event_uuid },
195
+ request_options: request_options
196
+ )
197
+ end
198
+
199
+ # List monitoring events
200
+ #
201
+ # List the monitoring events stored for your application, newest `occurred_at` first, with optional filters that
202
+ # combine with AND. Multi-value filters (`event_category`, `action_type`, `status`, `retention_class`) repeat
203
+ # the parameter and match any of the values; the other filters are exact matches, and unknown values simply
204
+ # return no events. Each result is a summary: call `GET /v3/events/{event_uuid}/` for the payload, device
205
+ # context, IP enrichment and rule evidence, and prefer `GET /v3/events/subjects/{vendor_data}/` for one
206
+ # subject's history. Reads work whether or not event ingestion is switched on. A scoped API key needs
207
+ # `transactions: read`. See [Event ingestion](https://docs.didit.me/transaction-monitoring/events).
208
+ #
209
+ # +GET /v3/events/+
210
+ #
211
+ # @param limit [Integer] Maximum number of events per page. Defaults to 50. Values above 1000000 return `400`; a
212
+ # non-numeric, zero or negative value falls back to 50.
213
+ # @param offset [Integer] Number of events to skip. Defaults to 0. Prefer following the `next` URL from the
214
+ # response.
215
+ # @param event_category [Array<String>] Only events in these categories. Repeat the parameter for several values
216
+ # (`?event_category=payment&event_category=dispute`); an event matching any of them is returned.
217
+ # @param action_type [Array<String>] Only events with these action types (exact, case-sensitive). Repeat for
218
+ # several values.
219
+ # @param status [Array<String>] Only events with these statuses. Repeat for several values.
220
+ # @param retention_class [Array<String>] Only events in these retention classes. Repeat for several values.
221
+ # @param subject_vendor_data [String] Exact match on the subject's `vendor_data`. The same id can name an
222
+ # individual and a company; add `subject_entity_type` to pick one, or use `GET
223
+ # /v3/events/subjects/{vendor_data}/`.
224
+ # @param subject_entity_type [String] `company` returns only events of company subjects; any other non-empty
225
+ # value (for example `individual`) returns only events of individuals. Omit it to return both.
226
+ # @param business_vendor_data [String] Exact match on the `business.vendor_data` sent with the event.
227
+ # @param session_id [String] Exact match on `session.session_id`.
228
+ # @param device_fingerprint [String] Exact match on `device_context.fingerprint`.
229
+ # @param ip_address [String] Exact match on the event's IP address.
230
+ # @param game_id [String] Exact match on the promoted `game_id`.
231
+ # @param round_id [String] Exact match on the promoted `round_id`.
232
+ # @param affiliate_code [String] Exact match on the promoted `affiliate_code`.
233
+ # @param payment_reference_id [String] Exact match on the payment reference (from
234
+ # `transaction_context.payment_reference_id` or `payload.payment_reference_id`).
235
+ # @param counterparty_vendor_data [String] Exact match on the promoted `counterparty_vendor_data`.
236
+ # @param matched_only [Boolean] `true` (also `1` or `yes`, case-insensitive) returns only events at least one
237
+ # rule matched (`rules_matched_count` above 0). Any other value is ignored.
238
+ # @param occurred_from [Time, String] Only events with `occurred_at` at or after this instant (inclusive). Send
239
+ # an ISO 8601 value: `2026-10-01T00:00:00Z`, an explicit offset with the `+` percent-encoded
240
+ # (`2026-10-01T02:00:00%2B02:00`; an unencoded `+` is decoded as a space and the value no longer parses), or a
241
+ # date alone (`2026-10-01`), which means 00:00:00 UTC of that day. A value without an offset is read as UTC.
242
+ # Values in any othe...
243
+ # @param occurred_to [Time, String] Only events with `occurred_at` at or before this instant (inclusive). A date
244
+ # alone means the start of that day, so `occurred_to=2026-10-15` excludes the rest of 15 October; send
245
+ # `2026-10-15T23:59:59Z` to include it. Send an ISO 8601 value: `2026-10-01T00:00:00Z`, an explicit offset with
246
+ # the `+` percent-encoded (`2026-10-01T02:00:00%2B02:00`; an unencoded `+` is decoded as a space and the value
247
+ # no...
248
+ # @param search [String] Case-insensitive substring match on `event_id`, `action_type`, `subject_vendor_data` or
249
+ # `counterparty_vendor_data`.
250
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
251
+ # @return [Didit::Page<Didit::Types::MonitoringEvent>]
252
+ def list(
253
+ limit: OMIT,
254
+ offset: OMIT,
255
+ event_category: OMIT,
256
+ action_type: OMIT,
257
+ status: OMIT,
258
+ retention_class: OMIT,
259
+ subject_vendor_data: OMIT,
260
+ subject_entity_type: OMIT,
261
+ business_vendor_data: OMIT,
262
+ session_id: OMIT,
263
+ device_fingerprint: OMIT,
264
+ ip_address: OMIT,
265
+ game_id: OMIT,
266
+ round_id: OMIT,
267
+ affiliate_code: OMIT,
268
+ payment_reference_id: OMIT,
269
+ counterparty_vendor_data: OMIT,
270
+ matched_only: OMIT,
271
+ occurred_from: OMIT,
272
+ occurred_to: OMIT,
273
+ search: OMIT,
274
+ request_options: nil
275
+ )
276
+ @client.request(
277
+ :get,
278
+ "/v3/events/",
279
+ query: {
280
+ "limit" => limit,
281
+ "offset" => offset,
282
+ "event_category" => event_category,
283
+ "action_type" => action_type,
284
+ "status" => status,
285
+ "retention_class" => retention_class,
286
+ "subject_vendor_data" => subject_vendor_data,
287
+ "subject_entity_type" => subject_entity_type,
288
+ "business_vendor_data" => business_vendor_data,
289
+ "session_id" => session_id,
290
+ "device_fingerprint" => device_fingerprint,
291
+ "ip_address" => ip_address,
292
+ "game_id" => game_id,
293
+ "round_id" => round_id,
294
+ "affiliate_code" => affiliate_code,
295
+ "payment_reference_id" => payment_reference_id,
296
+ "counterparty_vendor_data" => counterparty_vendor_data,
297
+ "matched_only" => matched_only,
298
+ "occurred_from" => occurred_from,
299
+ "occurred_to" => occurred_to,
300
+ "search" => search
301
+ },
302
+ page: Types::MonitoringEvent,
303
+ request_options: request_options
304
+ )
305
+ end
306
+
307
+ # Get monitoring event
308
+ #
309
+ # Retrieve one monitoring event with everything the list returns plus the payload, custom values, device
310
+ # context, field provenance (`field_sources`), the promoted domain fields, `expires_at`, every matching rule run
311
+ # with its evidence, the IP enrichment and the tags rules attached. While `correlation_pending` is `true` an
312
+ # asynchronous rule still has to run; read the event again a few minutes later for the final `status`, `score`
313
+ # and `rule_runs`. Reads work whether or not event ingestion is switched on. A scoped API key needs
314
+ # `transactions: read`. See [Evidence](https://docs.didit.me/transaction-monitoring/event-rules#evidence) and
315
+ # [IP enrichment](https://docs.didit.me/transaction-monitoring/ip-enrichment).
316
+ #
317
+ # +GET /v3/events/{event_uuid}/+
318
+ #
319
+ # @param event_uuid [String] Didit identifier of the event (`event_uuid` from the create, batch, list or
320
+ # timeline response), not your own `event_id`.
321
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
322
+ # @return [Didit::Types::MonitoringEventDetail]
323
+ def retrieve(event_uuid, request_options: nil)
324
+ @client.request(
325
+ :get,
326
+ "/v3/events/{event_uuid}/",
327
+ path_params: { "event_uuid" => event_uuid },
328
+ response: Types::MonitoringEventDetail,
329
+ request_options: request_options
330
+ )
331
+ end
332
+
333
+ # Get event enrichment metrics
334
+ #
335
+ # Return the event ingestion and IP-enrichment counters of your application for a period, summed over every lane
336
+ # (server, batch and device), so you can watch event volume and confirm that enrichment is resolved once per
337
+ # unique address rather than once per event. The period covers today plus the previous `days` days, counted by
338
+ # UTC calendar date. The three ratios are null when their denominator is zero. A scoped API key needs
339
+ # `transactions: read`. See [IP enrichment](https://docs.didit.me/transaction-monitoring/events#ip-enrichment).
340
+ #
341
+ # +GET /v3/events/enrichment-metrics/+
342
+ #
343
+ # @param days [Integer] Length of the period in days. Defaults to 30; values are clamped to 1 to 365, and a
344
+ # non-integer value falls back to 30. The value applied is returned as `period_days`.
345
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
346
+ # @return [Didit::Types::MonitoringEventsRetrieveEnrichmentMetricsResponse]
347
+ def retrieve_enrichment_metrics(days: OMIT, request_options: nil)
348
+ @client.request(
349
+ :get,
350
+ "/v3/events/enrichment-metrics/",
351
+ query: {
352
+ "days" => days
353
+ },
354
+ response: Types::MonitoringEventsRetrieveEnrichmentMetricsResponse,
355
+ request_options: request_options
356
+ )
357
+ end
358
+
359
+ # Get subject event timeline
360
+ #
361
+ # List every monitoring event of one subject, newest `occurred_at` first. A `vendor_data` is unique only within
362
+ # an entity type, so the same id can name an individual and a company: `entity_type` picks which timeline you
363
+ # get, and it defaults to `individual`, so a company's events need `entity_type=company`. The filters of `GET
364
+ # /v3/events/` apply on top, and a `vendor_data` with no events returns an empty page rather than `404`. A
365
+ # scoped API key needs `transactions: read`. See [Reading events
366
+ # back](https://docs.didit.me/transaction-monitoring/events#reading-events-back).
367
+ #
368
+ # +GET /v3/events/subjects/{vendor_data}/+
369
+ #
370
+ # @param vendor_data [String] Your id for the subject (`subject.vendor_data` of its events). URL-encode it; a
371
+ # value containing `/` cannot be addressed by this endpoint.
372
+ # @param entity_type [String] `company` returns the company with this `vendor_data`; any other value, or none,
373
+ # returns the individual. `subject_entity_type` is accepted as an alias when `entity_type` is absent.
374
+ # @param limit [Integer] Maximum number of events per page. Defaults to 50. Values above 1000000 return `400`; a
375
+ # non-numeric, zero or negative value falls back to 50.
376
+ # @param offset [Integer] Number of events to skip. Defaults to 0. Prefer following the `next` URL from the
377
+ # response.
378
+ # @param event_category [Array<String>] Only events in these categories. Repeat the parameter for several values
379
+ # (`?event_category=payment&event_category=dispute`); an event matching any of them is returned.
380
+ # @param action_type [Array<String>] Only events with these action types (exact, case-sensitive). Repeat for
381
+ # several values.
382
+ # @param status [Array<String>] Only events with these statuses. Repeat for several values.
383
+ # @param retention_class [Array<String>] Only events in these retention classes. Repeat for several values.
384
+ # @param business_vendor_data [String] Exact match on the `business.vendor_data` sent with the event.
385
+ # @param session_id [String] Exact match on `session.session_id`.
386
+ # @param device_fingerprint [String] Exact match on `device_context.fingerprint`.
387
+ # @param ip_address [String] Exact match on the event's IP address.
388
+ # @param game_id [String] Exact match on the promoted `game_id`.
389
+ # @param round_id [String] Exact match on the promoted `round_id`.
390
+ # @param affiliate_code [String] Exact match on the promoted `affiliate_code`.
391
+ # @param payment_reference_id [String] Exact match on the payment reference (from
392
+ # `transaction_context.payment_reference_id` or `payload.payment_reference_id`).
393
+ # @param counterparty_vendor_data [String] Exact match on the promoted `counterparty_vendor_data`.
394
+ # @param matched_only [Boolean] `true` (also `1` or `yes`, case-insensitive) returns only events at least one
395
+ # rule matched (`rules_matched_count` above 0). Any other value is ignored.
396
+ # @param occurred_from [Time, String] Only events with `occurred_at` at or after this instant (inclusive). Send
397
+ # an ISO 8601 value: `2026-10-01T00:00:00Z`, an explicit offset with the `+` percent-encoded
398
+ # (`2026-10-01T02:00:00%2B02:00`; an unencoded `+` is decoded as a space and the value no longer parses), or a
399
+ # date alone (`2026-10-01`), which means 00:00:00 UTC of that day. A value without an offset is read as UTC.
400
+ # Values in any othe...
401
+ # @param occurred_to [Time, String] Only events with `occurred_at` at or before this instant (inclusive). A date
402
+ # alone means the start of that day, so `occurred_to=2026-10-15` excludes the rest of 15 October; send
403
+ # `2026-10-15T23:59:59Z` to include it. Send an ISO 8601 value: `2026-10-01T00:00:00Z`, an explicit offset with
404
+ # the `+` percent-encoded (`2026-10-01T02:00:00%2B02:00`; an unencoded `+` is decoded as a space and the value
405
+ # no...
406
+ # @param search [String] Case-insensitive substring match on `event_id`, `action_type`, `subject_vendor_data` or
407
+ # `counterparty_vendor_data`.
408
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
409
+ # @return [Didit::Page<Didit::Types::MonitoringEvent>]
410
+ def retrieve_subject_timeline(
411
+ vendor_data,
412
+ entity_type: OMIT,
413
+ limit: OMIT,
414
+ offset: OMIT,
415
+ event_category: OMIT,
416
+ action_type: OMIT,
417
+ status: OMIT,
418
+ retention_class: OMIT,
419
+ business_vendor_data: OMIT,
420
+ session_id: OMIT,
421
+ device_fingerprint: OMIT,
422
+ ip_address: OMIT,
423
+ game_id: OMIT,
424
+ round_id: OMIT,
425
+ affiliate_code: OMIT,
426
+ payment_reference_id: OMIT,
427
+ counterparty_vendor_data: OMIT,
428
+ matched_only: OMIT,
429
+ occurred_from: OMIT,
430
+ occurred_to: OMIT,
431
+ search: OMIT,
432
+ request_options: nil
433
+ )
434
+ @client.request(
435
+ :get,
436
+ "/v3/events/subjects/{vendor_data}/",
437
+ path_params: { "vendor_data" => vendor_data },
438
+ query: {
439
+ "entity_type" => entity_type,
440
+ "limit" => limit,
441
+ "offset" => offset,
442
+ "event_category" => event_category,
443
+ "action_type" => action_type,
444
+ "status" => status,
445
+ "retention_class" => retention_class,
446
+ "business_vendor_data" => business_vendor_data,
447
+ "session_id" => session_id,
448
+ "device_fingerprint" => device_fingerprint,
449
+ "ip_address" => ip_address,
450
+ "game_id" => game_id,
451
+ "round_id" => round_id,
452
+ "affiliate_code" => affiliate_code,
453
+ "payment_reference_id" => payment_reference_id,
454
+ "counterparty_vendor_data" => counterparty_vendor_data,
455
+ "matched_only" => matched_only,
456
+ "occurred_from" => occurred_from,
457
+ "occurred_to" => occurred_to,
458
+ "search" => search
459
+ },
460
+ page: Types::MonitoringEvent,
461
+ request_options: request_options
462
+ )
463
+ end
464
+ end
465
+ end
466
+ end