@sinch/verification 1.2.1 → 1.4.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 (87) hide show
  1. package/dist/models/v1/enums.d.ts +11 -2
  2. package/dist/models/v1/flashcall-verification-report-response/flashcall-verification-report-response.d.ts +3 -3
  3. package/dist/models/v1/helper.d.ts +33 -4
  4. package/dist/models/v1/helper.js +77 -12
  5. package/dist/models/v1/helper.js.map +1 -1
  6. package/dist/models/v1/index.d.ts +3 -0
  7. package/dist/models/v1/index.js +4 -0
  8. package/dist/models/v1/index.js.map +1 -1
  9. package/dist/models/v1/mod-callbacks/flashcall-request-event-response/flashcall-request-event-response.d.ts +6 -3
  10. package/dist/models/v1/mod-callbacks/index.d.ts +2 -1
  11. package/dist/models/v1/mod-callbacks/index.js +3 -1
  12. package/dist/models/v1/mod-callbacks/index.js.map +1 -1
  13. package/dist/models/v1/mod-callbacks/phonecall-request-event-response/phonecall-request-event-response.d.ts +2 -1
  14. package/dist/models/v1/mod-callbacks/sms-request-event-response/sms-request-event-response.d.ts +8 -3
  15. package/dist/models/v1/mod-callbacks/verification-callback-event.d.ts +2 -1
  16. package/dist/models/v1/mod-callbacks/verification-request-event/index.d.ts +1 -1
  17. package/dist/models/v1/mod-callbacks/verification-request-event/verification-request-event.d.ts +3 -1
  18. package/dist/models/v1/mod-callbacks/verification-request-event-response/verification-request-event-response.d.ts +3 -2
  19. package/dist/models/v1/mod-callbacks/verification-result-event/index.d.ts +1 -1
  20. package/dist/models/v1/mod-callbacks/verification-result-event/verification-result-event.d.ts +2 -2
  21. package/dist/models/v1/mod-callbacks/verification-sms-delivered-event/index.d.ts +1 -0
  22. package/dist/models/v1/mod-callbacks/verification-sms-delivered-event/index.js.map +1 -0
  23. package/dist/models/v1/mod-callbacks/verification-sms-delivered-event/verification-sms-delivered-event.d.ts +17 -0
  24. package/dist/models/v1/mod-callbacks/{verification-result-event-response/verification-result-event-response.js → verification-sms-delivered-event/verification-sms-delivered-event.js} +1 -1
  25. package/dist/models/v1/mod-callbacks/verification-sms-delivered-event/verification-sms-delivered-event.js.map +1 -0
  26. package/dist/models/v1/mod-callbacks/whatsapp-request-event-response/index.d.ts +1 -0
  27. package/dist/models/v1/mod-callbacks/whatsapp-request-event-response/index.js +3 -0
  28. package/dist/models/v1/mod-callbacks/whatsapp-request-event-response/index.js.map +1 -0
  29. package/dist/models/v1/mod-callbacks/whatsapp-request-event-response/whatsapp-request-event-response.d.ts +14 -0
  30. package/dist/models/v1/mod-callbacks/whatsapp-request-event-response/whatsapp-request-event-response.js +3 -0
  31. package/dist/models/v1/mod-callbacks/whatsapp-request-event-response/whatsapp-request-event-response.js.map +1 -0
  32. package/dist/models/v1/phonecall-verification-report-response/phonecall-verification-report-response.d.ts +3 -3
  33. package/dist/models/v1/requests/verification-status/verification-status-request-data.d.ts +1 -1
  34. package/dist/models/v1/requests/verifications/verifications-request-data.d.ts +14 -2
  35. package/dist/models/v1/sms-verification-report-response/sms-verification-report-response.d.ts +3 -3
  36. package/dist/models/v1/start-flashcall-verification-response/start-flashcall-verification-response.d.ts +5 -4
  37. package/dist/models/v1/start-sms-verification-response/start-sms-verification-response.d.ts +5 -1
  38. package/dist/models/v1/start-verification-request/index.d.ts +1 -1
  39. package/dist/models/v1/start-verification-request/start-verification-request.d.ts +20 -8
  40. package/dist/models/v1/start-whatsapp-verification-response/index.d.ts +1 -0
  41. package/dist/models/v1/start-whatsapp-verification-response/index.js +3 -0
  42. package/dist/models/v1/start-whatsapp-verification-response/index.js.map +1 -0
  43. package/dist/models/v1/start-whatsapp-verification-response/start-whatsapp-verification-response.d.ts +18 -0
  44. package/dist/models/v1/start-whatsapp-verification-response/start-whatsapp-verification-response.js +3 -0
  45. package/dist/models/v1/start-whatsapp-verification-response/start-whatsapp-verification-response.js.map +1 -0
  46. package/dist/models/v1/verification-report-request/index.d.ts +1 -1
  47. package/dist/models/v1/verification-report-request/verification-report-request.d.ts +10 -2
  48. package/dist/models/v1/verification-status-response/verification-status-response.d.ts +2 -1
  49. package/dist/models/v1/whatsapp-verification-report-response/index.d.ts +1 -0
  50. package/dist/models/v1/whatsapp-verification-report-response/index.js +3 -0
  51. package/dist/models/v1/whatsapp-verification-report-response/index.js.map +1 -0
  52. package/dist/models/v1/whatsapp-verification-report-response/whatsapp-verification-report-response.d.ts +11 -0
  53. package/dist/models/v1/whatsapp-verification-report-response/whatsapp-verification-report-response.js +3 -0
  54. package/dist/models/v1/whatsapp-verification-report-response/whatsapp-verification-report-response.js.map +1 -0
  55. package/dist/models/v1/whatsapp-verification-status-response/index.d.ts +1 -0
  56. package/dist/models/v1/whatsapp-verification-status-response/index.js +3 -0
  57. package/dist/models/v1/whatsapp-verification-status-response/index.js.map +1 -0
  58. package/dist/models/v1/whatsapp-verification-status-response/whatsapp-verification-status-response.d.ts +25 -0
  59. package/dist/models/v1/whatsapp-verification-status-response/whatsapp-verification-status-response.js +3 -0
  60. package/dist/models/v1/whatsapp-verification-status-response/whatsapp-verification-status-response.js.map +1 -0
  61. package/dist/rest/v1/callbacks/callbacks-webhook.d.ts +8 -1
  62. package/dist/rest/v1/callbacks/callbacks-webhook.js +15 -0
  63. package/dist/rest/v1/callbacks/callbacks-webhook.js.map +1 -1
  64. package/dist/rest/v1/index.d.ts +1 -0
  65. package/dist/rest/v1/index.js +1 -0
  66. package/dist/rest/v1/index.js.map +1 -1
  67. package/dist/rest/v1/verification-domain-api.d.ts +14 -11
  68. package/dist/rest/v1/verification-domain-api.js +25 -32
  69. package/dist/rest/v1/verification-domain-api.js.map +1 -1
  70. package/dist/rest/v1/verification-service.d.ts +11 -1
  71. package/dist/rest/v1/verification-service.js +44 -5
  72. package/dist/rest/v1/verification-service.js.map +1 -1
  73. package/dist/rest/v1/verification-status/verification-status-api.d.ts +2 -7
  74. package/dist/rest/v1/verification-status/verification-status-api.js +2 -10
  75. package/dist/rest/v1/verification-status/verification-status-api.js.map +1 -1
  76. package/dist/rest/v1/verifications/verifications-api.d.ts +21 -8
  77. package/dist/rest/v1/verifications/verifications-api.jest.fixture.d.ts +19 -1
  78. package/dist/rest/v1/verifications/verifications-api.jest.fixture.js +12 -0
  79. package/dist/rest/v1/verifications/verifications-api.jest.fixture.js.map +1 -1
  80. package/dist/rest/v1/verifications/verifications-api.js +80 -21
  81. package/dist/rest/v1/verifications/verifications-api.js.map +1 -1
  82. package/package.json +2 -2
  83. package/dist/models/v1/mod-callbacks/verification-result-event-response/index.d.ts +0 -1
  84. package/dist/models/v1/mod-callbacks/verification-result-event-response/index.js.map +0 -1
  85. package/dist/models/v1/mod-callbacks/verification-result-event-response/verification-result-event-response.d.ts +0 -4
  86. package/dist/models/v1/mod-callbacks/verification-result-event-response/verification-result-event-response.js.map +0 -1
  87. /package/dist/models/v1/mod-callbacks/{verification-result-event-response → verification-sms-delivered-event}/index.js +0 -0
