tnzapi-ts 3.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.
- package/LICENSE +21 -0
- package/README.md +2203 -0
- package/dist/Api/Actions/AbortApi.d.ts +17 -0
- package/dist/Api/Actions/AbortApi.js +78 -0
- package/dist/Api/Actions/PacingApi.d.ts +17 -0
- package/dist/Api/Actions/PacingApi.js +84 -0
- package/dist/Api/Actions/RescheduleApi.d.ts +17 -0
- package/dist/Api/Actions/RescheduleApi.js +84 -0
- package/dist/Api/Actions/ResubmitApi.d.ts +17 -0
- package/dist/Api/Actions/ResubmitApi.js +86 -0
- package/dist/Api/Actions/dtos/AbortApiRequestDTO.d.ts +4 -0
- package/dist/Api/Actions/dtos/AbortApiRequestDTO.js +14 -0
- package/dist/Api/Actions/dtos/ActionApiResponseDTO.d.ts +8 -0
- package/dist/Api/Actions/dtos/ActionApiResponseDTO.js +14 -0
- package/dist/Api/Actions/dtos/ActionBaseRequestDTO.d.ts +5 -0
- package/dist/Api/Actions/dtos/ActionBaseRequestDTO.js +7 -0
- package/dist/Api/Actions/dtos/PacingApiRequestDTO.d.ts +5 -0
- package/dist/Api/Actions/dtos/PacingApiRequestDTO.js +15 -0
- package/dist/Api/Actions/dtos/RescheduleApiRequestDTO.d.ts +5 -0
- package/dist/Api/Actions/dtos/RescheduleApiRequestDTO.js +14 -0
- package/dist/Api/Actions/dtos/ResubmitApiRequestDTO.d.ts +5 -0
- package/dist/Api/Actions/dtos/ResubmitApiRequestDTO.js +14 -0
- package/dist/Api/Actions/dtos/index.d.ts +6 -0
- package/dist/Api/Actions/dtos/index.js +22 -0
- package/dist/Api/Actions/helpers/MapApiResponse.d.ts +3 -0
- package/dist/Api/Actions/helpers/MapApiResponse.js +16 -0
- package/dist/Api/Actions/helpers/index.d.ts +1 -0
- package/dist/Api/Actions/helpers/index.js +17 -0
- package/dist/Api/Actions/index.d.ts +12 -0
- package/dist/Api/Actions/index.js +17 -0
- package/dist/Api/Actions/interfaces/IActionArgs.d.ts +19 -0
- package/dist/Api/Actions/interfaces/IActionArgs.js +2 -0
- package/dist/Api/Actions/interfaces/index.d.ts +1 -0
- package/dist/Api/Actions/interfaces/index.js +17 -0
- package/dist/Api/Addressbook/ContactGroups/ContactGroupCreateApi.d.ts +14 -0
- package/dist/Api/Addressbook/ContactGroups/ContactGroupCreateApi.js +84 -0
- package/dist/Api/Addressbook/ContactGroups/ContactGroupDeleteApi.d.ts +14 -0
- package/dist/Api/Addressbook/ContactGroups/ContactGroupDeleteApi.js +84 -0
- package/dist/Api/Addressbook/ContactGroups/ContactGroupDetailApi.d.ts +14 -0
- package/dist/Api/Addressbook/ContactGroups/ContactGroupDetailApi.js +84 -0
- package/dist/Api/Addressbook/ContactGroups/ContactGroupListApi.d.ts +14 -0
- package/dist/Api/Addressbook/ContactGroups/ContactGroupListApi.js +79 -0
- package/dist/Api/Addressbook/ContactGroups/dtos/BaseListApiRequestDTO.d.ts +4 -0
- package/dist/Api/Addressbook/ContactGroups/dtos/BaseListApiRequestDTO.js +7 -0
- package/dist/Api/Addressbook/ContactGroups/dtos/ContactGroupApiRequestDTO.d.ts +9 -0
- package/dist/Api/Addressbook/ContactGroups/dtos/ContactGroupApiRequestDTO.js +19 -0
- package/dist/Api/Addressbook/ContactGroups/dtos/ContactGroupApiResponseDTO.d.ts +8 -0
- package/dist/Api/Addressbook/ContactGroups/dtos/ContactGroupApiResponseDTO.js +14 -0
- package/dist/Api/Addressbook/ContactGroups/dtos/ContactGroupBaseRequestDTO.d.ts +6 -0
- package/dist/Api/Addressbook/ContactGroups/dtos/ContactGroupBaseRequestDTO.js +7 -0
- package/dist/Api/Addressbook/ContactGroups/dtos/ContactGroupListApiRequestDTO.d.ts +4 -0
- package/dist/Api/Addressbook/ContactGroups/dtos/ContactGroupListApiRequestDTO.js +14 -0
- package/dist/Api/Addressbook/ContactGroups/dtos/ContactGroupListApiResponseDTO.d.ts +12 -0
- package/dist/Api/Addressbook/ContactGroups/dtos/ContactGroupListApiResponseDTO.js +14 -0
- package/dist/Api/Addressbook/ContactGroups/dtos/index.d.ts +6 -0
- package/dist/Api/Addressbook/ContactGroups/dtos/index.js +22 -0
- package/dist/Api/Addressbook/ContactGroups/helpers/MapApiResponse.d.ts +3 -0
- package/dist/Api/Addressbook/ContactGroups/helpers/MapApiResponse.js +24 -0
- package/dist/Api/Addressbook/ContactGroups/helpers/MapListApiResponse.d.ts +3 -0
- package/dist/Api/Addressbook/ContactGroups/helpers/MapListApiResponse.js +28 -0
- package/dist/Api/Addressbook/ContactGroups/helpers/index.d.ts +2 -0
- package/dist/Api/Addressbook/ContactGroups/helpers/index.js +18 -0
- package/dist/Api/Addressbook/ContactGroups/index.d.ts +11 -0
- package/dist/Api/Addressbook/ContactGroups/index.js +21 -0
- package/dist/Api/Addressbook/Contacts/ContactCreateApi.d.ts +17 -0
- package/dist/Api/Addressbook/Contacts/ContactCreateApi.js +76 -0
- package/dist/Api/Addressbook/Contacts/ContactDeleteApi.d.ts +17 -0
- package/dist/Api/Addressbook/Contacts/ContactDeleteApi.js +82 -0
- package/dist/Api/Addressbook/Contacts/ContactDetailApi.d.ts +17 -0
- package/dist/Api/Addressbook/Contacts/ContactDetailApi.js +78 -0
- package/dist/Api/Addressbook/Contacts/ContactListApi.d.ts +17 -0
- package/dist/Api/Addressbook/Contacts/ContactListApi.js +78 -0
- package/dist/Api/Addressbook/Contacts/ContactUpdateApi.d.ts +17 -0
- package/dist/Api/Addressbook/Contacts/ContactUpdateApi.js +81 -0
- package/dist/Api/Addressbook/Contacts/dtos/ContactApiRequestDTO.d.ts +7 -0
- package/dist/Api/Addressbook/Contacts/dtos/ContactApiRequestDTO.js +22 -0
- package/dist/Api/Addressbook/Contacts/dtos/ContactApiResponseDTO.d.ts +6 -0
- package/dist/Api/Addressbook/Contacts/dtos/ContactApiResponseDTO.js +14 -0
- package/dist/Api/Addressbook/Contacts/dtos/ContactListApiRequestDTO.d.ts +4 -0
- package/dist/Api/Addressbook/Contacts/dtos/ContactListApiRequestDTO.js +17 -0
- package/dist/Api/Addressbook/Contacts/dtos/ContactListApiResponseDTO.d.ts +10 -0
- package/dist/Api/Addressbook/Contacts/dtos/ContactListApiResponseDTO.js +19 -0
- package/dist/Api/Addressbook/Contacts/dtos/index.d.ts +4 -0
- package/dist/Api/Addressbook/Contacts/dtos/index.js +20 -0
- package/dist/Api/Addressbook/Contacts/helpers/MapApiResponse.d.ts +3 -0
- package/dist/Api/Addressbook/Contacts/helpers/MapApiResponse.js +20 -0
- package/dist/Api/Addressbook/Contacts/helpers/MapListApiResponse.d.ts +3 -0
- package/dist/Api/Addressbook/Contacts/helpers/MapListApiResponse.js +16 -0
- package/dist/Api/Addressbook/Contacts/helpers/index.d.ts +2 -0
- package/dist/Api/Addressbook/Contacts/helpers/index.js +18 -0
- package/dist/Api/Addressbook/Contacts/index.d.ts +12 -0
- package/dist/Api/Addressbook/Contacts/index.js +24 -0
- package/dist/Api/Addressbook/Contacts/models/ContactModel.d.ts +37 -0
- package/dist/Api/Addressbook/Contacts/models/ContactModel.js +11 -0
- package/dist/Api/Addressbook/Contacts/models/index.d.ts +1 -0
- package/dist/Api/Addressbook/Contacts/models/index.js +17 -0
- package/dist/Api/Addressbook/GroupContacts/GroupContactCreateApi.d.ts +14 -0
- package/dist/Api/Addressbook/GroupContacts/GroupContactCreateApi.js +84 -0
- package/dist/Api/Addressbook/GroupContacts/GroupContactDeleteApi.d.ts +14 -0
- package/dist/Api/Addressbook/GroupContacts/GroupContactDeleteApi.js +84 -0
- package/dist/Api/Addressbook/GroupContacts/GroupContactDetailApi.d.ts +14 -0
- package/dist/Api/Addressbook/GroupContacts/GroupContactDetailApi.js +84 -0
- package/dist/Api/Addressbook/GroupContacts/GroupContactListApi.d.ts +14 -0
- package/dist/Api/Addressbook/GroupContacts/GroupContactListApi.js +83 -0
- package/dist/Api/Addressbook/GroupContacts/dtos/BaseListApiRequestDTO.d.ts +7 -0
- package/dist/Api/Addressbook/GroupContacts/dtos/BaseListApiRequestDTO.js +7 -0
- package/dist/Api/Addressbook/GroupContacts/dtos/GroupContactApiRequestDTO.d.ts +7 -0
- package/dist/Api/Addressbook/GroupContacts/dtos/GroupContactApiRequestDTO.js +14 -0
- package/dist/Api/Addressbook/GroupContacts/dtos/GroupContactApiResponseDTO.d.ts +8 -0
- package/dist/Api/Addressbook/GroupContacts/dtos/GroupContactApiResponseDTO.js +14 -0
- package/dist/Api/Addressbook/GroupContacts/dtos/GroupContactBaseRequestDTO.d.ts +7 -0
- package/dist/Api/Addressbook/GroupContacts/dtos/GroupContactBaseRequestDTO.js +7 -0
- package/dist/Api/Addressbook/GroupContacts/dtos/GroupContactListApiRequestDTO.d.ts +4 -0
- package/dist/Api/Addressbook/GroupContacts/dtos/GroupContactListApiRequestDTO.js +14 -0
- package/dist/Api/Addressbook/GroupContacts/dtos/GroupContactListApiResponseDTO.d.ts +12 -0
- package/dist/Api/Addressbook/GroupContacts/dtos/GroupContactListApiResponseDTO.js +14 -0
- package/dist/Api/Addressbook/GroupContacts/dtos/index.d.ts +6 -0
- package/dist/Api/Addressbook/GroupContacts/dtos/index.js +22 -0
- package/dist/Api/Addressbook/GroupContacts/helpers/MapApiResponse.d.ts +3 -0
- package/dist/Api/Addressbook/GroupContacts/helpers/MapApiResponse.js +24 -0
- package/dist/Api/Addressbook/GroupContacts/helpers/MapListApiResponse.d.ts +3 -0
- package/dist/Api/Addressbook/GroupContacts/helpers/MapListApiResponse.js +28 -0
- package/dist/Api/Addressbook/GroupContacts/helpers/index.d.ts +2 -0
- package/dist/Api/Addressbook/GroupContacts/helpers/index.js +18 -0
- package/dist/Api/Addressbook/GroupContacts/index.d.ts +11 -0
- package/dist/Api/Addressbook/GroupContacts/index.js +21 -0
- package/dist/Api/Addressbook/Groups/GroupCreateApi.d.ts +17 -0
- package/dist/Api/Addressbook/Groups/GroupCreateApi.js +87 -0
- package/dist/Api/Addressbook/Groups/GroupDeleteApi.d.ts +17 -0
- package/dist/Api/Addressbook/Groups/GroupDeleteApi.js +78 -0
- package/dist/Api/Addressbook/Groups/GroupDetailApi.d.ts +17 -0
- package/dist/Api/Addressbook/Groups/GroupDetailApi.js +78 -0
- package/dist/Api/Addressbook/Groups/GroupListApi.d.ts +17 -0
- package/dist/Api/Addressbook/Groups/GroupListApi.js +78 -0
- package/dist/Api/Addressbook/Groups/GroupUpdateApi.d.ts +17 -0
- package/dist/Api/Addressbook/Groups/GroupUpdateApi.js +89 -0
- package/dist/Api/Addressbook/Groups/dtos/GroupApiRequestDTO.d.ts +5 -0
- package/dist/Api/Addressbook/Groups/dtos/GroupApiRequestDTO.js +22 -0
- package/dist/Api/Addressbook/Groups/dtos/GroupApiResponseDTO.d.ts +6 -0
- package/dist/Api/Addressbook/Groups/dtos/GroupApiResponseDTO.js +14 -0
- package/dist/Api/Addressbook/Groups/dtos/GroupListApiRequestDTO.d.ts +4 -0
- package/dist/Api/Addressbook/Groups/dtos/GroupListApiRequestDTO.js +14 -0
- package/dist/Api/Addressbook/Groups/dtos/GroupListApiResponseDTO.d.ts +10 -0
- package/dist/Api/Addressbook/Groups/dtos/GroupListApiResponseDTO.js +14 -0
- package/dist/Api/Addressbook/Groups/dtos/index.d.ts +4 -0
- package/dist/Api/Addressbook/Groups/dtos/index.js +20 -0
- package/dist/Api/Addressbook/Groups/helpers/MapApiResponse.d.ts +3 -0
- package/dist/Api/Addressbook/Groups/helpers/MapApiResponse.js +20 -0
- package/dist/Api/Addressbook/Groups/helpers/MapListApiResponse.d.ts +3 -0
- package/dist/Api/Addressbook/Groups/helpers/MapListApiResponse.js +24 -0
- package/dist/Api/Addressbook/Groups/helpers/index.d.ts +2 -0
- package/dist/Api/Addressbook/Groups/helpers/index.js +18 -0
- package/dist/Api/Addressbook/Groups/index.d.ts +12 -0
- package/dist/Api/Addressbook/Groups/index.js +24 -0
- package/dist/Api/Addressbook/Groups/models/GroupModel.d.ts +14 -0
- package/dist/Api/Addressbook/Groups/models/GroupModel.js +17 -0
- package/dist/Api/Addressbook/Groups/models/index.d.ts +1 -0
- package/dist/Api/Addressbook/Groups/models/index.js +17 -0
- package/dist/Api/Addressbook/index.d.ts +12 -0
- package/dist/Api/Addressbook/index.js +17 -0
- package/dist/Api/Addressbook/interfaces/IContactArgs.d.ts +45 -0
- package/dist/Api/Addressbook/interfaces/IContactArgs.js +2 -0
- package/dist/Api/Addressbook/interfaces/IContactGroupArgs.d.ts +15 -0
- package/dist/Api/Addressbook/interfaces/IContactGroupArgs.js +2 -0
- package/dist/Api/Addressbook/interfaces/IGroupArgs.d.ts +24 -0
- package/dist/Api/Addressbook/interfaces/IGroupArgs.js +2 -0
- package/dist/Api/Addressbook/interfaces/IGroupContactArgs.d.ts +16 -0
- package/dist/Api/Addressbook/interfaces/IGroupContactArgs.js +2 -0
- package/dist/Api/Addressbook/interfaces/index.d.ts +4 -0
- package/dist/Api/Addressbook/interfaces/index.js +20 -0
- package/dist/Api/Messaging/BaseMessagingApi.d.ts +28 -0
- package/dist/Api/Messaging/BaseMessagingApi.js +152 -0
- package/dist/Api/Messaging/EmailApi.d.ts +21 -0
- package/dist/Api/Messaging/EmailApi.js +47 -0
- package/dist/Api/Messaging/FaxApi.d.ts +18 -0
- package/dist/Api/Messaging/FaxApi.js +47 -0
- package/dist/Api/Messaging/RCSApi.d.ts +21 -0
- package/dist/Api/Messaging/RCSApi.js +44 -0
- package/dist/Api/Messaging/SMSApi.d.ts +21 -0
- package/dist/Api/Messaging/SMSApi.js +44 -0
- package/dist/Api/Messaging/TTSApi.d.ts +22 -0
- package/dist/Api/Messaging/TTSApi.js +67 -0
- package/dist/Api/Messaging/VoiceApi.d.ts +24 -0
- package/dist/Api/Messaging/VoiceApi.js +95 -0
- package/dist/Api/Messaging/WhatsAppApi.d.ts +21 -0
- package/dist/Api/Messaging/WhatsAppApi.js +44 -0
- package/dist/Api/Messaging/WorkflowApi.d.ts +21 -0
- package/dist/Api/Messaging/WorkflowApi.js +41 -0
- package/dist/Api/Messaging/dtos/EmailApiRequestDTO.d.ts +13 -0
- package/dist/Api/Messaging/dtos/EmailApiRequestDTO.js +15 -0
- package/dist/Api/Messaging/dtos/FaxApiRequestDTO.d.ts +13 -0
- package/dist/Api/Messaging/dtos/FaxApiRequestDTO.js +15 -0
- package/dist/Api/Messaging/dtos/MessagingApiSuccessResponseDTO.d.ts +7 -0
- package/dist/Api/Messaging/dtos/MessagingApiSuccessResponseDTO.js +14 -0
- package/dist/Api/Messaging/dtos/MessagingBaseRequestDTO.d.ts +33 -0
- package/dist/Api/Messaging/dtos/MessagingBaseRequestDTO.js +9 -0
- package/dist/Api/Messaging/dtos/RCSApiRequestDTO.d.ts +9 -0
- package/dist/Api/Messaging/dtos/RCSApiRequestDTO.js +15 -0
- package/dist/Api/Messaging/dtos/SMSApiRequestDTO.d.ts +11 -0
- package/dist/Api/Messaging/dtos/SMSApiRequestDTO.js +16 -0
- package/dist/Api/Messaging/dtos/TTSApiRequestDTO.d.ts +20 -0
- package/dist/Api/Messaging/dtos/TTSApiRequestDTO.js +18 -0
- package/dist/Api/Messaging/dtos/VoiceApiRequestDTO.d.ts +20 -0
- package/dist/Api/Messaging/dtos/VoiceApiRequestDTO.js +36 -0
- package/dist/Api/Messaging/dtos/WhatsAppApiRequestDTO.d.ts +8 -0
- package/dist/Api/Messaging/dtos/WhatsAppApiRequestDTO.js +15 -0
- package/dist/Api/Messaging/dtos/WorkflowApiRequestDTO.d.ts +5 -0
- package/dist/Api/Messaging/dtos/WorkflowApiRequestDTO.js +14 -0
- package/dist/Api/Messaging/dtos/index.d.ts +10 -0
- package/dist/Api/Messaging/dtos/index.js +26 -0
- package/dist/Api/Messaging/helpers/AddRecipient.d.ts +3 -0
- package/dist/Api/Messaging/helpers/AddRecipient.js +19 -0
- package/dist/Api/Messaging/helpers/MapApiResponse.d.ts +3 -0
- package/dist/Api/Messaging/helpers/MapApiResponse.js +17 -0
- package/dist/Api/Messaging/helpers/index.d.ts +2 -0
- package/dist/Api/Messaging/helpers/index.js +18 -0
- package/dist/Api/Messaging/index.d.ts +20 -0
- package/dist/Api/Messaging/index.js +25 -0
- package/dist/Api/Messaging/interfaces/IEmailArgs.d.ts +50 -0
- package/dist/Api/Messaging/interfaces/IEmailArgs.js +2 -0
- package/dist/Api/Messaging/interfaces/IFaxArgs.d.ts +49 -0
- package/dist/Api/Messaging/interfaces/IFaxArgs.js +2 -0
- package/dist/Api/Messaging/interfaces/IMessagingDestination.d.ts +9 -0
- package/dist/Api/Messaging/interfaces/IMessagingDestination.js +2 -0
- package/dist/Api/Messaging/interfaces/IRCSArgs.d.ts +43 -0
- package/dist/Api/Messaging/interfaces/IRCSArgs.js +2 -0
- package/dist/Api/Messaging/interfaces/ISMSArgs.d.ts +48 -0
- package/dist/Api/Messaging/interfaces/ISMSArgs.js +2 -0
- package/dist/Api/Messaging/interfaces/ITTSArgs.d.ts +61 -0
- package/dist/Api/Messaging/interfaces/ITTSArgs.js +2 -0
- package/dist/Api/Messaging/interfaces/IVoiceArgs.d.ts +67 -0
- package/dist/Api/Messaging/interfaces/IVoiceArgs.js +2 -0
- package/dist/Api/Messaging/interfaces/IWhatsAppArgs.d.ts +44 -0
- package/dist/Api/Messaging/interfaces/IWhatsAppArgs.js +2 -0
- package/dist/Api/Messaging/interfaces/IWorkflowArgs.d.ts +41 -0
- package/dist/Api/Messaging/interfaces/IWorkflowArgs.js +2 -0
- package/dist/Api/Messaging/interfaces/index.d.ts +9 -0
- package/dist/Api/Messaging/interfaces/index.js +25 -0
- package/dist/Api/Messaging/models/CommonModel.d.ts +17 -0
- package/dist/Api/Messaging/models/CommonModel.js +6 -0
- package/dist/Api/Messaging/models/EmailModel.d.ts +20 -0
- package/dist/Api/Messaging/models/EmailModel.js +17 -0
- package/dist/Api/Messaging/models/FaxModel.d.ts +20 -0
- package/dist/Api/Messaging/models/FaxModel.js +17 -0
- package/dist/Api/Messaging/models/IMessagingModel.d.ts +6 -0
- package/dist/Api/Messaging/models/IMessagingModel.js +2 -0
- package/dist/Api/Messaging/models/RCSModel.d.ts +16 -0
- package/dist/Api/Messaging/models/RCSModel.js +17 -0
- package/dist/Api/Messaging/models/SMSModel.d.ts +18 -0
- package/dist/Api/Messaging/models/SMSModel.js +17 -0
- package/dist/Api/Messaging/models/TTSModel.d.ts +28 -0
- package/dist/Api/Messaging/models/TTSModel.js +22 -0
- package/dist/Api/Messaging/models/VoiceModel.d.ts +31 -0
- package/dist/Api/Messaging/models/VoiceModel.js +23 -0
- package/dist/Api/Messaging/models/WhatsAppModel.d.ts +15 -0
- package/dist/Api/Messaging/models/WhatsAppModel.js +17 -0
- package/dist/Api/Messaging/models/WorkflowModel.d.ts +14 -0
- package/dist/Api/Messaging/models/WorkflowModel.js +17 -0
- package/dist/Api/Messaging/models/index.d.ts +10 -0
- package/dist/Api/Messaging/models/index.js +26 -0
- package/dist/Api/OptOut/OptOutCreateApi.d.ts +17 -0
- package/dist/Api/OptOut/OptOutCreateApi.js +49 -0
- package/dist/Api/OptOut/OptOutDeleteApi.d.ts +17 -0
- package/dist/Api/OptOut/OptOutDeleteApi.js +47 -0
- package/dist/Api/OptOut/OptOutDetailApi.d.ts +17 -0
- package/dist/Api/OptOut/OptOutDetailApi.js +47 -0
- package/dist/Api/OptOut/OptOutListApi.d.ts +17 -0
- package/dist/Api/OptOut/OptOutListApi.js +62 -0
- package/dist/Api/OptOut/dtos/OptOutApiRequestDTO.d.ts +4 -0
- package/dist/Api/OptOut/dtos/OptOutApiRequestDTO.js +14 -0
- package/dist/Api/OptOut/dtos/OptOutApiResponseDTO.d.ts +20 -0
- package/dist/Api/OptOut/dtos/OptOutApiResponseDTO.js +14 -0
- package/dist/Api/OptOut/dtos/OptOutListApiRequestDTO.d.ts +8 -0
- package/dist/Api/OptOut/dtos/OptOutListApiRequestDTO.js +14 -0
- package/dist/Api/OptOut/dtos/OptOutListApiResponseDTO.d.ts +10 -0
- package/dist/Api/OptOut/dtos/OptOutListApiResponseDTO.js +17 -0
- package/dist/Api/OptOut/dtos/index.d.ts +4 -0
- package/dist/Api/OptOut/dtos/index.js +20 -0
- package/dist/Api/OptOut/index.d.ts +11 -0
- package/dist/Api/OptOut/index.js +21 -0
- package/dist/Api/OptOut/interfaces/IOptOutArgs.d.ts +22 -0
- package/dist/Api/OptOut/interfaces/IOptOutArgs.js +2 -0
- package/dist/Api/OptOut/interfaces/index.d.ts +1 -0
- package/dist/Api/OptOut/interfaces/index.js +17 -0
- package/dist/Api/OptOut/models/OptOutModel.d.ts +11 -0
- package/dist/Api/OptOut/models/OptOutModel.js +12 -0
- package/dist/Api/OptOut/models/index.d.ts +1 -0
- package/dist/Api/OptOut/models/index.js +17 -0
- package/dist/Api/Reports/SMSReceivedApi.d.ts +18 -0
- package/dist/Api/Reports/SMSReceivedApi.js +92 -0
- package/dist/Api/Reports/SMSReplyApi.d.ts +18 -0
- package/dist/Api/Reports/SMSReplyApi.js +62 -0
- package/dist/Api/Reports/StatusApi.d.ts +18 -0
- package/dist/Api/Reports/StatusApi.js +76 -0
- package/dist/Api/Reports/dtos/RecipientDTO.d.ts +24 -0
- package/dist/Api/Reports/dtos/RecipientDTO.js +12 -0
- package/dist/Api/Reports/dtos/SMSReceivedApiRequestDTO.d.ts +7 -0
- package/dist/Api/Reports/dtos/SMSReceivedApiRequestDTO.js +17 -0
- package/dist/Api/Reports/dtos/SMSReceivedApiResponseDTO.d.ts +6 -0
- package/dist/Api/Reports/dtos/SMSReceivedApiResponseDTO.js +15 -0
- package/dist/Api/Reports/dtos/SMSReceivedDTO.d.ts +14 -0
- package/dist/Api/Reports/dtos/SMSReceivedDTO.js +12 -0
- package/dist/Api/Reports/dtos/SMSReplyApiRequestDTO.d.ts +5 -0
- package/dist/Api/Reports/dtos/SMSReplyApiRequestDTO.js +14 -0
- package/dist/Api/Reports/dtos/SMSReplyApiResponseDTO.d.ts +23 -0
- package/dist/Api/Reports/dtos/SMSReplyApiResponseDTO.js +24 -0
- package/dist/Api/Reports/dtos/SMSReplyRecipientDTO.d.ts +6 -0
- package/dist/Api/Reports/dtos/SMSReplyRecipientDTO.js +19 -0
- package/dist/Api/Reports/dtos/SMSReplyRecipientSMSReplyDTO.d.ts +9 -0
- package/dist/Api/Reports/dtos/SMSReplyRecipientSMSReplyDTO.js +12 -0
- package/dist/Api/Reports/dtos/StatusApiRequestDTO.d.ts +6 -0
- package/dist/Api/Reports/dtos/StatusApiRequestDTO.js +14 -0
- package/dist/Api/Reports/dtos/StatusApiResponseDTO.d.ts +27 -0
- package/dist/Api/Reports/dtos/StatusApiResponseDTO.js +15 -0
- package/dist/Api/Reports/dtos/index.d.ts +10 -0
- package/dist/Api/Reports/dtos/index.js +26 -0
- package/dist/Api/Reports/index.d.ts +10 -0
- package/dist/Api/Reports/index.js +15 -0
- package/dist/Api/Reports/interfaces/IReportsArgs.d.ts +18 -0
- package/dist/Api/Reports/interfaces/IReportsArgs.js +2 -0
- package/dist/Api/Reports/interfaces/index.d.ts +1 -0
- package/dist/Api/Reports/interfaces/index.js +17 -0
- package/dist/Common/IHttpClient.d.ts +6 -0
- package/dist/Common/IHttpClient.js +2 -0
- package/dist/Common/NodeHttpClient.d.ts +10 -0
- package/dist/Common/NodeHttpClient.js +24 -0
- package/dist/Common/Result.d.ts +6 -0
- package/dist/Common/Result.js +13 -0
- package/dist/Common/ValidationResult.d.ts +4 -0
- package/dist/Common/ValidationResult.js +2 -0
- package/dist/Common/dtos/CommonApiRequestDTO.d.ts +3 -0
- package/dist/Common/dtos/CommonApiRequestDTO.js +7 -0
- package/dist/Common/dtos/CommonApiResponseDTO.d.ts +4 -0
- package/dist/Common/dtos/CommonApiResponseDTO.js +10 -0
- package/dist/Common/dtos/CommonListApiRequestDTO.d.ts +6 -0
- package/dist/Common/dtos/CommonListApiRequestDTO.js +12 -0
- package/dist/Common/dtos/CommonListApiResponseDTO.d.ts +8 -0
- package/dist/Common/dtos/CommonListApiResponseDTO.js +14 -0
- package/dist/Common/dtos/ErrorResponseDTO.d.ts +6 -0
- package/dist/Common/dtos/ErrorResponseDTO.js +15 -0
- package/dist/Common/dtos/index.d.ts +5 -0
- package/dist/Common/dtos/index.js +21 -0
- package/dist/Common/enums/MessagingEnums.d.ts +45 -0
- package/dist/Common/enums/MessagingEnums.js +56 -0
- package/dist/Common/index.d.ts +7 -0
- package/dist/Common/index.js +23 -0
- package/dist/Common/isSuccessResult.d.ts +1 -0
- package/dist/Common/isSuccessResult.js +9 -0
- package/dist/Functions/FileHandler.d.ts +6 -0
- package/dist/Functions/FileHandler.js +57 -0
- package/dist/Functions/HttpRequest.d.ts +10 -0
- package/dist/Functions/HttpRequest.js +156 -0
- package/dist/Functions/Mapper.d.ts +1 -0
- package/dist/Functions/Mapper.js +23 -0
- package/dist/Functions/UsefulStuff.d.ts +20 -0
- package/dist/Functions/UsefulStuff.js +136 -0
- package/dist/Functions/index.d.ts +5 -0
- package/dist/Functions/index.js +48 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +43 -0
- package/dist/interfaces.d.ts +4 -0
- package/dist/interfaces.js +2 -0
- package/package.json +47 -0
|
@@ -0,0 +1,57 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const fs = __importStar(require("fs"));
|
|
37
|
+
const util = __importStar(require("util"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const read = util.promisify(fs.readFile);
|
|
40
|
+
const FileHandler = {
|
|
41
|
+
fileExists: (file) => {
|
|
42
|
+
try {
|
|
43
|
+
return fs.existsSync(file);
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
console.error(err);
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
getFileData: async (file) => {
|
|
51
|
+
return (await read(file)).toString("base64");
|
|
52
|
+
},
|
|
53
|
+
getBaseName: (file) => {
|
|
54
|
+
return path.basename(file);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.default = FileHandler;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface HostDetails {
|
|
2
|
+
Port: number;
|
|
3
|
+
Host: string;
|
|
4
|
+
Path: string;
|
|
5
|
+
Protocol: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const GetHostDetails: (url: string) => HostDetails | undefined;
|
|
8
|
+
export declare const HttpRequest: (url: string, payload: any, authToken: string, method: string, callback: (data: any) => void) => void;
|
|
9
|
+
export declare const HttpRequestAsync: (url: string, payload: any, authToken: string, method: string) => Promise<any>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,156 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.HttpRequestAsync = exports.HttpRequest = exports.GetHostDetails = void 0;
|
|
37
|
+
const https = __importStar(require("https"));
|
|
38
|
+
const http = __importStar(require("http"));
|
|
39
|
+
const UsefulStuff_1 = require("./UsefulStuff");
|
|
40
|
+
const sslIgnoreAgent = new https.Agent({ rejectUnauthorized: false });
|
|
41
|
+
const GetHostDetails = (url) => {
|
|
42
|
+
try {
|
|
43
|
+
const parsed = new URL(url);
|
|
44
|
+
const protocol = parsed.protocol.replace(':', ''); // 'https' or 'http'
|
|
45
|
+
if (protocol !== 'https' && protocol !== 'http') {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
const defaultPort = protocol === 'https' ? 443 : 80;
|
|
49
|
+
return {
|
|
50
|
+
Host: parsed.hostname,
|
|
51
|
+
Port: parsed.port ? parseInt(parsed.port, 10) : defaultPort,
|
|
52
|
+
Path: parsed.pathname + parsed.search,
|
|
53
|
+
Protocol: protocol,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
exports.GetHostDetails = GetHostDetails;
|
|
61
|
+
const request = (options, callback) => {
|
|
62
|
+
const requester = options.protocol === 'https:' ? https.request : http.request;
|
|
63
|
+
return requester(options, (res) => {
|
|
64
|
+
let data = '';
|
|
65
|
+
res.setEncoding('utf8');
|
|
66
|
+
res.on('data', (chunk) => {
|
|
67
|
+
data += chunk;
|
|
68
|
+
});
|
|
69
|
+
res.on('end', () => {
|
|
70
|
+
try {
|
|
71
|
+
if (res.statusCode && (res.statusCode < 200 || res.statusCode >= 300)) {
|
|
72
|
+
try {
|
|
73
|
+
callback({ HttpStatusCode: res.statusCode, ...JSON.parse(data) });
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
callback({ HttpStatusCode: res.statusCode, Result: "Error", ErrorMessage: [`Request failed with status code ${res.statusCode}: ${data}`] });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else if (data === '') {
|
|
80
|
+
callback({ HttpStatusCode: res.statusCode, Result: "Success" });
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
callback({ HttpStatusCode: res.statusCode, ...JSON.parse(data) });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
callback(null, new Error('Failed to parse response as JSON: ' + error.message));
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
res.on('error', (err) => {
|
|
91
|
+
callback(null, err);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
const HttpRequest = (url, payload, authToken, method, callback) => {
|
|
96
|
+
const host = (0, exports.GetHostDetails)(url);
|
|
97
|
+
if (!host) {
|
|
98
|
+
callback({ Result: "Error", ErrorMessage: ["Invalid URL"] });
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const isGet = method.toUpperCase() === 'GET';
|
|
102
|
+
const postData = isGet ? '' : JSON.stringify(payload);
|
|
103
|
+
const headers = {
|
|
104
|
+
'Content-Type': 'application/json',
|
|
105
|
+
'Accept': 'application/json',
|
|
106
|
+
'Authorization': !(0, UsefulStuff_1.isEmpty)(authToken) ? `Bearer ${authToken}` : "",
|
|
107
|
+
'User-Agent': 'tnzapi-nodejs-ts/3.00'
|
|
108
|
+
};
|
|
109
|
+
if (!isGet) {
|
|
110
|
+
headers['Content-Length'] = Buffer.byteLength(postData, 'utf8');
|
|
111
|
+
}
|
|
112
|
+
const options = {
|
|
113
|
+
hostname: host.Host,
|
|
114
|
+
port: host.Port,
|
|
115
|
+
path: host.Path,
|
|
116
|
+
method: method,
|
|
117
|
+
protocol: `${host.Protocol}:`,
|
|
118
|
+
headers: headers,
|
|
119
|
+
...(host.Protocol === 'https' && process.env.TNZ_IGNORE_SSL === 'true'
|
|
120
|
+
? { agent: sslIgnoreAgent }
|
|
121
|
+
: {})
|
|
122
|
+
};
|
|
123
|
+
let callbackCalled = false;
|
|
124
|
+
const safeCallback = (data) => {
|
|
125
|
+
if (!callbackCalled) {
|
|
126
|
+
callbackCalled = true;
|
|
127
|
+
callback(data);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
const req = request(options, (responseData, err) => {
|
|
131
|
+
if (err) {
|
|
132
|
+
safeCallback({ Result: "Error", ErrorMessage: [err.message] });
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
safeCallback(responseData);
|
|
136
|
+
});
|
|
137
|
+
req.setTimeout(30000, () => {
|
|
138
|
+
req.destroy(new Error('Request timed out'));
|
|
139
|
+
});
|
|
140
|
+
req.on('error', (error) => {
|
|
141
|
+
safeCallback({ Result: "Error", ErrorMessage: [error.message] });
|
|
142
|
+
});
|
|
143
|
+
if (!isGet) {
|
|
144
|
+
req.write(postData);
|
|
145
|
+
}
|
|
146
|
+
req.end();
|
|
147
|
+
};
|
|
148
|
+
exports.HttpRequest = HttpRequest;
|
|
149
|
+
const HttpRequestAsync = (url, payload, authToken, method) => {
|
|
150
|
+
return new Promise((resolve, reject) => {
|
|
151
|
+
(0, exports.HttpRequest)(url, payload, authToken, method, (data) => {
|
|
152
|
+
resolve(data);
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
exports.HttpRequestAsync = HttpRequestAsync;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Map: <T extends object>(obj: T, data: Partial<T> | object) => void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Map = void 0;
|
|
4
|
+
const UsefulStuff_1 = require("./UsefulStuff");
|
|
5
|
+
const Map = (obj, data) => {
|
|
6
|
+
if ((0, UsefulStuff_1.isEmpty)(data) || typeof obj !== 'object' || obj === null || typeof data !== 'object' || data === null) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
for (const name in data) {
|
|
10
|
+
if (Object.prototype.hasOwnProperty.call(data, name)) {
|
|
11
|
+
const sourceProp = data[name];
|
|
12
|
+
const destProp = obj[name];
|
|
13
|
+
if (typeof sourceProp === 'object' && sourceProp !== null && !Array.isArray(sourceProp) &&
|
|
14
|
+
typeof destProp === 'object' && destProp !== null && !Array.isArray(destProp)) {
|
|
15
|
+
(0, exports.Map)(destProp, sourceProp);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
obj[name] = sourceProp;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
exports.Map = Map;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare function replaceAll(str: string, find: string, replace: string): string;
|
|
2
|
+
export declare const isEmpty: (obj: any) => boolean;
|
|
3
|
+
export declare const isEmail: (str: string) => boolean;
|
|
4
|
+
export declare const isNumber: (num: any) => boolean;
|
|
5
|
+
export declare const isDateTime: (date: string) => boolean;
|
|
6
|
+
export declare const isPhoneNumber: (num: string) => boolean;
|
|
7
|
+
export declare const isMobileNumber: (num: string) => boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Formats a phone number (landline or mobile) to E.164 numeric-only format.
|
|
10
|
+
* Attempts to parse as NZ first, then AU, then international.
|
|
11
|
+
* Returns an empty string if the number cannot be parsed as a valid number.
|
|
12
|
+
*/
|
|
13
|
+
export declare const formatPhoneNumber: (requested_number: string) => string;
|
|
14
|
+
/**
|
|
15
|
+
* Formats a mobile number to E.164 numeric-only format.
|
|
16
|
+
* Attempts to parse as NZ first, then AU, then international.
|
|
17
|
+
* Returns an empty string if the number cannot be parsed as a valid mobile number.
|
|
18
|
+
*/
|
|
19
|
+
export declare const formatMobileNumber: (requested_number: string) => string;
|
|
20
|
+
export declare const httpBuildQuery: (data: any) => string;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.httpBuildQuery = exports.formatMobileNumber = exports.formatPhoneNumber = exports.isMobileNumber = exports.isPhoneNumber = exports.isDateTime = exports.isNumber = exports.isEmail = exports.isEmpty = void 0;
|
|
4
|
+
exports.replaceAll = replaceAll;
|
|
5
|
+
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
6
|
+
const phoneUtil = google_libphonenumber_1.PhoneNumberUtil.getInstance();
|
|
7
|
+
function replaceAll(str, find, replace) {
|
|
8
|
+
return str.split(find).join(replace);
|
|
9
|
+
}
|
|
10
|
+
const isEmpty = (obj) => {
|
|
11
|
+
if (typeof obj === 'undefined' || obj === null || obj === '' || obj.length <= 0) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
15
|
+
};
|
|
16
|
+
exports.isEmpty = isEmpty;
|
|
17
|
+
const isEmail = (str) => {
|
|
18
|
+
if (!str) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
const r = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
22
|
+
return r.test(str);
|
|
23
|
+
};
|
|
24
|
+
exports.isEmail = isEmail;
|
|
25
|
+
const isNumber = (num) => {
|
|
26
|
+
return typeof num === "number" && !isNaN(num);
|
|
27
|
+
};
|
|
28
|
+
exports.isNumber = isNumber;
|
|
29
|
+
const isDateTime = (date) => {
|
|
30
|
+
if (!date) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
// Require at minimum YYYY-MM-DD prefix — prevents bare numbers like "2024" or "3"
|
|
34
|
+
if (!/^\d{4}-\d{2}-\d{2}/.test(date)) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
const testDate = new Date(date);
|
|
38
|
+
return testDate.toString() !== "Invalid Date";
|
|
39
|
+
};
|
|
40
|
+
exports.isDateTime = isDateTime;
|
|
41
|
+
const isPhoneNumber = (num) => {
|
|
42
|
+
const phoneNumber = (0, exports.formatPhoneNumber)(num);
|
|
43
|
+
return !(0, exports.isEmpty)(phoneNumber);
|
|
44
|
+
};
|
|
45
|
+
exports.isPhoneNumber = isPhoneNumber;
|
|
46
|
+
const isMobileNumber = (num) => {
|
|
47
|
+
const mobileNumber = (0, exports.formatMobileNumber)(num);
|
|
48
|
+
return !(0, exports.isEmpty)(mobileNumber);
|
|
49
|
+
};
|
|
50
|
+
exports.isMobileNumber = isMobileNumber;
|
|
51
|
+
/**
|
|
52
|
+
* Formats a phone number (landline or mobile) to E.164 numeric-only format.
|
|
53
|
+
* Attempts to parse as NZ first, then AU, then international.
|
|
54
|
+
* Returns an empty string if the number cannot be parsed as a valid number.
|
|
55
|
+
*/
|
|
56
|
+
const formatPhoneNumber = (requested_number) => {
|
|
57
|
+
if (!requested_number) {
|
|
58
|
+
return "";
|
|
59
|
+
}
|
|
60
|
+
// Try NZ first, then AU, then treat as international (with leading +)
|
|
61
|
+
const candidateRegions = ['NZ', 'AU'];
|
|
62
|
+
for (const region of candidateRegions) {
|
|
63
|
+
try {
|
|
64
|
+
const parsed = phoneUtil.parse(requested_number, region);
|
|
65
|
+
if (phoneUtil.isValidNumber(parsed)) {
|
|
66
|
+
// Return E.164 without the leading '+'
|
|
67
|
+
return phoneUtil.format(parsed, google_libphonenumber_1.PhoneNumberFormat.E164).replace(/^\+/, '');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// try next region
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Attempt as an already-international number (e.g. +44...)
|
|
75
|
+
try {
|
|
76
|
+
const parsed = phoneUtil.parse(requested_number);
|
|
77
|
+
if (phoneUtil.isValidNumber(parsed)) {
|
|
78
|
+
return phoneUtil.format(parsed, google_libphonenumber_1.PhoneNumberFormat.E164).replace(/^\+/, '');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// fall through
|
|
83
|
+
}
|
|
84
|
+
return "";
|
|
85
|
+
};
|
|
86
|
+
exports.formatPhoneNumber = formatPhoneNumber;
|
|
87
|
+
/**
|
|
88
|
+
* Formats a mobile number to E.164 numeric-only format.
|
|
89
|
+
* Attempts to parse as NZ first, then AU, then international.
|
|
90
|
+
* Returns an empty string if the number cannot be parsed as a valid mobile number.
|
|
91
|
+
*/
|
|
92
|
+
const formatMobileNumber = (requested_number) => {
|
|
93
|
+
if ((0, exports.isEmpty)(requested_number)) {
|
|
94
|
+
return "";
|
|
95
|
+
}
|
|
96
|
+
const candidateRegions = ['NZ', 'AU'];
|
|
97
|
+
for (const region of candidateRegions) {
|
|
98
|
+
try {
|
|
99
|
+
const parsed = phoneUtil.parse(requested_number, region);
|
|
100
|
+
if (phoneUtil.isValidNumber(parsed)) {
|
|
101
|
+
const numberType = phoneUtil.getNumberType(parsed);
|
|
102
|
+
// PhoneNumberType.MOBILE = 1, FIXED_LINE_OR_MOBILE = 2
|
|
103
|
+
if (numberType === 1 || numberType === 2) {
|
|
104
|
+
return phoneUtil.format(parsed, google_libphonenumber_1.PhoneNumberFormat.E164).replace(/^\+/, '');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
// try next region
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Attempt as an already-international number
|
|
113
|
+
try {
|
|
114
|
+
const parsed = phoneUtil.parse(requested_number);
|
|
115
|
+
if (phoneUtil.isValidNumber(parsed)) {
|
|
116
|
+
const numberType = phoneUtil.getNumberType(parsed);
|
|
117
|
+
if (numberType === 1 || numberType === 2) {
|
|
118
|
+
return phoneUtil.format(parsed, google_libphonenumber_1.PhoneNumberFormat.E164).replace(/^\+/, '');
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
// fall through
|
|
124
|
+
}
|
|
125
|
+
return "";
|
|
126
|
+
};
|
|
127
|
+
exports.formatMobileNumber = formatMobileNumber;
|
|
128
|
+
const httpBuildQuery = (data) => {
|
|
129
|
+
return Object.keys(data).map((key) => {
|
|
130
|
+
if (Array.isArray(data[key])) {
|
|
131
|
+
return `${encodeURIComponent(key)}=${encodeURIComponent(data[key].map((item) => item).join(','))}`;
|
|
132
|
+
}
|
|
133
|
+
return `${encodeURIComponent(key)}=${encodeURIComponent(data[key])}`;
|
|
134
|
+
}).join('&');
|
|
135
|
+
};
|
|
136
|
+
exports.httpBuildQuery = httpBuildQuery;
|
|
@@ -0,0 +1,48 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.Map = exports.UsefulStuff = exports.FileHandler = exports.HttpRequestAsync = exports.HttpRequest = void 0;
|
|
40
|
+
const HttpRequest_1 = require("./HttpRequest");
|
|
41
|
+
Object.defineProperty(exports, "HttpRequest", { enumerable: true, get: function () { return HttpRequest_1.HttpRequest; } });
|
|
42
|
+
Object.defineProperty(exports, "HttpRequestAsync", { enumerable: true, get: function () { return HttpRequest_1.HttpRequestAsync; } });
|
|
43
|
+
const FileHandler_1 = __importDefault(require("./FileHandler"));
|
|
44
|
+
exports.FileHandler = FileHandler_1.default;
|
|
45
|
+
const UsefulStuff = __importStar(require("./UsefulStuff"));
|
|
46
|
+
exports.UsefulStuff = UsefulStuff;
|
|
47
|
+
const Mapper_1 = require("./Mapper");
|
|
48
|
+
Object.defineProperty(exports, "Map", { enumerable: true, get: function () { return Mapper_1.Map; } });
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Messaging } from './Api/Messaging';
|
|
2
|
+
import { Reports } from './Api/Reports';
|
|
3
|
+
import { Actions } from './Api/Actions';
|
|
4
|
+
import { Addressbook } from './Api/Addressbook';
|
|
5
|
+
import { OptOut } from './Api/OptOut';
|
|
6
|
+
import { ITNZAuthArgs } from './interfaces';
|
|
7
|
+
export * from './Common/enums/MessagingEnums';
|
|
8
|
+
export { ErrorResponseDTO } from './Common/dtos';
|
|
9
|
+
export type { ITNZAuthArgs };
|
|
10
|
+
export declare class TNZAPI {
|
|
11
|
+
Messaging: Messaging;
|
|
12
|
+
Reports: Reports;
|
|
13
|
+
Actions: Actions;
|
|
14
|
+
Addressbook: Addressbook;
|
|
15
|
+
OptOut: OptOut;
|
|
16
|
+
constructor(args?: ITNZAuthArgs);
|
|
17
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
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.TNZAPI = exports.ErrorResponseDTO = void 0;
|
|
18
|
+
const Messaging_1 = require("./Api/Messaging");
|
|
19
|
+
const Reports_1 = require("./Api/Reports");
|
|
20
|
+
const Actions_1 = require("./Api/Actions");
|
|
21
|
+
const Addressbook_1 = require("./Api/Addressbook");
|
|
22
|
+
const OptOut_1 = require("./Api/OptOut");
|
|
23
|
+
__exportStar(require("./Common/enums/MessagingEnums"), exports);
|
|
24
|
+
var dtos_1 = require("./Common/dtos");
|
|
25
|
+
Object.defineProperty(exports, "ErrorResponseDTO", { enumerable: true, get: function () { return dtos_1.ErrorResponseDTO; } });
|
|
26
|
+
class TNZAPI {
|
|
27
|
+
constructor(args) {
|
|
28
|
+
const authToken = args?.AuthToken || process.env.TNZ_AUTH_TOKEN;
|
|
29
|
+
if (!authToken) {
|
|
30
|
+
throw new Error('TNZ AuthToken is required. Pass it as AuthToken or set the TNZ_AUTH_TOKEN environment variable.');
|
|
31
|
+
}
|
|
32
|
+
const authArgs = {
|
|
33
|
+
AuthToken: authToken,
|
|
34
|
+
URL: args?.URL || process.env.TNZ_API_URL || "https://api.tnz.co.nz/api/v3.00"
|
|
35
|
+
};
|
|
36
|
+
this.Messaging = new Messaging_1.Messaging(authArgs);
|
|
37
|
+
this.Reports = new Reports_1.Reports(authArgs);
|
|
38
|
+
this.Actions = new Actions_1.Actions(authArgs);
|
|
39
|
+
this.Addressbook = new Addressbook_1.Addressbook(authArgs);
|
|
40
|
+
this.OptOut = new OptOut_1.OptOut(authArgs);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.TNZAPI = TNZAPI;
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tnzapi-ts",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "TypeScript Library for TNZ Group REST API v3.00 — SMS, Email, Fax, TTS, Voice, WhatsApp, Workflow, Addressbook, Opt-Out",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/tnzgroup/tnzapi-ts.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/tnzgroup/tnzapi-ts/issues"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"test": "jest",
|
|
20
|
+
"test:unit": "jest --selectProjects unit",
|
|
21
|
+
"test:integration": "jest --selectProjects integration"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"tnzapi",
|
|
25
|
+
"email",
|
|
26
|
+
"sms",
|
|
27
|
+
"fax",
|
|
28
|
+
"tts",
|
|
29
|
+
"voice",
|
|
30
|
+
"typescript"
|
|
31
|
+
],
|
|
32
|
+
"author": "TNZ Group Limited",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"homepage": "https://www.tnz.co.nz",
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/google-libphonenumber": "^7.4.30",
|
|
37
|
+
"@types/jest": "^30.0.0",
|
|
38
|
+
"@types/node": "^20.12.12",
|
|
39
|
+
"dotenv": "^17.2.2",
|
|
40
|
+
"jest": "^30.1.3",
|
|
41
|
+
"ts-jest": "^29.4.1",
|
|
42
|
+
"typescript": "^5.4.5"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"google-libphonenumber": "^3.2.44"
|
|
46
|
+
}
|
|
47
|
+
}
|