@vouchsafe/node 0.1.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 (203) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +99 -0
  3. package/dist/cjs/VouchsafeClient.d.ts +46 -0
  4. package/dist/cjs/VouchsafeClient.d.ts.map +1 -0
  5. package/dist/cjs/VouchsafeClient.js +96 -0
  6. package/dist/cjs/VouchsafeClient.js.map +1 -0
  7. package/dist/cjs/index.d.ts +3 -0
  8. package/dist/cjs/index.d.ts.map +1 -0
  9. package/dist/cjs/index.js +22 -0
  10. package/dist/cjs/index.js.map +1 -0
  11. package/dist/cjs/openapi/apis/AuthenticationApi.d.ts +30 -0
  12. package/dist/cjs/openapi/apis/AuthenticationApi.d.ts.map +1 -0
  13. package/dist/cjs/openapi/apis/AuthenticationApi.js +85 -0
  14. package/dist/cjs/openapi/apis/AuthenticationApi.js.map +1 -0
  15. package/dist/cjs/openapi/apis/SmartLookupsApi.d.ts +41 -0
  16. package/dist/cjs/openapi/apis/SmartLookupsApi.d.ts.map +1 -0
  17. package/dist/cjs/openapi/apis/SmartLookupsApi.js +127 -0
  18. package/dist/cjs/openapi/apis/SmartLookupsApi.js.map +1 -0
  19. package/dist/cjs/openapi/apis/VerificationsApi.d.ts +52 -0
  20. package/dist/cjs/openapi/apis/VerificationsApi.d.ts.map +1 -0
  21. package/dist/cjs/openapi/apis/VerificationsApi.js +157 -0
  22. package/dist/cjs/openapi/apis/VerificationsApi.js.map +1 -0
  23. package/dist/cjs/openapi/apis/index.d.ts +4 -0
  24. package/dist/cjs/openapi/apis/index.d.ts.map +1 -0
  25. package/dist/cjs/openapi/apis/index.js +22 -0
  26. package/dist/cjs/openapi/apis/index.js.map +1 -0
  27. package/dist/cjs/openapi/index.d.ts +4 -0
  28. package/dist/cjs/openapi/index.d.ts.map +1 -0
  29. package/dist/cjs/openapi/index.js +22 -0
  30. package/dist/cjs/openapi/index.js.map +1 -0
  31. package/dist/cjs/openapi/models/ApiErrorResponse.d.ts +45 -0
  32. package/dist/cjs/openapi/models/ApiErrorResponse.d.ts.map +1 -0
  33. package/dist/cjs/openapi/models/ApiErrorResponse.js +57 -0
  34. package/dist/cjs/openapi/models/ApiErrorResponse.js.map +1 -0
  35. package/dist/cjs/openapi/models/AuthenticateRequestBody.d.ts +39 -0
  36. package/dist/cjs/openapi/models/AuthenticateRequestBody.d.ts.map +1 -0
  37. package/dist/cjs/openapi/models/AuthenticateRequestBody.js +55 -0
  38. package/dist/cjs/openapi/models/AuthenticateRequestBody.js.map +1 -0
  39. package/dist/cjs/openapi/models/AuthenticateResponse.d.ts +39 -0
  40. package/dist/cjs/openapi/models/AuthenticateResponse.d.ts.map +1 -0
  41. package/dist/cjs/openapi/models/AuthenticateResponse.js +55 -0
  42. package/dist/cjs/openapi/models/AuthenticateResponse.js.map +1 -0
  43. package/dist/cjs/openapi/models/CheckResult.d.ts +41 -0
  44. package/dist/cjs/openapi/models/CheckResult.d.ts.map +1 -0
  45. package/dist/cjs/openapi/models/CheckResult.js +55 -0
  46. package/dist/cjs/openapi/models/CheckResult.js.map +1 -0
  47. package/dist/cjs/openapi/models/CheckState.d.ts +28 -0
  48. package/dist/cjs/openapi/models/CheckState.d.ts.map +1 -0
  49. package/dist/cjs/openapi/models/CheckState.js +54 -0
  50. package/dist/cjs/openapi/models/CheckState.js.map +1 -0
  51. package/dist/cjs/openapi/models/GetSmartLookupResponse.d.ts +89 -0
  52. package/dist/cjs/openapi/models/GetSmartLookupResponse.d.ts.map +1 -0
  53. package/dist/cjs/openapi/models/GetSmartLookupResponse.js +89 -0
  54. package/dist/cjs/openapi/models/GetSmartLookupResponse.js.map +1 -0
  55. package/dist/cjs/openapi/models/Model36EnumsBackgroundCheck.d.ts +28 -0
  56. package/dist/cjs/openapi/models/Model36EnumsBackgroundCheck.d.ts.map +1 -0
  57. package/dist/cjs/openapi/models/Model36EnumsBackgroundCheck.js +54 -0
  58. package/dist/cjs/openapi/models/Model36EnumsBackgroundCheck.js.map +1 -0
  59. package/dist/cjs/openapi/models/PostcodeResponse.d.ts +33 -0
  60. package/dist/cjs/openapi/models/PostcodeResponse.d.ts.map +1 -0
  61. package/dist/cjs/openapi/models/PostcodeResponse.js +51 -0
  62. package/dist/cjs/openapi/models/PostcodeResponse.js.map +1 -0
  63. package/dist/cjs/openapi/models/Reason.d.ts +28 -0
  64. package/dist/cjs/openapi/models/Reason.d.ts.map +1 -0
  65. package/dist/cjs/openapi/models/Reason.js +54 -0
  66. package/dist/cjs/openapi/models/Reason.js.map +1 -0
  67. package/dist/cjs/openapi/models/RecordAddressVerificationChecksCheckResult.d.ts +46 -0
  68. package/dist/cjs/openapi/models/RecordAddressVerificationChecksCheckResult.d.ts.map +1 -0
  69. package/dist/cjs/openapi/models/RecordAddressVerificationChecksCheckResult.js +60 -0
  70. package/dist/cjs/openapi/models/RecordAddressVerificationChecksCheckResult.js.map +1 -0
  71. package/dist/cjs/openapi/models/Report.d.ts +41 -0
  72. package/dist/cjs/openapi/models/Report.d.ts.map +1 -0
  73. package/dist/cjs/openapi/models/Report.js +57 -0
  74. package/dist/cjs/openapi/models/Report.js.map +1 -0
  75. package/dist/cjs/openapi/models/RequestVerificationRequestBody.d.ts +97 -0
  76. package/dist/cjs/openapi/models/RequestVerificationRequestBody.d.ts.map +1 -0
  77. package/dist/cjs/openapi/models/RequestVerificationRequestBody.js +69 -0
  78. package/dist/cjs/openapi/models/RequestVerificationRequestBody.js.map +1 -0
  79. package/dist/cjs/openapi/models/RequestVerificationResponse.d.ts +45 -0
  80. package/dist/cjs/openapi/models/RequestVerificationResponse.d.ts.map +1 -0
  81. package/dist/cjs/openapi/models/RequestVerificationResponse.js +59 -0
  82. package/dist/cjs/openapi/models/RequestVerificationResponse.js.map +1 -0
  83. package/dist/cjs/openapi/models/SmartLookupInput.d.ts +64 -0
  84. package/dist/cjs/openapi/models/SmartLookupInput.d.ts.map +1 -0
  85. package/dist/cjs/openapi/models/SmartLookupInput.js +74 -0
  86. package/dist/cjs/openapi/models/SmartLookupInput.js.map +1 -0
  87. package/dist/cjs/openapi/models/Status.d.ts +30 -0
  88. package/dist/cjs/openapi/models/Status.d.ts.map +1 -0
  89. package/dist/cjs/openapi/models/Status.js +56 -0
  90. package/dist/cjs/openapi/models/Status.js.map +1 -0
  91. package/dist/cjs/openapi/models/Verification.d.ts +76 -0
  92. package/dist/cjs/openapi/models/Verification.d.ts.map +1 -0
  93. package/dist/cjs/openapi/models/Verification.js +80 -0
  94. package/dist/cjs/openapi/models/Verification.js.map +1 -0
  95. package/dist/cjs/openapi/models/index.d.ts +17 -0
  96. package/dist/cjs/openapi/models/index.d.ts.map +1 -0
  97. package/dist/cjs/openapi/models/index.js +35 -0
  98. package/dist/cjs/openapi/models/index.js.map +1 -0
  99. package/dist/cjs/openapi/runtime.d.ts +185 -0
  100. package/dist/cjs/openapi/runtime.d.ts.map +1 -0
  101. package/dist/cjs/openapi/runtime.js +339 -0
  102. package/dist/cjs/openapi/runtime.js.map +1 -0
  103. package/dist/esm/VouchsafeClient.d.ts +46 -0
  104. package/dist/esm/VouchsafeClient.d.ts.map +1 -0
  105. package/dist/esm/VouchsafeClient.js +91 -0
  106. package/dist/esm/VouchsafeClient.js.map +1 -0
  107. package/dist/esm/index.d.ts +3 -0
  108. package/dist/esm/index.d.ts.map +1 -0
  109. package/dist/esm/index.js +4 -0
  110. package/dist/esm/index.js.map +1 -0
  111. package/dist/esm/openapi/apis/AuthenticationApi.d.ts +30 -0
  112. package/dist/esm/openapi/apis/AuthenticationApi.d.ts.map +1 -0
  113. package/dist/esm/openapi/apis/AuthenticationApi.js +48 -0
  114. package/dist/esm/openapi/apis/AuthenticationApi.js.map +1 -0
  115. package/dist/esm/openapi/apis/SmartLookupsApi.d.ts +41 -0
  116. package/dist/esm/openapi/apis/SmartLookupsApi.d.ts.map +1 -0
  117. package/dist/esm/openapi/apis/SmartLookupsApi.js +90 -0
  118. package/dist/esm/openapi/apis/SmartLookupsApi.js.map +1 -0
  119. package/dist/esm/openapi/apis/VerificationsApi.d.ts +52 -0
  120. package/dist/esm/openapi/apis/VerificationsApi.d.ts.map +1 -0
  121. package/dist/esm/openapi/apis/VerificationsApi.js +120 -0
  122. package/dist/esm/openapi/apis/VerificationsApi.js.map +1 -0
  123. package/dist/esm/openapi/apis/index.d.ts +4 -0
  124. package/dist/esm/openapi/apis/index.d.ts.map +1 -0
  125. package/dist/esm/openapi/apis/index.js +6 -0
  126. package/dist/esm/openapi/apis/index.js.map +1 -0
  127. package/dist/esm/openapi/index.d.ts +4 -0
  128. package/dist/esm/openapi/index.d.ts.map +1 -0
  129. package/dist/esm/openapi/index.js +6 -0
  130. package/dist/esm/openapi/index.js.map +1 -0
  131. package/dist/esm/openapi/models/ApiErrorResponse.d.ts +45 -0
  132. package/dist/esm/openapi/models/ApiErrorResponse.d.ts.map +1 -0
  133. package/dist/esm/openapi/models/ApiErrorResponse.js +50 -0
  134. package/dist/esm/openapi/models/ApiErrorResponse.js.map +1 -0
  135. package/dist/esm/openapi/models/AuthenticateRequestBody.d.ts +39 -0
  136. package/dist/esm/openapi/models/AuthenticateRequestBody.d.ts.map +1 -0
  137. package/dist/esm/openapi/models/AuthenticateRequestBody.js +48 -0
  138. package/dist/esm/openapi/models/AuthenticateRequestBody.js.map +1 -0
  139. package/dist/esm/openapi/models/AuthenticateResponse.d.ts +39 -0
  140. package/dist/esm/openapi/models/AuthenticateResponse.d.ts.map +1 -0
  141. package/dist/esm/openapi/models/AuthenticateResponse.js +48 -0
  142. package/dist/esm/openapi/models/AuthenticateResponse.js.map +1 -0
  143. package/dist/esm/openapi/models/CheckResult.d.ts +41 -0
  144. package/dist/esm/openapi/models/CheckResult.d.ts.map +1 -0
  145. package/dist/esm/openapi/models/CheckResult.js +48 -0
  146. package/dist/esm/openapi/models/CheckResult.js.map +1 -0
  147. package/dist/esm/openapi/models/CheckState.d.ts +28 -0
  148. package/dist/esm/openapi/models/CheckState.d.ts.map +1 -0
  149. package/dist/esm/openapi/models/CheckState.js +46 -0
  150. package/dist/esm/openapi/models/CheckState.js.map +1 -0
  151. package/dist/esm/openapi/models/GetSmartLookupResponse.d.ts +89 -0
  152. package/dist/esm/openapi/models/GetSmartLookupResponse.d.ts.map +1 -0
  153. package/dist/esm/openapi/models/GetSmartLookupResponse.js +82 -0
  154. package/dist/esm/openapi/models/GetSmartLookupResponse.js.map +1 -0
  155. package/dist/esm/openapi/models/Model36EnumsBackgroundCheck.d.ts +28 -0
  156. package/dist/esm/openapi/models/Model36EnumsBackgroundCheck.d.ts.map +1 -0
  157. package/dist/esm/openapi/models/Model36EnumsBackgroundCheck.js +46 -0
  158. package/dist/esm/openapi/models/Model36EnumsBackgroundCheck.js.map +1 -0
  159. package/dist/esm/openapi/models/PostcodeResponse.d.ts +33 -0
  160. package/dist/esm/openapi/models/PostcodeResponse.d.ts.map +1 -0
  161. package/dist/esm/openapi/models/PostcodeResponse.js +44 -0
  162. package/dist/esm/openapi/models/PostcodeResponse.js.map +1 -0
  163. package/dist/esm/openapi/models/Reason.d.ts +28 -0
  164. package/dist/esm/openapi/models/Reason.d.ts.map +1 -0
  165. package/dist/esm/openapi/models/Reason.js +46 -0
  166. package/dist/esm/openapi/models/Reason.js.map +1 -0
  167. package/dist/esm/openapi/models/RecordAddressVerificationChecksCheckResult.d.ts +46 -0
  168. package/dist/esm/openapi/models/RecordAddressVerificationChecksCheckResult.d.ts.map +1 -0
  169. package/dist/esm/openapi/models/RecordAddressVerificationChecksCheckResult.js +53 -0
  170. package/dist/esm/openapi/models/RecordAddressVerificationChecksCheckResult.js.map +1 -0
  171. package/dist/esm/openapi/models/Report.d.ts +41 -0
  172. package/dist/esm/openapi/models/Report.d.ts.map +1 -0
  173. package/dist/esm/openapi/models/Report.js +50 -0
  174. package/dist/esm/openapi/models/Report.js.map +1 -0
  175. package/dist/esm/openapi/models/RequestVerificationRequestBody.d.ts +97 -0
  176. package/dist/esm/openapi/models/RequestVerificationRequestBody.d.ts.map +1 -0
  177. package/dist/esm/openapi/models/RequestVerificationRequestBody.js +62 -0
  178. package/dist/esm/openapi/models/RequestVerificationRequestBody.js.map +1 -0
  179. package/dist/esm/openapi/models/RequestVerificationResponse.d.ts +45 -0
  180. package/dist/esm/openapi/models/RequestVerificationResponse.d.ts.map +1 -0
  181. package/dist/esm/openapi/models/RequestVerificationResponse.js +52 -0
  182. package/dist/esm/openapi/models/RequestVerificationResponse.js.map +1 -0
  183. package/dist/esm/openapi/models/SmartLookupInput.d.ts +64 -0
  184. package/dist/esm/openapi/models/SmartLookupInput.d.ts.map +1 -0
  185. package/dist/esm/openapi/models/SmartLookupInput.js +66 -0
  186. package/dist/esm/openapi/models/SmartLookupInput.js.map +1 -0
  187. package/dist/esm/openapi/models/Status.d.ts +30 -0
  188. package/dist/esm/openapi/models/Status.d.ts.map +1 -0
  189. package/dist/esm/openapi/models/Status.js +48 -0
  190. package/dist/esm/openapi/models/Status.js.map +1 -0
  191. package/dist/esm/openapi/models/Verification.d.ts +76 -0
  192. package/dist/esm/openapi/models/Verification.d.ts.map +1 -0
  193. package/dist/esm/openapi/models/Verification.js +73 -0
  194. package/dist/esm/openapi/models/Verification.js.map +1 -0
  195. package/dist/esm/openapi/models/index.d.ts +17 -0
  196. package/dist/esm/openapi/models/index.d.ts.map +1 -0
  197. package/dist/esm/openapi/models/index.js +19 -0
  198. package/dist/esm/openapi/models/index.js.map +1 -0
  199. package/dist/esm/openapi/runtime.d.ts +185 -0
  200. package/dist/esm/openapi/runtime.d.ts.map +1 -0
  201. package/dist/esm/openapi/runtime.js +323 -0
  202. package/dist/esm/openapi/runtime.js.map +1 -0
  203. package/package.json +41 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Vouchsafe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,99 @@