@@ -9,11 +9,11 @@ export interface SmsVerificationReportResponse {
9
9
  status?: VerificationStatusEnum;
10
10
  /** Displays the reason why a verification has `FAILED`, was `DENIED`, or was `ABORTED`. */
11
11
  reason?: ReasonEnum;
12
- /** The reference ID that was optionally passed together with the verification request. */
12
+ /** @deprecated The reference ID that was optionally passed together with the verification request. */
13
13
  reference?: string;
14
- /** Free text that the client is sending, used to show if the call/SMS was intercepted or not. */
14
+ /** @deprecated Free text that the client is sending, used to show if the call/SMS was intercepted or not. */
15
15
  source?: SourceEnum;
16
- /** @see Identity */
16
+ /** @deprecated @see Identity */
17
17
  identity?: Identity;
18
18
  }
19
19
  /** @deprecated Use SmsVerificationReportResponse instead */
@@ -1,4 +1,5 @@
1
1
  import { LinksObject } from '../links-object';
2
+ import { WithAdditionalProperties } from '@sinch/sdk-client';
2
3
  export interface StartFlashCallVerificationResponse {
3
4
  /** Verification identifier used to query for status. */
4
5
  id?: string;
@@ -9,14 +10,14 @@ export interface StartFlashCallVerificationResponse {
9
10
  /** @see LinksObject */
10
11
  _links?: LinksObject[];
11
12
  }
12
- interface FlashCallContent {
13
- /** Filter that should be applied for incoming calls to intercept the Flashcall. */
13
+ interface FlashCallContent extends WithAdditionalProperties {
14
+ /** Filter that should be applied for incoming calls to intercept the flash call. */
14
15
  cliFilter: string;
15
- /** Amount of seconds client should wait for the Flashcall. */
16
+ /** Amount of seconds client should wait for the flash call. */
16
17
  interceptionTimeout: number;
17
18
  /** The time in seconds allowed for reporting the code after which the verification will expire. */
18
19
  reportTimeout?: number;
19
- /** Used by the SDKs, this setting makes the handset deny the flashcall after the set time in seconds. */
20
+ /** Used by the mobile SDKs, this setting makes the handset deny the flash call after the set time in seconds. */
20
21
  denyCallAfter?: number;
21
22
  }
22
23
  export {};
@@ -1,4 +1,6 @@
1
1
  import { LinksObject } from '../links-object';
2
+ import { WithAdditionalProperties } from '@sinch/sdk-client';
3
+ import { CodeType } from '../enums';
2
4
  export interface StartSmsVerificationResponse {
3
5
  /** Verification identifier used to query for status. */
4
6
  id?: string;
@@ -9,10 +11,12 @@ export interface StartSmsVerificationResponse {
9
11
  /** @see LinksObject */
10
12
  _links?: LinksObject[];
11
13
  }
12
- interface SmsContent {
14
+ interface SmsContent extends WithAdditionalProperties {
13
15
  /** The expected template for the SMS response. */
14
16
  template?: string;
15
17
  /** The amount of time in seconds that the client should wait for the SMS. */
16
18
  interceptionTimeout?: number;
19
+ /** Accepted values for the type of code to be generated are `Numeric`, `Alpha`, and `Alphanumeric`. Default is `Numeric`. */
20
+ codeType?: CodeType;
17
21
  }
18
22
  export {};
@@ -1 +1 @@
1
- export type { StartVerificationBase, StartVerificationWithSms, StartVerificationWithFlashCall, StartVerificationWithPhoneCall, StartVerificationWithPhoneCallServerModel, StartVerificationWithCallout, StartDataVerification, StartSeamlessVerification, SmsOptions, CodeType, PhoneCallOptions, CalloutOptions, PhoneCallOptionsSpeech, CalloutOptionsSpeech, FlashCallOptions, } from './start-verification-request';
1
+ export type { StartVerificationBase, StartVerificationWithSms, StartVerificationWithFlashCall, StartVerificationWithPhoneCall, StartVerificationWithPhoneCallServerModel, StartVerificationWithCallout, StartDataVerification, StartSeamlessVerification, StartVerificationWithWhatsApp, SmsOptions, PhoneCallOptions, CalloutOptions, PhoneCallOptionsSpeech, CalloutOptionsSpeech, FlashCallOptions, WhatsAppOptions, } from './start-verification-request';
@@ -1,4 +1,6 @@
1
1
  import { Identity } from '../identity';
2
+ import { WithAdditionalProperties } from '@sinch/sdk-client';
3
+ import { CodeType, WhatsAppCodeType } from '../enums';
2
4
  export interface StartVerificationWithSms extends StartVerificationBase {
3
5
  /** @see SmsOptions */
4
6
  smsOptions?: SmsOptions;
@@ -24,6 +26,10 @@ export interface StartDataVerification extends StartVerificationBase {
24
26
  }
25
27
  /** @deprecated Use StartDataVerification instead */
26
28
  export type StartSeamlessVerification = StartDataVerification;
29
+ export interface StartVerificationWithWhatsApp extends StartVerificationBase {
30
+ /** @see WhatsAppOptions */
31
+ whatsappOptions?: WhatsAppOptions;
32
+ }
27
33
  export interface StartVerificationBase {
28
34
  /** @see Identity */
29
35
  identity: Identity;
@@ -35,30 +41,29 @@ export interface StartVerificationBase {
35
41
  /**
36
42
  * An optional object for SMS Verification, with default values assumed for all contained values if not provided.
37
43
  */
38
- export interface SmsOptions {
44
+ export interface SmsOptions extends WithAdditionalProperties {
39
45
  /** The expiration time for a verification process is represented in the format `HH:MM:SS`. */
40
46
  expiry?: Date | string;
41
47
  /** Accepted values for the type of code to be generated are `Numeric`, `Alpha`, and `Alphanumeric`. Default is `Numeric`. */
42
48
  codeType?: CodeType;
43
- /** The SMS template must include a placeholder `{{CODE}}` where the verification code will be inserted, and it can otherwise be customized as desired. */
44
- template?: string;
45
49
  /** A `language-region` identifier according to [IANA](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry). Only a subset of those identifiers is accepted. */
46
50
  locale?: string;
47
51
  }
48
- export type CodeType = 'Numeric' | 'Alpha' | 'Alphanumeric';
49
52
  /**
50
- * An optional object for flashCall verifications. It allows you to specify dial time out parameter for flashCall. FlashCallOptions object can be specified optionally, and only if the verification request was triggered from your backend (no SDK client) through an [Application signed request](/docs/voice/api-reference/authentication/signed-request).
53
+ * An optional configuration for Flash Call Verification, should be used only when the verification request originates from your backend (not an end user device) and request is signed via an [Application signed request](https://developers.sinch.com/docs/voice/api-reference/authentication/signed-request).
51
54
  */
52
- export interface FlashCallOptions {
53
- /** The dial timeout in seconds. */
55
+ export interface FlashCallOptions extends WithAdditionalProperties {
56
+ /** The amount of time that a phone will ring. */
54
57
  dialTimeout?: number;
58
+ /** The maximum time that a phone call verification will be active and can be completed. If the phone number hasn't been verified successfully during this time, then the verification request will fail. By default, the Sinch dashboard will automatically optimize dial time out during a phone call. */
59
+ interceptionTimeout?: number;
55
60
  }
56
61
  /** @deprecated Use PhoneCallOptions instead */
57
62
  export type CalloutOptions = PhoneCallOptions;
58
63
  /**
59
64
  * An optional object for Phone Call Verification, with default values assumed for all contained values if not provided.
60
65
  */
61
- export interface PhoneCallOptions {
66
+ export interface PhoneCallOptions extends WithAdditionalProperties {
62
67
  /** @see PhoneCallOptionsSpeech */
63
68
  speech?: PhoneCallOptionsSpeech;
64
69
  }
@@ -71,3 +76,10 @@ export interface PhoneCallOptionsSpeech {
71
76
  /** A `language-region` identifier according to [IANA](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry). Only a subset of those identifiers is accepted. */
72
77
  locale?: string;
73
78
  }
79
+ /**
80
+ * An optional configuration for WhatsApp Verification, should be used only when the verification request originates from your backend (not an end user device) and request is signed via an [Application signed request](https://developers.sinch.com/docs/voice/api-reference/authentication/signed-request).
81
+ */
82
+ export interface WhatsAppOptions extends WithAdditionalProperties {
83
+ /** Selects type of code which will be sent to customer */
84
+ codeType?: WhatsAppCodeType;
85
+ }
@@ -0,0 +1 @@
1
+ export type { StartWhatsAppVerificationResponse } from './start-whatsapp-verification-response';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v1/start-whatsapp-verification-response/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import { LinksObject } from '../links-object';
2
+ import { WithAdditionalProperties } from '@sinch/sdk-client';
3
+ import { WhatsAppCodeType } from '../enums';
4
+ export interface StartWhatsAppVerificationResponse {
5
+ /** Verification identifier used to query for status. */
6
+ id?: string;
7
+ /** The value of the method used for the Verification. For WhatsApp Verifications, this will always be `whatsapp`. */
8
+ method?: 'whatsapp';
9
+ /** The response contains the `codeType` property. */
10
+ whatsapp?: WhatsAppContent;
11
+ /** @see LinksObject */
12
+ _links?: LinksObject[];
13
+ }
14
+ interface WhatsAppContent extends WithAdditionalProperties {
15
+ /** Accepted values for the type of code to be generated are `Numeric`, `Alpha`, and `Alphanumeric`. Default is `Numeric`. */
16
+ codeType?: WhatsAppCodeType;
17
+ }
18
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=start-whatsapp-verification-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start-whatsapp-verification-response.js","sourceRoot":"","sources":["../../../../src/models/v1/start-whatsapp-verification-response/start-whatsapp-verification-response.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- export type { SmsVerificationReportRequest, FlashCallVerificationReportRequest, PhoneCallVerificationReportRequest, PhoneCallVerificationReportRequestServerModel, CalloutVerificationReportRequest, } from './verification-report-request';
1
+ export type { SmsVerificationReportRequest, FlashCallVerificationReportRequest, PhoneCallVerificationReportRequest, PhoneCallVerificationReportRequestServerModel, CalloutVerificationReportRequest, WhatsAppVerificationReportRequest, WhatsAppContent, } from './verification-report-request';
@@ -5,7 +5,7 @@ export interface SmsVerificationReportRequest {
5
5
  interface SmsContent {
6
6
  /** The code which was received by the user submitting the SMS verification. */
7
7
  code: string;
8
- /** The sender ID of the SMS. */
8
+ /** @deprecated The sender ID of the SMS. */
9
9
  cli?: string;
10
10
  }
11
11
  export interface FlashCallVerificationReportRequest {
@@ -13,7 +13,7 @@ export interface FlashCallVerificationReportRequest {
13
13
  flashCall: FlashCallContent;
14
14
  }
15
15
  interface FlashCallContent {
16
- /** The caller ID of the FlashCall. */
16
+ /** The caller ID of the flash call. Caller ID in flash call verification refers to the phone number from which the call was made to the user's device. The verification system uses this incoming number as One Time Password (OTP) */
17
17
  cli: string;
18
18
  }
19
19
  export interface PhoneCallVerificationReportRequest {
@@ -35,4 +35,12 @@ interface PhoneCallContent {
35
35
  }
36
36
  /** @deprecated Use PhoneCallContent instead */
37
37
  type CalloutContent = PhoneCallContent;
38
+ export interface WhatsAppVerificationReportRequest {
39
+ /** A configuration object containing settings specific to WhatsApp verifications. */
40
+ whatsapp: WhatsAppContent;
41
+ }
42
+ export interface WhatsAppContent {
43
+ /** The code which was received by the user submitting the WhatsApp verification. */
44
+ code: string;
45
+ }
38
46
  export {};
@@ -1,4 +1,5 @@
1
1
  import { SmsVerificationStatusResponse } from '../sms-verification-status-response';
2
2
  import { FlashCallVerificationStatusResponse } from '../flashcall-verification-status-response';
3
3
  import { CalloutVerificationStatusResponse, PhoneCallVerificationStatusResponse } from '../phonecall-verification-status-response';
4
- export type VerificationStatusResponse = SmsVerificationStatusResponse | FlashCallVerificationStatusResponse | CalloutVerificationStatusResponse | PhoneCallVerificationStatusResponse;
4
+ import { WhatsAppVerificationStatusResponse } from '../whatsapp-verification-status-response';
5
+ export type VerificationStatusResponse = SmsVerificationStatusResponse | FlashCallVerificationStatusResponse | CalloutVerificationStatusResponse | PhoneCallVerificationStatusResponse | WhatsAppVerificationStatusResponse;
@@ -0,0 +1 @@
1
+ export type { WhatsAppVerificationReportResponse } from './whatsapp-verification-report-response';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v1/whatsapp-verification-report-response/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import { ReasonEnum, VerificationStatusEnum } from '../enums';
2
+ export interface WhatsAppVerificationReportResponse {
3
+ /** The unique ID of the verification request. */
4
+ id?: string;
5
+ /** The method of the verification request. This will always be `whatsapp`. */
6
+ method?: 'whatsapp';
7
+ /** The status of the verification request. */
8
+ status?: VerificationStatusEnum;
9
+ /** Displays the reason why a verification has `FAILED`, was `DENIED`, or was `ABORTED`. */
10
+ reason?: ReasonEnum;
11
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=whatsapp-verification-report-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whatsapp-verification-report-response.js","sourceRoot":"","sources":["../../../../src/models/v1/whatsapp-verification-report-response/whatsapp-verification-report-response.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export type { WhatsAppVerificationStatusResponse } from './whatsapp-verification-status-response';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/models/v1/whatsapp-verification-status-response/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ import { ReasonEnum, SourceEnum, VerificationStatusEnum } from '../enums';
2
+ import { Identity } from '../identity';
3
+ import { VerificationPriceSms } from '../verification-price-sms';
4
+ export interface WhatsAppVerificationStatusResponse {
5
+ /** The unique ID of the verification request. */
6
+ id?: string;
7
+ /** The method of the verification request. This will always be `whatsapp`. */
8
+ method?: 'whatsapp';
9
+ /** The status of the verification request. */
10
+ status?: VerificationStatusEnum;
11
+ /** Displays the reason why a verification has `FAILED`, was `DENIED`, or was `ABORTED`. */
12
+ reason?: ReasonEnum;
13
+ /** Used to pass your own reference in the request for tracking purposes. Must be a unique value for each started verification request. The value must be encodable in the URL path segment. This value is passed to all events and returned from the status and report endpoints. The reference can be used to check the [status of verifications](https://developers.sinch.com/docs/verification/api-reference/verification/tag/Verification-status/#tag/Verification-status/operation/VerificationStatusByReference), like with ID or identity. */
14
+ reference?: string;
15
+ /** Prices associated with this verification */
16
+ price?: VerificationPriceSms;
17
+ /** @see Identity */
18
+ identity?: Identity;
19
+ /** The ID of the country to which the verification was sent. */
20
+ countryId?: string;
21
+ /** The timestamp in UTC format. </br> **Note:** The formatting does not respect `ISO-8601` and the returned value has the format `YYYY-MM-DDThh:mm:ss.SSS`. If you need to parse this value into a specific date object in your programming language, please append `Z` (Zulu time = UTC) at the end of the date value to match the `ISO-8601` format: `YYYY-MM-DDThh:mm:ss.SSSZ`. */
22
+ verificationTimestamp?: Date;
23
+ /** @see Source */
24
+ source?: SourceEnum;
25
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=whatsapp-verification-status-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whatsapp-verification-status-response.js","sourceRoot":"","sources":["../../../../src/models/v1/whatsapp-verification-status-response/whatsapp-verification-status-response.ts"],"names":[],"mappings":""}
@@ -1,7 +1,7 @@
1
1
  import { VerificationCallbackEvent, VerificationRequestEvent, VerificationResultEvent } from '../../../models';
2
2
  import { CallbackProcessor, SinchClientParameters } from '@sinch/sdk-client';
3
3
  import { IncomingHttpHeaders } from 'http';
4
- /** @deprecated Use Verification.VerificationCallback instead */
4
+ /** @deprecated Use Verification.VerificationCallbackEvent instead */
5
5
  export type VerificationCallback = VerificationRequestEvent | VerificationResultEvent;
6
6
  export declare class VerificationCallbackWebhooks implements CallbackProcessor<VerificationCallbackEvent> {
7
7
  private readonly sinchClientParameters;
@@ -22,4 +22,11 @@ export declare class VerificationCallbackWebhooks implements CallbackProcessor<V
22
22
  * @return {VerificationCallbackEvent} - The parsed verification event object.
23
23
  */
24
24
  parseEvent(eventBody: any): VerificationCallbackEvent;
25
+ /**
26
+ * Static reviver for a Verification Event.
27
+ * This method ensures the object can be treated as a Verification Event.
28
+ * @param {any} eventBody - The event body containing the Verification event notification.
29
+ * @return {VerificationCallbackEvent} - The parsed Verification event object
30
+ */
31
+ static parseEvent(eventBody: any): VerificationCallbackEvent;
25
32
  }
@@ -27,12 +27,17 @@ class VerificationCallbackWebhooks {
27
27
  * @return {VerificationCallbackEvent} - The parsed verification event object.
28
28
  */
29
29
  parseEvent(eventBody) {
30
+ if (typeof eventBody === 'string') {
31
+ eventBody = JSON.parse(eventBody);
32
+ }
30
33
  if (eventBody.event) {
31
34
  switch (eventBody.event) {
32
35
  case 'VerificationRequestEvent':
33
36
  return eventBody;
34
37
  case 'VerificationResultEvent':
35
38
  return eventBody;
39
+ case 'VerificationSmsDeliveredEvent':
40
+ return eventBody;
36
41
  default:
37
42
  throw new Error(`Unknown Verification event type: ${eventBody.event}`);
38
43
  }
@@ -40,6 +45,16 @@ class VerificationCallbackWebhooks {
40
45
  console.log(`Unknown Verification event structure:\n${JSON.stringify(eventBody)}`);
41
46
  throw new Error('Unknown Verification event');
42
47
  }
48
+ /**
49
+ * Static reviver for a Verification Event.
50
+ * This method ensures the object can be treated as a Verification Event.
51
+ * @param {any} eventBody - The event body containing the Verification event notification.
52
+ * @return {VerificationCallbackEvent} - The parsed Verification event object
53
+ */
54
+ static parseEvent(eventBody) {
55
+ const instance = new VerificationCallbackWebhooks({});
56
+ return instance.parseEvent(eventBody);
57
+ }
43
58
  }
44
59
  exports.VerificationCallbackWebhooks = VerificationCallbackWebhooks;
45
60
  //# sourceMappingURL=callbacks-webhook.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"callbacks-webhook.js","sourceRoot":"","sources":["../../../../src/rest/v1/callbacks/callbacks-webhook.ts"],"names":[],"mappings":";;;AACA,kDAA2G;AAM3G,MAAa,4BAA4B;IAIvC,YAAY,qBAA4C;QACtD,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;IACrD,CAAC;I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'./callbacks';
2
2
  export * from './verification-status';
3
3
  export * from './verifications';
4
4
  export * from './enums';
5
+ export * from './verification-domain-api';
5
6
  export * from './verification-service';
@@ -18,5 +18,6 @@ __exportStar(require("./callbacks"), exports);
18
18
  __exportStar(require("./verification-status"), exports);
19
19
  __exportStar(require("./verifications"), exports);
20
20
  __exportStar(require("./enums"), exports);
21
+ __exportStar(require("./verification-domain-api"), exports);
21
22
  __exportStar(require("./verification-service"), exports);
22
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rest/v1/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,wDAAsC;AACtC,kDAAgC;AAChC,0CAAwB;AACxB,yDAAuC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rest/v1/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,wDAAsC;AACtC,kDAAgC;AAChC,0CAAwB;AACxB,4DAA0C;AAC1C,yDAAuC"}
@@ -1,9 +1,16 @@
1
- import { Api, ApiClient, SinchClientParameters, ApplicationCredentials } from '@sinch/sdk-client';
1
+ import { Api, ApiClient, ApplicationCredentials } from '@sinch/sdk-client';
2
+ import { LazyVerificationApiClient } from './verification-service';
2
3
  export declare class VerificationDomainApi implements Api {
4
+ readonly lazyClient: LazyVerificationApiClient;
3
5
  readonly apiName: string;
4
- client?: ApiClient;
5
- private sinchClientParameters;
6
- constructor(sinchClientParameters: SinchClientParameters, apiName: string);
6
+ constructor(lazyClient: LazyVerificationApiClient, apiName: string);
7
+ get client(): ApiClient;
8
+ /**
9
+ * Kept for backward compatibility - TODO: remove in future major release
10
+ * @return {ApiClient}
11
+ * @deprecated
12
+ */
13
+ getSinchClient(): ApiClient;
7
14
  /**
8
15
  * Update the default hostname for the API
9
16
  * @param {string} hostname - The new hostname to use for the APIs.
@@ -13,13 +20,9 @@ export declare class VerificationDomainApi implements Api {
13
20
  * Updates the application credentials used to authenticate API requests
14
21
  * @param {ApplicationCredentials} credentials
15
22
  */
16
- setApplication(credentials: ApplicationCredentials): void;
17
- private resetApiClient;
23
+ setCredentials(credentials: Partial<ApplicationCredentials>): void;
18
24
  /**
19
- * Checks the configuration parameters are ok and initialize the API client. Once initialized, the same instance will
20
- * be returned for the subsequent API calls (singleton pattern)
21
- * @return {ApiClient} the API Client or throws an error in case the configuration parameters are not ok
22
- * @private
25
+ * @deprecated Use setCredentials instead
23
26
  */
24
- getSinchClient(): ApiClient;
27
+ setApplication(credentials: ApplicationCredentials): void;
25
28
  }
@@ -1,62 +1,55 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VerificationDomainApi = void 0;
4
- const sdk_client_1 = require("@sinch/sdk-client");
5
4
  class VerificationDomainApi {
6
- constructor(sinchClientParameters, apiName) {
7
- this.sinchClientParameters = sinchClientParameters;
5
+ constructor(lazyClient, apiName) {
6
+ this.lazyClient = lazyClient;
8
7
  this.apiName = apiName;
9
8
  }
9
+ get client() {
10
+ return this.lazyClient.getApiClient();
11
+ }
12
+ /**
13
+ * Kept for backward compatibility - TODO: remove in future major release
14
+ * @return {ApiClient}
15
+ * @deprecated
16
+ */
17
+ getSinchClient() {
18
+ return this.lazyClient.getApiClient();
19
+ }
10
20
  /**
11
21
  * Update the default hostname for the API
12
22
  * @param {string} hostname - The new hostname to use for the APIs.
13
23
  */
14
24
  setHostname(hostname) {
15
- try {
16
- this.client = this.getSinchClient();
17
- this.client.apiClientOptions.hostname = hostname;
18
- }
19
- catch (error) {
20
- console.error('Impossible to set a new hostname, the Application credentials need to be provided first.');
21
- throw error;
22
- }
25
+ this.lazyClient.sharedConfig.verificationHostname = hostname;
26
+ this.lazyClient.getApiClient().apiClientOptions.hostname = hostname;
23
27
  }
24
28
  /**
25
29
  * Updates the application credentials used to authenticate API requests
26
30
  * @param {ApplicationCredentials} credentials
27
31
  */
28
- setApplication(credentials) {
29
- const parametersBackup = { ...this.sinchClientParameters };
30
- this.sinchClientParameters = {
32
+ setCredentials(credentials) {
33
+ const parametersBackup = { ...this.lazyClient.sharedConfig };
34
+ this.lazyClient.sharedConfig = {
31
35
  ...parametersBackup,
32
36
  ...credentials,
33
37
  };
34
- this.resetApiClient();
38
+ this.lazyClient.resetApiClient();
35
39
  try {
36
- this.getSinchClient();
40
+ this.lazyClient.getApiClient();
37
41
  }
38
42
  catch (error) {
39
- console.error('Impossible to assign the new application to the Verification API');
40
- this.sinchClientParameters = parametersBackup;
43
+ console.error('Impossible to assign the new credentials to the Verification API');
44
+ this.lazyClient.sharedConfig = parametersBackup;
41
45
  throw error;
42
46
  }
43
47
  }
44
- resetApiClient() {
45
- this.client = undefined;
46
- }
47
48
  /**
48
- * Checks the configuration parameters are ok and initialize the API client. Once initialized, the same instance will
49
- * be returned for the subsequent API calls (singleton pattern)
50
- * @return {ApiClient} the API Client or throws an error in case the configuration parameters are not ok
51
- * @private
49
+ * @deprecated Use setCredentials instead
52
50
  */
53
- getSinchClient() {
54
- if (!this.client) {
55
- const apiClientOptions = (0, sdk_client_1.buildApplicationSignedApiClientOptions)(this.sinchClientParameters, 'Verification');
56
- this.client = new sdk_client_1.ApiFetchClient(apiClientOptions);
57
- this.client.apiClientOptions.hostname = this.sinchClientParameters.verificationHostname ?? sdk_client_1.VERIFICATION_HOSTNAME;
58
- }
59
- return this.client;
51
+ setApplication(credentials) {
52
+ this.setCredentials(credentials);
60
53
  }
61
54
  }
62
55
  exports.VerificationDomainApi = VerificationDomainApi;
@@ -1 +1 @@
1
- {"version":3,"file":"verification-domain-api.js","sourceRoot":"","sources":["../../../src/rest/v1/verification-domain-api.ts"],"names":[],"mappings":";;;AAAA,kDAQ2B;AAE3B,MAAa,qBAAqB;IAKhC,YAAY,qBAA4C,EAAE,OAAe;QACvE,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QACnD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,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AO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AA9DD,sDA8DC"}
1
+ {"version":3,"file":"verification-domain-api.js","sourceRoot":"","sources":["../../../src/rest/v1/verification-domain-api.ts"],"names":[],"mappings":";;;AAOA,MAAa,qBAAqB;IAEhC,YACkB,UAAqC,EACrC,OAAe;QADf,eAAU,GAAV,UAAU,CAA2B;QACrC,YAAO,GAAP,OAAO,CAAQ;IAC9B,CAAC;IAEJ,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACI,cAAc;QACnB,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;IACxC,CAAC;IAED;;;OAGG;IACI,WAAW,CAAC,QAAgB;QACjC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,oBAAoB,GAAG,QAAQ,CAAC;QAC7D,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,gBAAgB,CAAC,QAAQ,GAAG,QAAQ,CAAC;IACtE,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,WAA4C;QAChE,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;QAC7D,IAAI,CAAC,UAAU,CAAC,YAAY,GAAG;YAC7B,GAAG,gBAAgB;YACnB,GAAG,WAAW;SACf,CAAC;QACF,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;QACjC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAC;YAClF,IAAI,CAAC,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC;YAChD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED;;OAEG;IACI,cAAc,CAAC,WAAmC;QACvD,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;CAEF;AAxDD,sDAwDC"}
@@ -1,6 +1,13 @@
1
- import { SinchClientParameters } from '@sinch/sdk-client';
1
+ import { ApiFetchClient, ApplicationCredentials, SinchClientParameters } from '@sinch/sdk-client';
2
2
  import { VerificationStatusApi } from './verification-status';
3
3
  import { VerificationsApi } from './verifications';
4
+ export declare class LazyVerificationApiClient {
5
+ sharedConfig: SinchClientParameters;
6
+ private apiFetchClient?;
7
+ constructor(sharedConfig: SinchClientParameters);
8
+ getApiClient(): ApiFetchClient;
9
+ resetApiClient(): void;
10
+ }
4
11
  /**
5
12
  * The Verification Service exposes the following APIs:
6
13
  * - verifications
@@ -9,6 +16,7 @@ import { VerificationsApi } from './verifications';
9
16
  export declare class VerificationService {
10
17
  readonly verificationStatus: VerificationStatusApi;
11
18
  readonly verifications: VerificationsApi;
19
+ private readonly lazyClient;
12
20
  /**
13
21
  * Create a new VerificationService instance with its configuration. It needs the following parameters for authentication:
14
22
  * - `applicationKey`
@@ -19,9 +27,11 @@ export declare class VerificationService {
19
27
  * @param {SinchClientParameters} params - an Object containing the necessary properties to initialize the service
20
28
  */
21
29
  constructor(params: SinchClientParameters);
30
+ setApiClientConfig(newParams: SinchClientParameters): void;
22
31
  /**
23
32
  * Update the default hostname for each API
24
33
  * @param {string} hostname - The new hostname to use for all the APIs.
25
34
  */
26
35
  setHostname(hostname: string): void;
36
+ setCredentials(credentials: Partial<ApplicationCredentials>): void;
27
37
  }