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,521 @@
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 +users+ resource.
7
+ class Users < Didit::Resource
8
+ # Batch delete users
9
+ #
10
+ # **Permanently delete** users: the user records are removed permanently. For everyday blocking prefer [Update
11
+ # User Status](#patch-/v3/users/-vendor_data-/update-status/) with `BLOCKED`. Select users with
12
+ # `vendor_data_list`, with `didit_internal_id_list`, or with both at once; or pass `delete_all: true`. This
13
+ # endpoint never narrows `delete_all` with filters. The Console's People filters are refused with a `400` (see
14
+ # the `400` response), so a narrowed intent does not turn into a full wipe. Two exceptions:
15
+ # `filter_has_approved_sessions` and `filter_has_declined_sessions` are not refused and not applied, so with
16
+ # `delete_all: true` they still delete every user; do not send them.
17
+ #
18
+ # **Biometric templates:** every image-free biometric template retained for these users after session deletion
19
+ # (see `/v3/biometric-templates/`) is purged before the user is deleted, so the person stops matching in
20
+ # duplicate detection and Face Search. If a template cannot be purged because a biometric store is unavailable,
21
+ # the call returns `503`, no user in the request is deleted, and repeating the request finishes the job.
22
+ #
23
+ # **Filed regulatory reports:** if the selected data is in a finalized regulatory report, the whole request is
24
+ # refused with `409` and nothing is deleted. The body uses `code: in_filed_report` and names each report with
25
+ # `uuid`, `report_number`, `report_type` and `case_uuid`. Delete the reports, then repeat the request.
26
+ #
27
+ # +POST /v3/users/delete/+
28
+ #
29
+ # @param vendor_data_list [Array<String>] Your own identifiers to delete, matched exactly as sent.
30
+ # @param didit_internal_id_list [Array<String>] Didit internal user IDs to delete - the `didit_internal_id`
31
+ # returned by the create and get endpoints.
32
+ # @param delete_all [Boolean] If `true`, deletes every user in the application.
33
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
34
+ # @return [Didit::Types::UsersBatchDeleteResponse]
35
+ def batch_delete(vendor_data_list: OMIT, didit_internal_id_list: OMIT, delete_all: OMIT, request_options: nil)
36
+ @client.request(
37
+ :post,
38
+ "/v3/users/delete/",
39
+ body: {
40
+ "vendor_data_list" => vendor_data_list,
41
+ "didit_internal_id_list" => didit_internal_id_list,
42
+ "delete_all" => delete_all
43
+ },
44
+ response: Types::UsersBatchDeleteResponse,
45
+ request_options: request_options
46
+ )
47
+ end
48
+
49
+ # Create user
50
+ #
51
+ # Create a [user](/entities/users) by `vendor_data`, before or without a verification session. `vendor_data`
52
+ # must be unique among the application's users (a duplicate returns `400`). Not idempotent.
53
+ #
54
+ # **Contact details:** `email` and `phone_number` are stored in `metadata.contact`, and `country` in
55
+ # `metadata.address`. When you send `first_name` or `last_name` without `full_name`, Didit joins them into
56
+ # `full_name`.
57
+ #
58
+ # **Verification link:** with `send_verification_link: true`, Didit also creates a verification session for the
59
+ # person on `workflow_id` and emails them the link at `email`. The session runs the same checks as [Create
60
+ # Session](/sessions-api/create-session), such as the blocklist and your credit balance. The person and the
61
+ # session are created together or not at all: if any check fails, nothing is written and no email is sent. The
62
+ # response's `verification_link` describes the session, and is `null` when you don't ask for a link.
63
+ #
64
+ # **API key access:** a scoped API key needs `users` write. With `send_verification_link: true` it also needs
65
+ # `sessions` write, or the call answers `403` before anything is written. Full-access keys are unaffected. See
66
+ # [API keys](/console/api-keys).
67
+ #
68
+ # +POST /v3/users/create/+
69
+ #
70
+ # @param vendor_data [String] Your unique identifier for this user (free-form string, NOT a UUID). Must be
71
+ # unique among the application's users; matched exactly as sent.
72
+ # @param full_name [String, nil] Full legal name of the user.
73
+ # @param display_name [String, nil] Friendly display name shown in the console (takes precedence over
74
+ # `full_name` for UI display).
75
+ # @param date_of_birth [Date, String, nil] Date of birth in `YYYY-MM-DD` format.
76
+ # @param status [String] Initial lifecycle status. Defaults to `ACTIVE`.
77
+ # @param metadata [Hash, nil] Arbitrary JSON object you attach to the user. Defaults to `{}`.
78
+ # @param approved_emails [Array<String>] Pre-trusted email addresses for this user, e.g. `["john@example.com"]`.
79
+ # @param approved_phones [Array<String>] Pre-trusted phone numbers for this user, e.g. `["+14155551234"]`.
80
+ # @param issuing_states [Array<String>] Pre-recorded issuing countries (ISO 3166-1 alpha-3), e.g. `["USA"]`.
81
+ # @param first_name [String] Given name. When `full_name` is not sent, Didit joins `first_name` and `last_name`
82
+ # with a space into `full_name`. Not returned as a separate field.
83
+ # @param last_name [String] Family name. Joined with `first_name` into `full_name` when `full_name` is not sent.
84
+ # Not returned as a separate field.
85
+ # @param email [String] Contact email, stored in `metadata.contact.email` (it replaces an `email` you send
86
+ # inside `metadata.contact`). Required when `send_verification_link` is `true`: the link is sent to this
87
+ # address. If `metadata.contact` is not a JSON object, the call answers `400` on this field.
88
+ # @param phone_number [String] Contact phone number, stored in `metadata.contact.phone_number`. If
89
+ # `metadata.contact` is not a JSON object, the call answers `400` on this field.
90
+ # @param country [String] Country as an ISO 3166 code, alpha-2 or alpha-3 (`ES` or `ESP`). Stored uppercased in
91
+ # `metadata.address.country`. If `metadata.address` is not a JSON object, the call answers `400` on this field.
92
+ # @param send_verification_link [Boolean] When `true`, Didit creates a verification session for the person on
93
+ # `workflow_id` and emails them the link at `email`. Requires `email` and `workflow_id`. A scoped API key also
94
+ # needs `sessions` write.
95
+ # @param workflow_id [String] The workflow of the verification session. Required when `send_verification_link`
96
+ # is `true`. It must verify a person: a Business Verification (KYB) workflow is refused. Ignored otherwise.
97
+ # @param language [String] Language of the verification email, as a [supported
98
+ # language](/integration/supported-languages) code. English when omitted. Ignored when `send_verification_link`
99
+ # is not `true`.
100
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
101
+ # @return [Didit::Types::UsersCreateResponse]
102
+ def create(
103
+ vendor_data:,
104
+ full_name: OMIT,
105
+ display_name: OMIT,
106
+ date_of_birth: OMIT,
107
+ status: OMIT,
108
+ metadata: OMIT,
109
+ approved_emails: OMIT,
110
+ approved_phones: OMIT,
111
+ issuing_states: OMIT,
112
+ first_name: OMIT,
113
+ last_name: OMIT,
114
+ email: OMIT,
115
+ phone_number: OMIT,
116
+ country: OMIT,
117
+ send_verification_link: OMIT,
118
+ workflow_id: OMIT,
119
+ language: OMIT,
120
+ request_options: nil
121
+ )
122
+ @client.request(
123
+ :post,
124
+ "/v3/users/create/",
125
+ body: {
126
+ "vendor_data" => vendor_data,
127
+ "full_name" => full_name,
128
+ "display_name" => display_name,
129
+ "date_of_birth" => date_of_birth,
130
+ "status" => status,
131
+ "metadata" => metadata,
132
+ "approved_emails" => approved_emails,
133
+ "approved_phones" => approved_phones,
134
+ "issuing_states" => issuing_states,
135
+ "first_name" => first_name,
136
+ "last_name" => last_name,
137
+ "email" => email,
138
+ "phone_number" => phone_number,
139
+ "country" => country,
140
+ "send_verification_link" => send_verification_link,
141
+ "workflow_id" => workflow_id,
142
+ "language" => language
143
+ },
144
+ response: Types::UsersCreateResponse,
145
+ request_options: request_options
146
+ )
147
+ end
148
+
149
+ # Download the full user history PDF report
150
+ #
151
+ # Render and download one compliance-ready PDF containing the full verification history of the user identified
152
+ # by `vendor_data`. It is the same document the Console produces from **User detail → Actions → Download PDF**,
153
+ # so periodic compliance exports no longer need a person clicking in the Console.
154
+ #
155
+ # **What the report contains.** A cover page with the profile summary (name, date of birth, issuing states,
156
+ # approved emails and phones), the latest status of every feature, the session counters and an index of the
157
+ # sessions included - followed by the standard report of every included session, in chronological order (oldest
158
+ # first). Each session report is the same document `GET /v3/session/{sessionId}/generate-pdf/` returns for that
159
+ # session.
160
+ #
161
+ # **Eligible sessions.** Only User Verification (KYC) sessions in `Approved`, `Declined`, `In Review` or `Kyc
162
+ # Expired` are included; sessions in any other status are skipped. If the user has no session in one of those
163
+ # statuses the endpoint returns `403` - see below.
164
+ #
165
+ # **Cap.** The report is capped at the **20 most recent** reportable sessions. When a user has more, the newest
166
+ # 20 are included and the cover page states how many older sessions were left out. Use `GET
167
+ # /v3/sessions/?vendor_data=…` for the complete list as JSON.
168
+ #
169
+ # **Branding.** If your application has white-label customization, the cover and every session report are
170
+ # rendered with your logo and privacy-policy URL; otherwise they carry Didit branding. Reports are rendered in
171
+ # English - there is no language parameter.
172
+ #
173
+ # **No caching.** Every call re-renders the PDF from the current data, so a report generated after a manual
174
+ # review reflects the reviewer's decision. Two calls for the same user can produce byte-different files -
175
+ # archive the downloaded file if you need an immutable copy.
176
+ #
177
+ # **Latency.** Rendering is synchronous and downloads every stored image of every included session, so a user
178
+ # with many media-heavy sessions can take tens of seconds. Use a generous client read timeout (120 s
179
+ # recommended) and stream the body to disk. Generation stops at a server-side time budget instead of running
180
+ # until your client gives up: if that budget is reached, the response is still a valid PDF containing the most
181
+ # recent sessions, and the cover states how many were omitted.
182
+ #
183
+ # **Scope.** The user is resolved inside the application that owns the API key. A key can never export a user of
184
+ # another application - such a user does not exist for it and the endpoint returns `404`.
185
+ #
186
+ # **Trailing slash.** The canonical route ends with a trailing slash (`…/generate-pdf/`). A request without it
187
+ # is served directly with the same response - there is no `301` redirect, so no client has to follow redirects
188
+ # and `curl` does not need `-L`. Use the slashed URL as in the samples.
189
+ #
190
+ # +GET /v3/users/{vendor_data}/generate-pdf/+
191
+ #
192
+ # @param vendor_data [String] Your unique identifier for the user - a free-form string (NOT a UUID). This is the
193
+ # same value you passed as `vendor_data` when creating the user's sessions, matched exactly as sent. URL-encode
194
+ # it; a value containing `/` cannot be addressed by this route.
195
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
196
+ # @return [String, nil] the body bytes, or nil when a block receives the chunks
197
+ def generate_pdf(vendor_data, request_options: nil, &block)
198
+ @client.request(
199
+ :get,
200
+ "/v3/users/{vendor_data}/generate-pdf/",
201
+ path_params: { "vendor_data" => vendor_data },
202
+ response: :binary,
203
+ accept: "application/pdf, application/json",
204
+ request_options: request_options, &block
205
+ )
206
+ end
207
+
208
+ # List users
209
+ #
210
+ # List [users](/entities/users) Didit assembles from KYC sessions sharing the same `vendor_data` (free-form
211
+ # string, NOT a UUID), plus users created via the API. Paginated, ordered by `last_session_at` desc. This
212
+ # endpoint does not support filtering or search parameters - fetch pages and filter client-side.
213
+ #
214
+ # +GET /v3/users/+
215
+ #
216
+ # @param limit [Integer] Page size. Defaults to 50 when omitted. There is no enforced maximum, but keep pages
217
+ # small for latency.
218
+ # @param offset [Integer] Zero-based offset of the first record to return. Prefer following the `next` URL from
219
+ # the previous page over computing this by hand.
220
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
221
+ # @return [Didit::Page<Didit::Types::UserListItem>]
222
+ def list(limit: OMIT, offset: OMIT, request_options: nil)
223
+ @client.request(
224
+ :get,
225
+ "/v3/users/",
226
+ query: {
227
+ "limit" => limit,
228
+ "offset" => offset
229
+ },
230
+ page: Types::UserListItem,
231
+ request_options: request_options
232
+ )
233
+ end
234
+
235
+ # List networks for a user
236
+ #
237
+ # List the networks a vendor user belongs to.
238
+ #
239
+ # +GET /v3/organization/{organization_id}/application/{application_id}/users/{vendor_user_uuid}/networks/+
240
+ #
241
+ # @param vendor_user_uuid [String] Vendor user UUID.
242
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
243
+ # @return [Didit::Types::EntityNetworkMembershipList]
244
+ def list_networks(vendor_user_uuid, request_options: nil)
245
+ @client.request(
246
+ :get,
247
+ "/v3/organization/{organization_id}/application/{application_id}/users/{vendor_user_uuid}/networks/",
248
+ path_params: { "vendor_user_uuid" => vendor_user_uuid },
249
+ scope: :application,
250
+ response: Types::EntityNetworkMembershipList,
251
+ request_options: request_options
252
+ )
253
+ end
254
+
255
+ # Get user
256
+ #
257
+ # Fetch one [user](/entities/users) by `vendor_data` (exact match). Adds `metadata`, `comments`, and
258
+ # `updated_at` to the list view, and switches `tags` to the detailed tag-link shape.
259
+ #
260
+ # +GET /v3/users/{vendor_data}/+
261
+ #
262
+ # @param vendor_data [String] Your unique identifier for the user - a free-form string (NOT a UUID). This is the
263
+ # same value you passed as `vendor_data` when creating the session that first introduced this user, matched
264
+ # exactly as sent.
265
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
266
+ # @return [Didit::Types::UserDetailItem]
267
+ def retrieve(vendor_data, request_options: nil)
268
+ @client.request(
269
+ :get,
270
+ "/v3/users/{vendor_data}/",
271
+ path_params: { "vendor_data" => vendor_data },
272
+ response: Types::UserDetailItem,
273
+ request_options: request_options
274
+ )
275
+ end
276
+
277
+ # Get AML ongoing monitoring job
278
+ #
279
+ # Progress and per-outcome counters of a monitoring toggle job. Poll every couple of seconds while status is
280
+ # PENDING or PROCESSING.
281
+ #
282
+ # +GET /v3/organization/{organization_id}/application/{application_id}/vendor-users/toggle-ongoing-monitoring/{job_id}/+
283
+ #
284
+ # @param job_id [String] Monitoring job UUID returned by the toggle endpoint.
285
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
286
+ # @return [Didit::Types::OngoingMonitoringJob]
287
+ def retrieve_ongoing_monitoring_job(job_id, request_options: nil)
288
+ @client.request(
289
+ :get,
290
+ "/v3/organization/{organization_id}/application/{application_id}/vendor-users/toggle-ongoing-monitoring/{job_id}/",
291
+ path_params: { "job_id" => job_id },
292
+ scope: :application,
293
+ response: Types::OngoingMonitoringJob,
294
+ request_options: request_options
295
+ )
296
+ end
297
+
298
+ # Enable or disable AML ongoing monitoring for users
299
+ #
300
+ # Turns AML ongoing monitoring on or off for the selected users, with the same semantics as the Business
301
+ # Console. Exactly one monitored AML screening is kept per user, so a profile that verified several times is
302
+ # monitored and billed once; disabling turns monitoring off across all of the profile's screenings. Users
303
+ # without any AML screening are screened first (billed as a regular AML screening) when they have the full name,
304
+ # date of birth and country needed; otherwise they are reported as `skipped_no_identity_data`.
305
+ #
306
+ # Set `estimate_only: true` to preview counts and costs without writing anything. Selections of 20 profiles or
307
+ # fewer resolve inline and return `200` with the completed job; larger selections return `202` and run in the
308
+ # background - poll [Get AML monitoring job](#get-/v3/aml-monitoring/jobs/-job_id-/) with the returned `job_id`.
309
+ # Enabling is refused with `403` when the organization balance does not cover the estimate. Identifiers that
310
+ # match nothing are listed in `unmatched` and never fail the request: a selection that matches nothing completes
311
+ # as an empty job (`total` 0), the same convention as the batch delete endpoints.
312
+ #
313
+ # +POST /v3/users/aml-monitoring/+
314
+ #
315
+ # @param is_enabled [Boolean] true to enable monitoring, false to disable it.
316
+ # @param estimate_only [Boolean] When true, returns the cost estimate and performs no writes - no screening, no
317
+ # billing, no job.
318
+ # @param vendor_data_list [Array<String>] Your own identifiers of the users to toggle, matched exactly as sent.
319
+ # @param didit_internal_id_list [Array<String>] Didit internal ids of the users to toggle - the
320
+ # `didit_internal_id` returned by the create, get and list endpoints.
321
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
322
+ # @return [Didit::Types::AMLMonitoringToggleResult, Didit::Types::AMLMonitoringJob]
323
+ def set_aml_monitoring(
324
+ is_enabled:,
325
+ estimate_only: OMIT,
326
+ vendor_data_list: OMIT,
327
+ didit_internal_id_list: OMIT,
328
+ request_options: nil
329
+ )
330
+ @client.request(
331
+ :post,
332
+ "/v3/users/aml-monitoring/",
333
+ body: {
334
+ "is_enabled" => is_enabled,
335
+ "estimate_only" => estimate_only,
336
+ "vendor_data_list" => vendor_data_list,
337
+ "didit_internal_id_list" => didit_internal_id_list
338
+ },
339
+ response: { 200 => Types::AMLMonitoringToggleResult, 202 => Types::AMLMonitoringJob },
340
+ request_options: request_options
341
+ )
342
+ end
343
+
344
+ # Toggle AML ongoing monitoring for users
345
+ #
346
+ # Enables or disables AML ongoing monitoring at the user level. Exactly one monitored AML screening is kept per
347
+ # user; users without any AML screening (for example imported users) get one created and screened first, billed
348
+ # as a regular AML screening. Set estimate_only to preview counts and costs without writing. Batches of 20 or
349
+ # fewer resolve inline (200, COMPLETED); larger batches return 202 and run asynchronously.
350
+ #
351
+ # +PATCH /v3/organization/{organization_id}/application/{application_id}/vendor-users/toggle-ongoing-monitoring/+
352
+ #
353
+ # @param is_enabled [Boolean] true to enable monitoring, false to disable it.
354
+ # @param estimate_only [Boolean] When true, returns the cost estimate and performs no writes.
355
+ # @param update_all [Boolean] Apply to every entity of the application (scoped by the filter_* params when
356
+ # present).
357
+ # @param filter_search [String]
358
+ # @param filter_status [Array<String>]
359
+ # @param filter_country [String]
360
+ # @param filter_date_from [Date, String]
361
+ # @param filter_date_to [Date, String]
362
+ # @param didit_internal_id_list [Array<String>] Entities to toggle. Required unless update_all is true.
363
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
364
+ # @return [Didit::Types::OngoingMonitoringToggleResult, Didit::Types::OngoingMonitoringJob]
365
+ def set_ongoing_monitoring(
366
+ is_enabled:,
367
+ estimate_only: OMIT,
368
+ update_all: OMIT,
369
+ filter_search: OMIT,
370
+ filter_status: OMIT,
371
+ filter_country: OMIT,
372
+ filter_date_from: OMIT,
373
+ filter_date_to: OMIT,
374
+ didit_internal_id_list: OMIT,
375
+ request_options: nil
376
+ )
377
+ @client.request(
378
+ :patch,
379
+ "/v3/organization/{organization_id}/application/{application_id}/vendor-users/toggle-ongoing-monitoring/",
380
+ body: {
381
+ "is_enabled" => is_enabled,
382
+ "estimate_only" => estimate_only,
383
+ "update_all" => update_all,
384
+ "filter_search" => filter_search,
385
+ "filter_status" => filter_status,
386
+ "filter_country" => filter_country,
387
+ "filter_date_from" => filter_date_from,
388
+ "filter_date_to" => filter_date_to,
389
+ "didit_internal_id_list" => didit_internal_id_list
390
+ },
391
+ scope: :application,
392
+ response: { 200 => Types::OngoingMonitoringToggleResult, 202 => Types::OngoingMonitoringJob },
393
+ request_options: request_options
394
+ )
395
+ end
396
+
397
+ # Update user
398
+ #
399
+ # Partial update of a user: `display_name`, `full_name`, `date_of_birth`, `status`, `metadata`,
400
+ # `approved_emails`/`approved_phones`/`issuing_states`. `metadata` fully replaces. Changing `status` here works
401
+ # like [Update User Status](#patch-/v3/users/-vendor_data-/update-status/): it records a `STATUS_CHANGED`
402
+ # activity with the optional `reason`, and `BLOCKED` adds the `vendor_data` to the system blocklist (moving away
403
+ # from `BLOCKED` removes that entry). Changes to `display_name`, `full_name`, `date_of_birth` or `metadata` are
404
+ # recorded as a `PROFILE_UPDATED` activity.
405
+ #
406
+ # +PATCH /v3/users/{vendor_data}/+
407
+ #
408
+ # @param vendor_data [String] Your unique identifier for the user (free-form string, NOT a UUID).
409
+ # @param full_name [String, nil] Full name of the user
410
+ # @param display_name [String, nil] Custom display name for this user
411
+ # @param date_of_birth [Date, String, nil] Date of birth in YYYY-MM-DD format
412
+ # @param status [String] User lifecycle status. A change is recorded as a `STATUS_CHANGED` activity, and
413
+ # `BLOCKED` adds the `vendor_data` to the system blocklist (moving away from `BLOCKED` removes that entry).
414
+ # @param metadata [Hash, nil] Arbitrary JSON object you attach to the user. **Fully replaces** the existing
415
+ # metadata on update - merge client-side if you only want to add keys.
416
+ # @param approved_emails [Array<String>] Verified email addresses for this user, e.g. `["john@example.com"]`.
417
+ # Fully replaces the stored list.
418
+ # @param approved_phones [Array<String>] Verified phone numbers for this user. Fully replaces the stored list.
419
+ # @param issuing_states [Array<String>] Issuing countries (ISO 3166-1 alpha-3), e.g. `["USA"]`. Fully replaces
420
+ # the stored list.
421
+ # @param reason [String, nil] Why the status changed. Recorded on the status-change entry of the user's activity
422
+ # (`comments[].comment`, and **Activity** in the Business Console), only when the status actually changes.
423
+ # Webhooks do not carry it.
424
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
425
+ # @return [Didit::Types::UserDetailItem]
426
+ def update(
427
+ vendor_data,
428
+ full_name: OMIT,
429
+ display_name: OMIT,
430
+ date_of_birth: OMIT,
431
+ status: OMIT,
432
+ metadata: OMIT,
433
+ approved_emails: OMIT,
434
+ approved_phones: OMIT,
435
+ issuing_states: OMIT,
436
+ reason: OMIT,
437
+ request_options: nil
438
+ )
439
+ @client.request(
440
+ :patch,
441
+ "/v3/users/{vendor_data}/",
442
+ path_params: { "vendor_data" => vendor_data },
443
+ body: {
444
+ "full_name" => full_name,
445
+ "display_name" => display_name,
446
+ "date_of_birth" => date_of_birth,
447
+ "status" => status,
448
+ "metadata" => metadata,
449
+ "approved_emails" => approved_emails,
450
+ "approved_phones" => approved_phones,
451
+ "issuing_states" => issuing_states,
452
+ "reason" => reason
453
+ },
454
+ response: Types::UserDetailItem,
455
+ request_options: request_options
456
+ )
457
+ end
458
+
459
+ # Update user status
460
+ #
461
+ # Flip only the lifecycle `status` of a user: `ACTIVE`, `FLAGGED` or `BLOCKED` (not session statuses). `BLOCKED`
462
+ # adds the `vendor_data` to the system blocklist; moving away from `BLOCKED` removes that entry. Each change is
463
+ # recorded as a `STATUS_CHANGED` activity on the user, with the optional `reason` as its `comment`. Sending the
464
+ # current status changes nothing and records no `reason`. The `user.status.updated` webhook does not carry
465
+ # `reason`.
466
+ #
467
+ # +PATCH /v3/users/{vendor_data}/update-status/+
468
+ #
469
+ # @param vendor_data [String] Your unique identifier for the user.
470
+ # @param status [String] New lifecycle status. `BLOCKED` also adds the `vendor_data` to the system blocklist.
471
+ # @param reason [String, nil] Why the status changed. Recorded on the status-change entry of the user's activity
472
+ # (`comments[].comment`, and **Activity** in the Business Console), only when the status actually changes.
473
+ # Webhooks do not carry it.
474
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
475
+ # @return [Didit::Types::UserDetailItem]
476
+ def update_status(vendor_data, status:, reason: OMIT, request_options: nil)
477
+ @client.request(
478
+ :patch,
479
+ "/v3/users/{vendor_data}/update-status/",
480
+ path_params: { "vendor_data" => vendor_data },
481
+ body: {
482
+ "status" => status,
483
+ "reason" => reason
484
+ },
485
+ response: Types::UserDetailItem,
486
+ request_options: request_options
487
+ )
488
+ end
489
+
490
+ # Upload user face
491
+ #
492
+ # Attach a trusted imported face image to an existing User profile. Use this after creating or retrieving a User
493
+ # by `vendor_data` and reading its `didit_internal_id`. The uploaded face is stored on the User profile and
494
+ # indexed for duplicate detection and face search. It is not added to a face blocklist.
495
+ #
496
+ # +POST /v3/organization/{organization_id}/application/{application_id}/vendor-users/by-id/{didit_internal_id}/faces/upload/+
497
+ #
498
+ # @param didit_internal_id [String] Didit's internal User UUID, returned as `didit_internal_id` by `GET
499
+ # /v3/users/{vendor_data}/` and `POST /v3/users/create/`.
500
+ # @param image [String] Raw base64-encoded JPG or PNG face image. Do not include a `data:image/...;base64,`
501
+ # prefix. Max decoded size: 2 MB.
502
+ # @param comment [String] Optional operator-visible note for the uploaded face.
503
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
504
+ # @return [Didit::Types::UsersUploadFaceResponse]
505
+ def upload_face(didit_internal_id, image:, comment: OMIT, request_options: nil)
506
+ @client.request(
507
+ :post,
508
+ "/v3/organization/{organization_id}/application/{application_id}/vendor-users/by-id/{didit_internal_id}/faces/upload/",
509
+ path_params: { "didit_internal_id" => didit_internal_id },
510
+ body: {
511
+ "image" => image,
512
+ "comment" => comment
513
+ },
514
+ scope: :application,
515
+ response: Types::UsersUploadFaceResponse,
516
+ request_options: request_options
517
+ )
518
+ end
519
+ end
520
+ end
521
+ end