1
+ # Vouchsafe Node.js library
2
+
3
+ The Vouchsafe Node library provides convenient, typed access to the Vouchsafe API for applications written in server-side JavaScript.
4
+
5
+ ## Requirements
6
+
7
+ Node 18 or better.
8
+
9
+ ## Installation
10
+
11
+ ```
12
+ npm install vouchsafe
13
+ # or
14
+ yarn add vouchsafe
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ The SDK needs a client ID and secret, which is available in the [Vouchsafe dashboard](https://app.vouchsafe.id). Replace the values below:
20
+
21
+ ```ts
22
+ import { VouchsafeClient } from "vouchsafe-client"
23
+
24
+ const client = new VouchsafeClient({
25
+ client_id: "YOUR_CLIENT_ID",
26
+ client_secret: "YOUR_CLIENT_SECRET",
27
+ })
28
+
29
+ // Request a verification
30
+ const res = await client.requestVerification({
31
+ email: "foo@bar.com",
32
+ })
33
+
34
+ console.log(res.id) // Trackable verification session ID
35
+ console.log(res.url) // Redirect the user here
36
+ ```
37
+
38
+ ### List verifications
39
+
40
+ ```ts
41
+ const res = await client.listVerifications({
42
+ status: "InProgress", // Or any other supported status
43
+ })
44
+ ```
45
+
46
+ ### Get a specific verification
47
+
48
+ ```ts
49
+ const res = await client.getVerification({
50
+ id: "ID",
51
+ })
52
+ ```
53
+
54
+ ### Sandbox mode
55
+
56
+ 1. Add `sandbox: true` when instantiating the client
57
+ 2. Use a sandbox client secret.
58
+
59
+ ### Expiring access tokens
60
+
61
+ The client will automatically store your access token and insert it into every request, and fetch a new one upon expiry.
62
+
63
+ ### Handling errors
64
+
65
+ Client methods will throw an instance of `VouchsafeApiError` if the API returns a bad response.
66
+
67
+ You can catch them like this:
68
+
69
+ ```ts
70
+ try {
71
+ const res = await client.getVerification({
72
+ id: "non-existent",
73
+ })
74
+ } catch (err) {
75
+ if (err instanceof VouchsafeApiError) {
76
+ console.log(err.statusCode, err.message)
77
+ }
78
+ }
79
+ ```
80
+
81
+ ## Development
82
+
83
+ **[See the contribution guidelines for this project](https://github.com/vouchsafe/vouchsafe-node/blob/main/CONTRIBUTING.md)**
84
+
85
+ Contributions including issues and pull requests are welcome.
86
+
87
+ To run the project locally, clone the repo and run:
88
+
89
+ ```bash
90
+ npm install
91
+ npm run generate # regenerate from API spec
92
+ npm run build # compile typescript
93
+ ```
94
+
95
+ ## Further reading
96
+
97
+ - [Developer docs](https://help.vouchsafe.id/en/collections/12439003-developers)
98
+ - [Full API endpoint reference](https://app.vouchsafe.id/docs)
99
+ - [3-minute video guide](https://www.youtube.com/playlist?list=PLx6V6SSTMuF_ZNWBPnysvwmdIwboLViE8)
@@ -0,0 +1,46 @@
1
+ import { RequestVerificationRequestBody, SmartLookupInput, Status } from "./openapi/models";
2
+ interface VouchsafeClientOptions {
3
+ client_id: string;
4
+ client_secret: string;
5
+ sandbox?: boolean;
6
+ }
7
+ export declare class VouchsafeApiError extends Error {
8
+ statusCode: number;
9
+ responseBody: unknown;
10
+ constructor(statusCode: number, responseBody: unknown, message?: string);
11
+ }
12
+ export declare class VouchsafeClient {
13
+ private options;
14
+ private token?;
15
+ private tokenExpiry?;
16
+ private config;
17
+ private authenticationApi;
18
+ private verificationsApi;
19
+ private smartLookupsApi;
20
+ constructor(options: VouchsafeClientOptions);
21
+ /**
22
+ * PRIVATE METHODS
23
+ *
24
+ * To simplify interacting with the API
25
+ */
26
+ private getAccessToken;
27
+ private withErrorHandling;
28
+ /**
29
+ * PUBLIC METHODS
30
+ *
31
+ * One for every endpoint we expose
32
+ */
33
+ getVerification({ id }: {
34
+ id: string;
35
+ }): Promise<import("./openapi").Verification>;
36
+ listVerifications({ status }?: {
37
+ status?: Status;
38
+ }): Promise<import("./openapi").Verification[]>;
39
+ requestVerification(input: RequestVerificationRequestBody): Promise<import("./openapi").RequestVerificationResponse>;
40
+ performSmartLookup(input: SmartLookupInput): Promise<import("./openapi").GetSmartLookupResponse>;
41
+ searchPostcode({ postcode }: {
42
+ postcode: string;
43
+ }): Promise<import("./openapi").PostcodeResponse>;
44
+ }
45
+ export {};
46
+ //# sourceMappingURL=VouchsafeClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VouchsafeClient.d.ts","sourceRoot":"","sources":["../../src/VouchsafeClient.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,8BAA8B,EAC9B,gBAAgB,EAChB,MAAM,EACP,MAAM,kBAAkB,CAAA;AAGzB,UAAU,sBAAsB;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IAEjC,UAAU,EAAE,MAAM;IAClB,YAAY,EAAE,OAAO;gBADrB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,OAAO,EAC5B,OAAO,CAAC,EAAE,MAAM;CAKnB;AAED,qBAAa,eAAe;IASd,OAAO,CAAC,OAAO;IAR3B,OAAO,CAAC,KAAK,CAAC,CAAQ;IACtB,OAAO,CAAC,WAAW,CAAC,CAAM;IAC1B,OAAO,CAAC,MAAM,CAAe;IAE7B,OAAO,CAAC,iBAAiB,CAAmB;IAC5C,OAAO,CAAC,gBAAgB,CAAkB;IAC1C,OAAO,CAAC,eAAe,CAAiB;gBAEpB,OAAO,EAAE,sBAAsB;IAenD;;;;OAIG;IAGH,OAAO,CAAC,cAAc,CAyBrB;IAGD,OAAO,CAAC,iBAAiB,CAYxB;IAED;;;;OAIG;IAEG,eAAe,CAAC,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE;IAItC,iBAAiB,CAAC,EAAE,MAAM,EAAE,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO;IAMtD,mBAAmB,CAAC,KAAK,EAAE,8BAA8B;IAQzD,kBAAkB,CAAC,KAAK,EAAE,gBAAgB;IAQ1C,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE;CAOxD"}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VouchsafeClient = exports.VouchsafeApiError = void 0;
4
+ const openapi_1 = require("./openapi");
5
+ const AuthenticationApi_1 = require("./openapi/apis/AuthenticationApi");
6
+ const VerificationsApi_1 = require("./openapi/apis/VerificationsApi");
7
+ const SmartLookupsApi_1 = require("./openapi/apis/SmartLookupsApi");
8
+ class VouchsafeApiError extends Error {
9
+ constructor(statusCode, responseBody, message) {
10
+ super(message);
11
+ this.statusCode = statusCode;
12
+ this.responseBody = responseBody;
13
+ this.name = "VouchsafeApiError";
14
+ }
15
+ }
16
+ exports.VouchsafeApiError = VouchsafeApiError;
17
+ class VouchsafeClient {
18
+ constructor(options) {
19
+ this.options = options;
20
+ /**
21
+ * PRIVATE METHODS
22
+ *
23
+ * To simplify interacting with the API
24
+ */
25
+ // Handle token expiration and pass into every request
26
+ this.getAccessToken = async () => {
27
+ const now = new Date();
28
+ const bufferMs = 5 * 60 * 1000; // 5 minutes
29
+ if (this.token &&
30
+ this.tokenExpiry &&
31
+ now.getTime() < this.tokenExpiry.getTime() - bufferMs) {
32
+ return this.token;
33
+ }
34
+ const authBody = {
35
+ client_id: this.options.client_id,
36
+ client_secret: this.options.client_secret,
37
+ };
38
+ const response = await this.authenticationApi.authenticate({
39
+ authenticateRequestBody: authBody,
40
+ });
41
+ this.token = response.access_token;
42
+ this.tokenExpiry = new Date(response.expires_at);
43
+ return this.token;
44
+ };
45
+ // Wrap raw fetch response errors and provide something cleaner
46
+ this.withErrorHandling = async (promise) => {
47
+ try {
48
+ return await promise;
49
+ }
50
+ catch (err) {
51
+ if (err.name === "ResponseError" && err.response instanceof Response) {
52
+ const body = await err.response.json().catch(() => ({}));
53
+ const message = body?.message ?? err.response.statusText;
54
+ throw new VouchsafeApiError(err.response.status, body, message);
55
+ }
56
+ throw err;
57
+ }
58
+ };
59
+ const basePath = options.sandbox
60
+ ? "https://app.vouchsafe.id/api/v1/sandbox"
61
+ : "https://app.vouchsafe.id/api/v1";
62
+ this.config = new openapi_1.Configuration({
63
+ basePath,
64
+ accessToken: this.getAccessToken,
65
+ });
66
+ this.authenticationApi = new AuthenticationApi_1.AuthenticationApi(this.config);
67
+ this.verificationsApi = new VerificationsApi_1.VerificationsApi(this.config);
68
+ this.smartLookupsApi = new SmartLookupsApi_1.SmartLookupsApi(this.config);
69
+ }
70
+ /**
71
+ * PUBLIC METHODS
72
+ *
73
+ * One for every endpoint we expose
74
+ */
75
+ async getVerification({ id }) {
76
+ return this.withErrorHandling(this.verificationsApi.getVerification({ id }));
77
+ }
78
+ async listVerifications({ status } = {}) {
79
+ return this.withErrorHandling(this.verificationsApi.listVerifications({ status }));
80
+ }
81
+ async requestVerification(input) {
82
+ return this.withErrorHandling(this.verificationsApi.requestVerification({
83
+ requestVerificationRequestBody: input,
84
+ }));
85
+ }
86
+ async performSmartLookup(input) {
87
+ return this.withErrorHandling(this.smartLookupsApi.performSmartLookup({
88
+ smartLookupInput: input,
89
+ }));
90
+ }
91
+ async searchPostcode({ postcode }) {
92
+ return this.withErrorHandling(this.smartLookupsApi.searchPostcode({ postcode }));
93
+ }
94
+ }
95
+ exports.VouchsafeClient = VouchsafeClient;
96
+ //# sourceMappingURL=VouchsafeClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VouchsafeClient.js","sourceRoot":"","sources":["../../src/VouchsafeClient.ts"],"names":[],"mappings":";;;AAAA,uCAAyC;AACzC,wEAAoE;AACpE,sEAAkE;AAClE,oEAAgE;AAehE,MAAa,iBAAkB,SAAQ,KAAK;IAC1C,YACS,UAAkB,EAClB,YAAqB,EAC5B,OAAgB;QAEhB,KAAK,CAAC,OAAO,CAAC,CAAA;QAJP,eAAU,GAAV,UAAU,CAAQ;QAClB,iBAAY,GAAZ,YAAY,CAAS;QAI5B,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAA;IACjC,CAAC;CACF;AATD,8CASC;AAED,MAAa,eAAe;IAS1B,YAAoB,OAA+B;QAA/B,YAAO,GAAP,OAAO,CAAwB;QAenD;;;;WAIG;QAEH,sDAAsD;QAC9C,mBAAc,GAAG,KAAK,IAAqB,EAAE;YACnD,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAA;YACtB,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAA,CAAC,YAAY;YAE3C,IACE,IAAI,CAAC,KAAK;gBACV,IAAI,CAAC,WAAW;gBAChB,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,QAAQ,EACrD,CAAC;gBACD,OAAO,IAAI,CAAC,KAAK,CAAA;YACnB,CAAC;YAED,MAAM,QAAQ,GAA4B;gBACxC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS;gBACjC,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa;aAC1C,CAAA;YAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC;gBACzD,uBAAuB,EAAE,QAAQ;aAClC,CAAC,CAAA;YAEF,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Ae,GAAG,IAAI,iCAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACzD,CAAC;IAmDD;;;;OAIG;IAEH,KAAK,CAAC,eAAe,CAAC,EAAE,EAAE,EAAkB;QAC1C,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;IAC9E,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,EAAE,MAAM,KAA0B,EAAE;QAC1D,OAAO,IAAI,CAAC,iBAAiB,CAC3B,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC,CACpD,CAAA;IACH,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,KAAqC;QAC7D,OAAO,IAAI,CAAC,iBAAiB,CAC3B,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC;YACxC,8BAA8B,EAAE,KAAK;SACtC,CAAC,CACH,CAAA;IACH,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,KAAuB;QAC9C,OAAO,IAAI,CAAC,iBAAiB,CAC3B,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC;YACtC,gBAAgB,EAAE,KAAK;SACxB,CAAC,CACH,CAAA;IACH,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAwB;QACrD,OAAO,IAAI,CAAC,iBAAiB,CAC3B,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAE,CAAC,CAClD,CAAA;IACH,CAAC;CAGF;AAhHD,0CAgHC"}
@@ -0,0 +1,3 @@
1
+ export { VouchsafeClient, VouchsafeApiError, } from "./VouchsafeClient";
2
+ export * from "./openapi/models";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,iBAAiB,GAClB,MAAM,mBAAmB,CAAA;AAC1B,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.VouchsafeApiError = exports.VouchsafeClient = void 0;
18
+ var VouchsafeClient_1 = require("./VouchsafeClient");
19
+ Object.defineProperty(exports, "VouchsafeClient", { enumerable: true, get: function () { return VouchsafeClient_1.VouchsafeClient; } });
20
+ Object.defineProperty(exports, "VouchsafeApiError", { enumerable: true, get: function () { return VouchsafeClient_1.VouchsafeApiError; } });
21
+ __exportStar(require("./openapi/models"), exports); // let users access types directly
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qDAG0B;AAFxB,kHAAA,eAAe,OAAA;AACf,oHAAA,iBAAiB,OAAA;AAEnB,mDAAgC,CAAC,kCAAkC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Vouchsafe API docs
3
+ * Vouchsafe offers a REST API to conduct operations programmatically. You can request and manage verifications, as well as perform smart lookups. To use the API, you need a client ID and secret from the Vouchsafe dashboard. [Sign up here](https://app.vouchsafe.id/) if you haven\'t already. We also have a [video guide](https://www.youtube.com/playlist?list=PLx6V6SSTMuF_ZNWBPnysvwmdIwboLViE8) showing the basics.
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ * Contact: help@vouchsafe.id
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import * as runtime from '../runtime';
13
+ import type { AuthenticateRequestBody, AuthenticateResponse } from '../models/index';
14
+ export interface AuthenticateRequest {
15
+ authenticateRequestBody: AuthenticateRequestBody;
16
+ }
17
+ /**
18
+ *
19
+ */
20
+ export declare class AuthenticationApi extends runtime.BaseAPI {
21
+ /**
22
+ * Get the access token, needed for all other API requests. You will need your client ID and secret from the **API Integration** tab of the Vouchsafe dashboard. Each access token is valid for 24 hours, after which you will need to re-authenticate. Once you have an access token, pass it in future requests as a [Bearer token](https://workos.com/blog/understanding-bearer-tokens) in an `Authorization` header. > This endpoint supports sandbox mode. [See how sandbox mode works](https://help.vouchsafe.id/en/articles/11979598-how-does-sandbox-mode-work).
23
+ */
24
+ authenticateRaw(requestParameters: AuthenticateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthenticateResponse>>;
25
+ /**
26
+ * Get the access token, needed for all other API requests. You will need your client ID and secret from the **API Integration** tab of the Vouchsafe dashboard. Each access token is valid for 24 hours, after which you will need to re-authenticate. Once you have an access token, pass it in future requests as a [Bearer token](https://workos.com/blog/understanding-bearer-tokens) in an `Authorization` header. > This endpoint supports sandbox mode. [See how sandbox mode works](https://help.vouchsafe.id/en/articles/11979598-how-does-sandbox-mode-work).
27
+ */
28
+ authenticate(requestParameters: AuthenticateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthenticateResponse>;
29
+ }
30
+ //# sourceMappingURL=AuthenticationApi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthenticationApi.d.ts","sourceRoot":"","sources":["../../../../src/openapi/apis/AuthenticationApi.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAEV,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAUzB,MAAM,WAAW,mBAAmB;IAChC,uBAAuB,EAAE,uBAAuB,CAAC;CACpD;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,OAAO,CAAC,OAAO;IAElD;;OAEG;IACG,eAAe,CAAC,iBAAiB,EAAE,mBAAmB,EAAE,aAAa,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC;IA4B7K;;OAEG;IACG,YAAY,CAAC,iBAAiB,EAAE,mBAAmB,EAAE,aAAa,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAKxJ"}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * Vouchsafe API docs
6
+ * Vouchsafe offers a REST API to conduct operations programmatically. You can request and manage verifications, as well as perform smart lookups. To use the API, you need a client ID and secret from the Vouchsafe dashboard. [Sign up here](https://app.vouchsafe.id/) if you haven\'t already. We also have a [video guide](https://www.youtube.com/playlist?list=PLx6V6SSTMuF_ZNWBPnysvwmdIwboLViE8) showing the basics.
7
+ *
8
+ * The version of the OpenAPI document: 0.1.0
9
+ * Contact: help@vouchsafe.id
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = { enumerable: true, get: function() { return m[k]; } };
20
+ }
21
+ Object.defineProperty(o, k2, desc);
22
+ }) : (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ o[k2] = m[k];
25
+ }));
26
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
27
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
28
+ }) : function(o, v) {
29
+ o["default"] = v;
30
+ });
31
+ var __importStar = (this && this.__importStar) || (function () {
32
+ var ownKeys = function(o) {
33
+ ownKeys = Object.getOwnPropertyNames || function (o) {
34
+ var ar = [];
35
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
36
+ return ar;
37
+ };
38
+ return ownKeys(o);
39
+ };
40
+ return function (mod) {
41
+ if (mod && mod.__esModule) return mod;
42
+ var result = {};
43
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
44
+ __setModuleDefault(result, mod);
45
+ return result;
46
+ };
47
+ })();
48
+ Object.defineProperty(exports, "__esModule", { value: true });
49
+ exports.AuthenticationApi = void 0;
50
+ const runtime = __importStar(require("../runtime"));
51
+ const index_1 = require("../models/index");
52
+ /**
53
+ *
54
+ */
55
+ class AuthenticationApi extends runtime.BaseAPI {
56
+ /**
57
+ * Get the access token, needed for all other API requests. You will need your client ID and secret from the **API Integration** tab of the Vouchsafe dashboard. Each access token is valid for 24 hours, after which you will need to re-authenticate. Once you have an access token, pass it in future requests as a [Bearer token](https://workos.com/blog/understanding-bearer-tokens) in an `Authorization` header. > This endpoint supports sandbox mode. [See how sandbox mode works](https://help.vouchsafe.id/en/articles/11979598-how-does-sandbox-mode-work).
58
+ */
59
+ async authenticateRaw(requestParameters, initOverrides) {
60
+ if (requestParameters['authenticateRequestBody'] == null) {
61
+ throw new runtime.RequiredError('authenticateRequestBody', 'Required parameter "authenticateRequestBody" was null or undefined when calling authenticate().');
62
+ }
63
+ const queryParameters = {};
64
+ const headerParameters = {};
65
+ headerParameters['Content-Type'] = 'application/json';
66
+ let urlPath = `/authenticate`;
67
+ const response = await this.request({
68
+ path: urlPath,
69
+ method: 'POST',
70
+ headers: headerParameters,
71
+ query: queryParameters,
72
+ body: (0, index_1.AuthenticateRequestBodyToJSON)(requestParameters['authenticateRequestBody']),
73
+ }, initOverrides);
74
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.AuthenticateResponseFromJSON)(jsonValue));
75
+ }
76
+ /**
77
+ * Get the access token, needed for all other API requests. You will need your client ID and secret from the **API Integration** tab of the Vouchsafe dashboard. Each access token is valid for 24 hours, after which you will need to re-authenticate. Once you have an access token, pass it in future requests as a [Bearer token](https://workos.com/blog/understanding-bearer-tokens) in an `Authorization` header. > This endpoint supports sandbox mode. [See how sandbox mode works](https://help.vouchsafe.id/en/articles/11979598-how-does-sandbox-mode-work).
78
+ */
79
+ async authenticate(requestParameters, initOverrides) {
80
+ const response = await this.authenticateRaw(requestParameters, initOverrides);
81
+ return await response.value();
82
+ }
83
+ }
84
+ exports.AuthenticationApi = AuthenticationApi;
85
+ //# sourceMappingURL=AuthenticationApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthenticationApi.js","sourceRoot":"","sources":["../../../../src/openapi/apis/AuthenticationApi.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,oDAAsC;AAMtC,2CAOyB;AAMzB;;GAEG;AACH,MAAa,iBAAkB,SAAQ,OAAO,CAAC,OAAO;IAElD;;OAEG;IACH,KAAK,CAAC,eAAe,CAAC,iBAAsC,EAAE,aAA0D;QACpH,IAAI,iBAAiB,CAAC,yBAAyB,CAAC,IAAI,IAAI,EAAE,CAAC;YACvD,MAAM,IAAI,OAAO,CAAC,aAAa,CAC3B,yBAAyB,EACzB,iGAAiG,CACpG,CAAC;QACN,CAAC;QAED,MAAM,eAAe,GAAQ,EAAE,CAAC;QAEhC,MAAM,gBAAgB,GAAwB,EAAE,CAAC;QAEjD,gBAAgB,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC;QAGtD,IAAI,OAAO,GAAG,eAAe,CAAC;QAE9B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAChC,IAAI,EAAE,OAAO;YACb,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,gBAAgB;YACzB,KAAK,EAAE,eAAe;YACtB,IAAI,EAAE,IAAA,qCAA6B,EAAC,iBAAiB,CAAC,yBAAyB,CAAC,CAAC;SACpF,EAAE,aAAa,CAAC,CAAC;QAElB,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,IAAA,oCAA4B,EAAC,SAAS,CAAC,CAAC,CAAC;IACzG,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,iBAAsC,EAAE,aAA0D;QACjH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC;QAC9E,OAAO,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC;IAClC,CAAC;CAEJ;AAzCD,8CAyCC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Vouchsafe API docs
3
+ * Vouchsafe offers a REST API to conduct operations programmatically. You can request and manage verifications, as well as perform smart lookups. To use the API, you need a client ID and secret from the Vouchsafe dashboard. [Sign up here](https://app.vouchsafe.id/) if you haven\'t already. We also have a [video guide](https://www.youtube.com/playlist?list=PLx6V6SSTMuF_ZNWBPnysvwmdIwboLViE8) showing the basics.
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ * Contact: help@vouchsafe.id
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import * as runtime from '../runtime';
13
+ import type { GetSmartLookupResponse, PostcodeResponse, SmartLookupInput } from '../models/index';
14
+ export interface PerformSmartLookupRequest {
15
+ smartLookupInput: SmartLookupInput;
16
+ }
17
+ export interface SearchPostcodeRequest {
18
+ postcode: string;
19
+ }
20
+ /**
21
+ *
22
+ */
23
+ export declare class SmartLookupsApi extends runtime.BaseAPI {
24
+ /**
25
+ * > This feature is currently experimental, so the only supported check is `Address` via the electoral roll. Other checks coming soon. Run quick [background checks](https://help.vouchsafe.id/en/articles/11075009-how-background-checks-work) on a user\'s details. Provide the user\'s details and the check or checks to run and receive the report. First line of address should be taken from the results returned by the [`GET /postcode` endpoint](https://localhost:3000/docs/operations/SearchPostcode).
26
+ */
27
+ performSmartLookupRaw(requestParameters: PerformSmartLookupRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetSmartLookupResponse>>;
28
+ /**
29
+ * > This feature is currently experimental, so the only supported check is `Address` via the electoral roll. Other checks coming soon. Run quick [background checks](https://help.vouchsafe.id/en/articles/11075009-how-background-checks-work) on a user\'s details. Provide the user\'s details and the check or checks to run and receive the report. First line of address should be taken from the results returned by the [`GET /postcode` endpoint](https://localhost:3000/docs/operations/SearchPostcode).
30
+ */
31
+ performSmartLookup(requestParameters: PerformSmartLookupRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetSmartLookupResponse>;
32
+ /**
33
+ * Look up all addresses for a given UK postcode in the Post Office Address File. Useful for guaranteeing that a user\'s address is recognised before onboarding.
34
+ */
35
+ searchPostcodeRaw(requestParameters: SearchPostcodeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PostcodeResponse>>;
36
+ /**
37
+ * Look up all addresses for a given UK postcode in the Post Office Address File. Useful for guaranteeing that a user\'s address is recognised before onboarding.
38
+ */
39
+ searchPostcode(requestParameters: SearchPostcodeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PostcodeResponse>;
40
+ }
41
+ //# sourceMappingURL=SmartLookupsApi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SmartLookupsApi.d.ts","sourceRoot":"","sources":["../../../../src/openapi/apis/SmartLookupsApi.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAEV,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,iBAAiB,CAAC;AAYzB,MAAM,WAAW,yBAAyB;IACtC,gBAAgB,EAAE,gBAAgB,CAAC;CACtC;AAED,MAAM,WAAW,qBAAqB;IAClC,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,OAAO,CAAC,OAAO;IAEhD;;OAEG;IACG,qBAAqB,CAAC,iBAAiB,EAAE,yBAAyB,EAAE,aAAa,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;IAoC3L;;OAEG;IACG,kBAAkB,CAAC,iBAAiB,EAAE,yBAAyB,EAAE,aAAa,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAKnK;;OAEG;IACG,iBAAiB,CAAC,iBAAiB,EAAE,qBAAqB,EAAE,aAAa,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAqC7K;;OAEG;IACG,cAAc,CAAC,iBAAiB,EAAE,qBAAqB,EAAE,aAAa,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAKxJ"}
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * Vouchsafe API docs
6
+ * Vouchsafe offers a REST API to conduct operations programmatically. You can request and manage verifications, as well as perform smart lookups. To use the API, you need a client ID and secret from the Vouchsafe dashboard. [Sign up here](https://app.vouchsafe.id/) if you haven\'t already. We also have a [video guide](https://www.youtube.com/playlist?list=PLx6V6SSTMuF_ZNWBPnysvwmdIwboLViE8) showing the basics.
7
+ *
8
+ * The version of the OpenAPI document: 0.1.0
9
+ * Contact: help@vouchsafe.id
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = { enumerable: true, get: function() { return m[k]; } };
20
+ }
21
+ Object.defineProperty(o, k2, desc);
22
+ }) : (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ o[k2] = m[k];
25
+ }));
26
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
27
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
28
+ }) : function(o, v) {
29
+ o["default"] = v;
30
+ });
31
+ var __importStar = (this && this.__importStar) || (function () {
32
+ var ownKeys = function(o) {
33
+ ownKeys = Object.getOwnPropertyNames || function (o) {
34
+ var ar = [];
35
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
36
+ return ar;
37
+ };
38
+ return ownKeys(o);
39
+ };
40
+ return function (mod) {
41
+ if (mod && mod.__esModule) return mod;
42
+ var result = {};
43
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
44
+ __setModuleDefault(result, mod);
45
+ return result;
46
+ };
47
+ })();
48
+ Object.defineProperty(exports, "__esModule", { value: true });
49
+ exports.SmartLookupsApi = void 0;
50
+ const runtime = __importStar(require("../runtime"));
51
+ const index_1 = require("../models/index");
52
+ /**
53
+ *
54
+ */
55
+ class SmartLookupsApi extends runtime.BaseAPI {
56
+ /**
57
+ * > This feature is currently experimental, so the only supported check is `Address` via the electoral roll. Other checks coming soon. Run quick [background checks](https://help.vouchsafe.id/en/articles/11075009-how-background-checks-work) on a user\'s details. Provide the user\'s details and the check or checks to run and receive the report. First line of address should be taken from the results returned by the [`GET /postcode` endpoint](https://localhost:3000/docs/operations/SearchPostcode).
58
+ */
59
+ async performSmartLookupRaw(requestParameters, initOverrides) {
60
+ if (requestParameters['smartLookupInput'] == null) {
61
+ throw new runtime.RequiredError('smartLookupInput', 'Required parameter "smartLookupInput" was null or undefined when calling performSmartLookup().');
62
+ }
63
+ const queryParameters = {};
64
+ const headerParameters = {};
65
+ headerParameters['Content-Type'] = 'application/json';
66
+ if (this.configuration && this.configuration.accessToken) {
67
+ const token = this.configuration.accessToken;
68
+ const tokenString = await token("bearerAuth", []);
69
+ if (tokenString) {
70
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
71
+ }
72
+ }
73
+ let urlPath = `/smart-lookups`;
74
+ const response = await this.request({
75
+ path: urlPath,
76
+ method: 'POST',
77
+ headers: headerParameters,
78
+ query: queryParameters,
79
+ body: (0, index_1.SmartLookupInputToJSON)(requestParameters['smartLookupInput']),
80
+ }, initOverrides);
81
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.GetSmartLookupResponseFromJSON)(jsonValue));
82
+ }
83
+ /**
84
+ * > This feature is currently experimental, so the only supported check is `Address` via the electoral roll. Other checks coming soon. Run quick [background checks](https://help.vouchsafe.id/en/articles/11075009-how-background-checks-work) on a user\'s details. Provide the user\'s details and the check or checks to run and receive the report. First line of address should be taken from the results returned by the [`GET /postcode` endpoint](https://localhost:3000/docs/operations/SearchPostcode).
85
+ */
86
+ async performSmartLookup(requestParameters, initOverrides) {
87
+ const response = await this.performSmartLookupRaw(requestParameters, initOverrides);
88
+ return await response.value();
89
+ }
90
+ /**
91
+ * Look up all addresses for a given UK postcode in the Post Office Address File. Useful for guaranteeing that a user\'s address is recognised before onboarding.
92
+ */
93
+ async searchPostcodeRaw(requestParameters, initOverrides) {
94
+ if (requestParameters['postcode'] == null) {
95
+ throw new runtime.RequiredError('postcode', 'Required parameter "postcode" was null or undefined when calling searchPostcode().');
96
+ }
97
+ const queryParameters = {};
98
+ if (requestParameters['postcode'] != null) {
99
+ queryParameters['postcode'] = requestParameters['postcode'];
100
+ }
101
+ const headerParameters = {};
102
+ if (this.configuration && this.configuration.accessToken) {
103
+ const token = this.configuration.accessToken;
104
+ const tokenString = await token("bearerAuth", []);
105
+ if (tokenString) {
106
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
107
+ }
108
+ }
109
+ let urlPath = `/smart-lookups/postcode`;
110
+ const response = await this.request({
111
+ path: urlPath,
112
+ method: 'GET',
113
+ headers: headerParameters,
114
+ query: queryParameters,
115
+ }, initOverrides);
116
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.PostcodeResponseFromJSON)(jsonValue));
117
+ }
118
+ /**
119
+ * Look up all addresses for a given UK postcode in the Post Office Address File. Useful for guaranteeing that a user\'s address is recognised before onboarding.
120
+ */
121
+ async searchPostcode(requestParameters, initOverrides) {
122
+ const response = await this.searchPostcodeRaw(requestParameters, initOverrides);
123
+ return await response.value();
124
+ }
125
+ }
126
+ exports.SmartLookupsApi = SmartLookupsApi;
127
+ //# sourceMappingURL=SmartLookupsApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SmartLookupsApi.js","sourceRoot":"","sources":["../../../../src/openapi/apis/SmartLookupsApi.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,oDAAsC;AAOtC,2CASy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