diff --git a/.eslintignore b/.eslintignore
deleted file mode 100644
index 76add87..0000000
--- a/.eslintignore
+++ /dev/null
@@ -1,2 +0,0 @@
-node_modules
-dist
\ No newline at end of file
diff --git a/.eslintrc b/.eslintrc
deleted file mode 100644
index 0da1e0a..0000000
--- a/.eslintrc
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "root": true,
- "parser": "@typescript-eslint/parser",
- "plugins": [
- "@typescript-eslint",
- "unused-imports"
- ],
- "extends": [
- "eslint:recommended",
- "plugin:@typescript-eslint/eslint-recommended",
- "plugin:@typescript-eslint/recommended"
- ],
- "rules": {
- "unused-imports/no-unused-imports-ts" : 2,
- "@typescript-eslint/ban-types" : "off",
- "@typescript-eslint/no-explicit-any": "off",
- "@typescript-eslint/no-namespace": "off",
- "no-self-assign": "off",
- "@typescript-eslint/adjacent-overload-signatures": "off",
- "@typescript-eslint/explicit-module-boundary-types": "off"
- }
- }
\ No newline at end of file
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 4865f80..9f7d1ad 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,30 +1,19 @@
-name: Node.js Package
+name: Publish Package to npmjs
on:
release:
- types: [created]
+ types: [published]
jobs:
build:
runs-on: ubuntu-latest
- permissions:
- contents: read
- packages: write
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
# Setup .npmrc file to publish to npm
- - uses: actions/setup-node@v2
+ - uses: actions/setup-node@v4
with:
- node-version: '14'
- registry-url: 'https://registry.npmjs.org'
- - run: npm install
- # - run: npm publish --access public
- # env:
- # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- # # Setup .npmrc file to publish to GitHub Packages
- # - uses: actions/setup-node@v2
- # with:
- # registry-url: 'https://npm.pkg.github.com'
- # scope: '@getbrevo'
- # # Publish to GitHub Packages
- # - run: npm publish
- # env:
- # NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ node-version: "20.x"
+ registry-url: "https://registry.npmjs.org"
+ scope: "@getbrevo"
+ - run: yarn install --frozen-lockfile
+ - run: yarn publish --access public
+ env:
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000..c31c7ca
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,29 @@
+name: Test
+on:
+ pull_request:
+ branches:
+ - "*"
+ push:
+ branches:
+ - main
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - name: Install Node
+ uses: actions/setup-node@v4
+ with:
+ node-version: 20.12.0
+ - name: Install dependencies
+ run: yarn install
+ - name: Generate API file
+ run: yarn generate
+ - name: Check generated files match
+ uses: tj-actions/verify-changed-files@v19
+ with:
+ files: |
+ src/Brevo.ts
+ fail-if-changed: true
+ fail-message: "Generate API file is different to the committed one. Please run `yarn generate` and commit the changes."
diff --git a/.gitignore b/.gitignore
index 149b576..6c6aa21 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ wwwroot/*.js
node_modules
typings
dist
+.DS_Store
diff --git a/.npmignore b/.npmignore
new file mode 100644
index 0000000..26f5c15
--- /dev/null
+++ b/.npmignore
@@ -0,0 +1 @@
+.github
diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore
deleted file mode 100644
index c5fa491..0000000
--- a/.openapi-generator-ignore
+++ /dev/null
@@ -1,23 +0,0 @@
-# Swagger Codegen Ignore
-# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
-
-# Use this file to prevent files from being overwritten by the generator.
-# The patterns follow closely to .gitignore or .dockerignore.
-
-# As an example, the C# client generator defines ApiClient.cs.
-# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
-#ApiClient.cs
-
-# You can match any string of characters against a directory, file or extension with a single asterisk (*):
-#foo/*/qux
-# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
-
-# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
-#foo/**/qux
-# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
-
-# You can also negate patterns with an exclamation (!).
-# For example, you can ignore all files in a docs folder with the file extension .md:
-#docs/*.md
-# Then explicitly reverse the ignore rule for a single file:
-#!docs/README.md
diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES
deleted file mode 100644
index 6f01056..0000000
--- a/.openapi-generator/FILES
+++ /dev/null
@@ -1,408 +0,0 @@
-.gitignore
-api.ts
-api/accountApi.ts
-api/apis.ts
-api/companiesApi.ts
-api/contactsApi.ts
-api/conversationsApi.ts
-api/couponsApi.ts
-api/dealsApi.ts
-api/domainsApi.ts
-api/ecommerceApi.ts
-api/emailCampaignsApi.ts
-api/eventsApi.ts
-api/externalFeedsApi.ts
-api/filesApi.ts
-api/inboundParsingApi.ts
-api/masterAccountApi.ts
-api/notesApi.ts
-api/paymentsApi.ts
-api/processApi.ts
-api/resellerApi.ts
-api/sMSCampaignsApi.ts
-api/sendersApi.ts
-api/tasksApi.ts
-api/transactionalEmailsApi.ts
-api/transactionalSMSApi.ts
-api/transactionalWhatsAppApi.ts
-api/userApi.ts
-api/webhooksApi.ts
-api/whatsAppCampaignsApi.ts
-git_push.sh
-model/abTestCampaignResult.ts
-model/abTestCampaignResultClickedLinks.ts
-model/abTestCampaignResultStatistics.ts
-model/abTestVersionClicksInner.ts
-model/abTestVersionStats.ts
-model/addChildDomain.ts
-model/addContactToList.ts
-model/addCredits.ts
-model/authenticateDomainModel.ts
-model/blockDomain.ts
-model/cart.ts
-model/companiesIdPatchRequest.ts
-model/companiesLinkUnlinkIdPatchRequest.ts
-model/companiesList.ts
-model/companiesPost200Response.ts
-model/companiesPostRequest.ts
-model/company.ts
-model/companyAttributesInner.ts
-model/componentItems.ts
-model/configuration.ts
-model/conversationsAgentOnlinePingPostRequest.ts
-model/conversationsMessage.ts
-model/conversationsMessageFile.ts
-model/conversationsMessageFileImageInfo.ts
-model/conversationsMessagesIdPutRequest.ts
-model/conversationsMessagesPostRequest.ts
-model/conversationsPushedMessagesIdPutRequest.ts
-model/conversationsPushedMessagesPostRequest.ts
-model/conversionSourceMetrics.ts
-model/conversionSourceProduct.ts
-model/corporateGroupDetailsResponse.ts
-model/corporateGroupDetailsResponseGroup.ts
-model/corporateGroupDetailsResponseSubAccountsInner.ts
-model/corporateGroupDetailsResponseUsersInner.ts
-model/corporateGroupPost201Response.ts
-model/corporateGroupPostRequest.ts
-model/corporateGroupUnlinkGroupIdSubAccountsPutRequest.ts
-model/corporateSubAccountIpAssociatePostRequest.ts
-model/corporateSubAccountIpDissociatePutRequest.ts
-model/corporateUserInvitationActionEmailPut200Response.ts
-model/createApiKeyRequest.ts
-model/createApiKeyResponse.ts
-model/createAttribute.ts
-model/createAttributeEnumerationInner.ts
-model/createCategoryModel.ts
-model/createChild.ts
-model/createContact.ts
-model/createCouponCollection201Response.ts
-model/createCouponCollectionRequest.ts
-model/createCouponsRequest.ts
-model/createDoiContact.ts
-model/createDomain.ts
-model/createDomainModel.ts
-model/createDomainModelDnsRecords.ts
-model/createDomainModelDnsRecordsDkimRecord.ts
-model/createEmailCampaign.ts
-model/createEmailCampaignRecipients.ts
-model/createEmailCampaignSender.ts
-model/createExternalFeed.ts
-model/createExternalFeed201Response.ts
-model/createList.ts
-model/createModel.ts
-model/createPaymentRequest.ts
-model/createPaymentResponse.ts
-model/createProductModel.ts
-model/createReseller.ts
-model/createSender.ts
-model/createSenderIpsInner.ts
-model/createSenderModel.ts
-model/createSmsCampaign.ts
-model/createSmsCampaignRecipients.ts
-model/createSmtpEmail.ts
-model/createSmtpTemplate.ts
-model/createSmtpTemplateSender.ts
-model/createSubAccount.ts
-model/createSubAccountResponse.ts
-model/createUpdateBatchCategory.ts
-model/createUpdateBatchCategoryModel.ts
-model/createUpdateBatchProducts.ts
-model/createUpdateBatchProductsModel.ts
-model/createUpdateCategories.ts
-model/createUpdateCategory.ts
-model/createUpdateContactModel.ts
-model/createUpdateFolder.ts
-model/createUpdateProduct.ts
-model/createUpdateProducts.ts
-model/createWebhook.ts
-model/createWhatsAppCampaign.ts
-model/createWhatsAppCampaignRecipients.ts
-model/createWhatsAppTemplate.ts
-model/createdBatchId.ts
-model/createdProcessId.ts
-model/crmDealsIdPatchRequest.ts
-model/crmDealsLinkUnlinkIdPatchRequest.ts
-model/crmDealsPost201Response.ts
-model/crmDealsPostRequest.ts
-model/crmTasksIdPatchRequest.ts
-model/crmTasksPost201Response.ts
-model/crmTasksPostRequest.ts
-model/deal.ts
-model/dealAttributesInner.ts
-model/dealsList.ts
-model/deleteHardbounces.ts
-model/ecommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response.ts
-model/ecommerceAttributionMetricsGet200Response.ts
-model/ecommerceAttributionMetricsGet200ResponseTotals.ts
-model/ecommerceAttributionProductsConversionSourceConversionSourceIdGet200Response.ts
-model/ecommerceConfigDisplayCurrencyGet200Response.ts
-model/emailExportRecipients.ts
-model/errorModel.ts
-model/event.ts
-model/eventIdentifiers.ts
-model/exportWebhooksHistory.ts
-model/fileData.ts
-model/fileDownloadableLink.ts
-model/getAccount.ts
-model/getAccountActivity.ts
-model/getAccountActivityLogsInner.ts
-model/getAccountAllOfMarketingAutomation.ts
-model/getAccountAllOfPlan.ts
-model/getAccountAllOfRelay.ts
-model/getAccountAllOfRelayData.ts
-model/getAggregatedReport.ts
-model/getAllExternalFeeds.ts
-model/getAllExternalFeedsFeedsInner.ts
-model/getAttributes.ts
-model/getAttributesAttributesInner.ts
-model/getAttributesAttributesInnerEnumerationInner.ts
-model/getBlockedDomains.ts
-model/getCampaignOverview.ts
-model/getCampaignRecipients.ts
-model/getCampaignStats.ts
-model/getCategories.ts
-model/getCategoryDetails.ts
-model/getChildAccountCreationStatus.ts
-model/getChildDomain.ts
-model/getChildInfo.ts
-model/getChildInfoAllOfApiKeys.ts
-model/getChildInfoAllOfApiKeysV2.ts
-model/getChildInfoAllOfApiKeysV3.ts
-model/getChildInfoAllOfCredits.ts
-model/getChildInfoAllOfStatistics.ts
-model/getChildrenList.ts
-model/getChildrenListChildrenInner.ts
-model/getClient.ts
-model/getContactCampaignStats.ts
-model/getContactCampaignStatsClickedInner.ts
-model/getContactCampaignStatsClickedInnerLinksInner.ts
-model/getContactCampaignStatsMessagesSentInner.ts
-model/getContactCampaignStatsOpenedInner.ts
-model/getContactCampaignStatsTransacAttributesInner.ts
-model/getContactCampaignStatsUnsubscriptions.ts
-model/getContactCampaignStatsUnsubscriptionsAdminUnsubscriptionInner.ts
-model/getContactCampaignStatsUnsubscriptionsUserUnsubscriptionInner.ts
-model/getContactDetails.ts
-model/getContacts.ts
-model/getCorporateInvitedUsersList.ts
-model/getCorporateInvitedUsersListUsersInner.ts
-model/getCorporateInvitedUsersListUsersInnerFeatureAccess.ts
-model/getCorporateInvitedUsersListUsersInnerGroups.ts
-model/getCorporateUserPermission.ts
-model/getCorporateUserPermissionFeatureAccess.ts
-model/getCorporateUserPermissionGroupsInner.ts
-model/getCouponCollection.ts
-model/getDeviceBrowserStats.ts
-model/getDomainConfigurationModel.ts
-model/getDomainsList.ts
-model/getDomainsListDomainsInner.ts
-model/getEmailCampaign.ts
-model/getEmailCampaigns.ts
-model/getEmailCampaignsCampaignsInner.ts
-model/getEmailEventReport.ts
-model/getEmailEventReportEventsInner.ts
-model/getExtendedCampaignOverview.ts
-model/getExtendedCampaignOverviewAllOfSender.ts
-model/getExtendedCampaignStats.ts
-model/getExtendedClient.ts
-model/getExtendedClientAllOfAddress.ts
-model/getExtendedContactDetails.ts
-model/getExtendedContactDetailsAllOfStatistics.ts
-model/getExtendedContactDetailsAllOfStatisticsClicked.ts
-model/getExtendedContactDetailsAllOfStatisticsLinks.ts
-model/getExtendedContactDetailsAllOfStatisticsMessagesSent.ts
-model/getExtendedContactDetailsAllOfStatisticsOpened.ts
-model/getExtendedContactDetailsAllOfStatisticsUnsubscriptions.ts
-model/getExtendedContactDetailsAllOfStatisticsUnsubscriptionsAdminUnsubscription.ts
-model/getExtendedContactDetailsAllOfStatisticsUnsubscriptionsUserUnsubscription.ts
-model/getExtendedList.ts
-model/getExtendedListAllOfCampaignStats.ts
-model/getExternalFeedByUUID.ts
-model/getExternalFeedByUUIDHeadersInner.ts
-model/getFolder.ts
-model/getFolderLists.ts
-model/getFolders.ts
-model/getInboundEmailEvents.ts
-model/getInboundEmailEventsByUuid.ts
-model/getInboundEmailEventsByUuidAttachmentsInner.ts
-model/getInboundEmailEventsByUuidLogsInner.ts
-model/getInboundEmailEventsEventsInner.ts
-model/getInvitedUsersList.ts
-model/getInvitedUsersListUsersInner.ts
-model/getInvitedUsersListUsersInnerFeatureAccess.ts
-model/getIp.ts
-model/getIpFromSender.ts
-model/getIps.ts
-model/getIpsFromSender.ts
-model/getList.ts
-model/getLists.ts
-model/getListsListsInner.ts
-model/getOrders.ts
-model/getOrdersOrdersInner.ts
-model/getPaymentRequest.ts
-model/getProcess.ts
-model/getProcesses.ts
-model/getProductDetails.ts
-model/getProducts.ts
-model/getReports.ts
-model/getReportsReportsInner.ts
-model/getScheduledEmailByBatchId.ts
-model/getScheduledEmailByBatchIdBatchesInner.ts
-model/getScheduledEmailByMessageId.ts
-model/getSegments.ts
-model/getSegmentsSegments.ts
-model/getSendersList.ts
-model/getSendersListSendersInner.ts
-model/getSendersListSendersInnerIpsInner.ts
-model/getSharedTemplateUrl.ts
-model/getSmsCampaign.ts
-model/getSmsCampaignOverview.ts
-model/getSmsCampaignStats.ts
-model/getSmsCampaigns.ts
-model/getSmsCampaignsCampaignsInner.ts
-model/getSmsEventReport.ts
-model/getSmsEventReportEventsInner.ts
-model/getSmtpTemplateOverview.ts
-model/getSmtpTemplateOverviewSender.ts
-model/getSmtpTemplates.ts
-model/getSsoToken.ts
-model/getStatsByDevice.ts
-model/getSubAccountGroups200ResponseInner.ts
-model/getTransacAggregatedSmsReport.ts
-model/getTransacBlockedContacts.ts
-model/getTransacBlockedContactsContactsInner.ts
-model/getTransacBlockedContactsContactsInnerReason.ts
-model/getTransacEmailContent.ts
-model/getTransacEmailContentEventsInner.ts
-model/getTransacEmailsList.ts
-model/getTransacEmailsListTransactionalEmailsInner.ts
-model/getTransacSmsReport.ts
-model/getTransacSmsReportReportsInner.ts
-model/getUserPermission.ts
-model/getUserPermissionPrivilegesInner.ts
-model/getWATemplates.ts
-model/getWATemplatesTemplatesInner.ts
-model/getWebhook.ts
-model/getWebhookAuth.ts
-model/getWebhookHeadersInner.ts
-model/getWebhooks.ts
-model/getWhatsAppConfig.ts
-model/getWhatsappCampaignOverview.ts
-model/getWhatsappCampaigns.ts
-model/getWhatsappCampaignsCampaignsInner.ts
-model/getWhatsappEventReport.ts
-model/getWhatsappEventReportEventsInner.ts
-model/inviteAdminUser.ts
-model/inviteAdminUserPrivilegesInner.ts
-model/inviteuser.ts
-model/inviteuserPrivilegesInner.ts
-model/manageIp.ts
-model/masterDetailsResponse.ts
-model/masterDetailsResponseBillingInfo.ts
-model/masterDetailsResponseBillingInfoAddress.ts
-model/masterDetailsResponseBillingInfoName.ts
-model/masterDetailsResponsePlanInfo.ts
-model/masterDetailsResponsePlanInfoFeaturesInner.ts
-model/models.ts
-model/note.ts
-model/noteData.ts
-model/noteId.ts
-model/notification.ts
-model/order.ts
-model/orderBatch.ts
-model/orderBilling.ts
-model/orderProductsInner.ts
-model/otp.ts
-model/pipeline.ts
-model/pipelineStage.ts
-model/postContactInfo.ts
-model/postContactInfoContacts.ts
-model/postSendFailed.ts
-model/postSendSmsTestFailed.ts
-model/putRevokeUserPermission.ts
-model/putresendcancelinvitation.ts
-model/remainingCreditModel.ts
-model/remainingCreditModelChild.ts
-model/remainingCreditModelReseller.ts
-model/removeContactFromList.ts
-model/removeCredits.ts
-model/requestContactExport.ts
-model/requestContactExportCustomContactFilter.ts
-model/requestContactImport.ts
-model/requestContactImportJsonBodyInner.ts
-model/requestContactImportNewList.ts
-model/requestSmsRecipientExport.ts
-model/scheduleSmtpEmail.ts
-model/sendReport.ts
-model/sendReportEmail.ts
-model/sendSms.ts
-model/sendSmtpEmail.ts
-model/sendSmtpEmailAttachmentInner.ts
-model/sendSmtpEmailBccInner.ts
-model/sendSmtpEmailCcInner.ts
-model/sendSmtpEmailMessageVersionsInner.ts
-model/sendSmtpEmailMessageVersionsInnerReplyTo.ts
-model/sendSmtpEmailMessageVersionsInnerToInner.ts
-model/sendSmtpEmailReplyTo.ts
-model/sendSmtpEmailSender.ts
-model/sendSmtpEmailToInner.ts
-model/sendTestEmail.ts
-model/sendTestSms.ts
-model/sendTransacSms.ts
-model/sendWhatsappMessage.ts
-model/sendWhatsappMessage201Response.ts
-model/ssoTokenRequest.ts
-model/ssoTokenRequestCorporate.ts
-model/subAccountAppsToggleRequest.ts
-model/subAccountDetailsResponse.ts
-model/subAccountDetailsResponseGroupsInner.ts
-model/subAccountDetailsResponsePlanInfo.ts
-model/subAccountDetailsResponsePlanInfoCredits.ts
-model/subAccountDetailsResponsePlanInfoCreditsEmails.ts
-model/subAccountDetailsResponsePlanInfoCreditsSms.ts
-model/subAccountDetailsResponsePlanInfoCreditsWpSubscribers.ts
-model/subAccountDetailsResponsePlanInfoFeatures.ts
-model/subAccountDetailsResponsePlanInfoFeaturesInbox.ts
-model/subAccountDetailsResponsePlanInfoFeaturesLandingPage.ts
-model/subAccountDetailsResponsePlanInfoFeaturesUsers.ts
-model/subAccountUpdatePlanRequest.ts
-model/subAccountUpdatePlanRequestCredits.ts
-model/subAccountUpdatePlanRequestFeatures.ts
-model/subAccountsResponse.ts
-model/subAccountsResponseSubAccountsInner.ts
-model/subAccountsResponseSubAccountsInnerGroupsInner.ts
-model/task.ts
-model/taskList.ts
-model/taskReminder.ts
-model/taskTypes.ts
-model/updateAttribute.ts
-model/updateAttributeEnumerationInner.ts
-model/updateBatchContacts.ts
-model/updateBatchContactsContactsInner.ts
-model/updateBatchContactsModel.ts
-model/updateCampaignStatus.ts
-model/updateChild.ts
-model/updateChildAccountStatus.ts
-model/updateChildDomain.ts
-model/updateContact.ts
-model/updateCouponCollection200Response.ts
-model/updateCouponCollectionRequest.ts
-model/updateEmailCampaign.ts
-model/updateEmailCampaignRecipients.ts
-model/updateEmailCampaignSender.ts
-model/updateExternalFeed.ts
-model/updateList.ts
-model/updateSender.ts
-model/updateSmsCampaign.ts
-model/updateSmtpTemplate.ts
-model/updateSmtpTemplateSender.ts
-model/updateWebhook.ts
-model/updateWhatsAppCampaign.ts
-model/uploadImageModel.ts
-model/uploadImageToGallery.ts
-model/variablesItems.ts
-model/whatsappCampStats.ts
-model/whatsappCampTemplate.ts
-package.json
-tsconfig.json
diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION
deleted file mode 100644
index 3769235..0000000
--- a/.openapi-generator/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-7.1.0
\ No newline at end of file
diff --git a/.swagger-codegen/VERSION b/.swagger-codegen/VERSION
deleted file mode 100644
index b0bea14..0000000
--- a/.swagger-codegen/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-2.4.32
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..2c951c3
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,29 @@
+# Contributing
+
+## Install and Setup
+
+1. Clone the repository
+2. Install dependencies with `yarn install`
+
+## Updating the API based on Swagger Spec
+
+1. Run `yarn generate` to update the `Brevo.ts` file.
+2. Commit the changes
+
+## Testing
+
+There are automated tests that check that the generated file matches the current latest version of the API.
+
+As the tests are dependant on the external swagger api spec they could fail on a future run with no code changes. If this happens you can run `yarn generate` to update the generated file to the latest version of the API.
+
+## Publishing
+
+The repo is setup to auto publish to npm when a release is created.
+
+> Prerequisites:
+>
+> Add `NPM_TOKEN` to your github secrets with your npm token. The token needs to have `Read/Write` access to the package, scope, or all packages.
+
+1. Update the version in `package.json`
+2. Create a new release in github and publish
+3. A build will automatically run and publish the new version to npm
diff --git a/README.md b/README.md
index e33c5d9..844a4f4 100644
--- a/README.md
+++ b/README.md
@@ -26,131 +26,64 @@ yarn add @getbrevo/brevo
## Getting Started
+```ts
+import BrevoApi from "@getbrevo/brevo";
-
-# We have two options:
-- First example is where **typescript is not supported** i.e. [v1.0.1]([url](https://www.npmjs.com/package/@getbrevo/brevo/v/1.0.1))
-- Second example is where **typescript is supported** i.e. [v2.1.1]([url](https://www.npmjs.com/package/@getbrevo/brevo/v/2.1.1))
-
-
-```shell
--------------------------------------------------------------------------------------------------------------------------
----------------------------------------------- Typescript not supported v1.0.1 ---------------------------------------
--------------------------------------------------------------------------------------------------------------------------
-const brevo = require('@getbrevo/brevo');
-let defaultClient = brevo.ApiClient.instance;
-
-let apiKey = defaultClient.authentications['apiKey'];
-apiKey.apiKey = 'YOUR API KEY';
-
-let apiInstance = new brevo.TransactionalEmailsApi();
-let sendSmtpEmail = new brevo.SendSmtpEmail();
-
-sendSmtpEmail.subject = "My {{params.subject}}";
-sendSmtpEmail.htmlContent = "
Common: This is my first transactional email {{params.parameter}}
";
-sendSmtpEmail.sender = { "name": "John", "email": "example@example.com" };
-sendSmtpEmail.to = [
- { "email": "example@brevo.com", "name": "sample-name" }
-];
-sendSmtpEmail.replyTo = { "email": "example@brevo.com", "name": "sample-name" };
-sendSmtpEmail.headers = { "Some-Custom-Name": "unique-id-1234" };
-sendSmtpEmail.params = { "parameter": "My param value", "subject": "common subject" };
-
-
-apiInstance.sendTransacEmail(sendSmtpEmail).then(function (data) {
- console.log('API called successfully. Returned data: ' + JSON.stringify(data));
-}, function (error) {
- console.error(error);
+const brevo = new BrevoApi({
+ headers: {
+ "api-key": "YOUR_API_KEY",
+ },
});
+brevo.account
+ .getAccount()
+ .then((data) => {
+ console.log(
+ "API called successfully. Returned data: " + JSON.stringify(data)
+ );
+ })
+ .catch((error) => {
+ console.error(error);
+ });
```
--------------------------------------------------------------------------------------------------------------------------
-## Typescript supported with version v2.1.1
-```shell
--------------------------------------------------------------------------------------------------------------------------
----------------------------------------------- Typescript supported with v2.1.1 --------------------------------------
--------------------------------------------------------------------------------------------------------------------------
-const brevo = require('@getbrevo/brevo');
-let apiInstance = new brevo.TransactionalEmailsApi();
-
-let apiKey = apiInstance.authentications['apiKey'];
-apiKey.apiKey = 'YOUR API KEY';
-
-let sendSmtpEmail = new brevo.SendSmtpEmail();
-
-sendSmtpEmail.subject = "My {{params.subject}}";
-sendSmtpEmail.htmlContent = "Common: This is my first transactional email {{params.parameter}}
";
-sendSmtpEmail.sender = { "name": "John", "email": "shubham.upadhyay@sendinblue.com" };
-sendSmtpEmail.to = [
- { "email": "shubham.upadhyay@sendinblue.com", "name": "shubham upadhyay" }
-];
-sendSmtpEmail.replyTo = { "email": "shubham.upadhyay@sendinblue.com", "name": "Shubham Upadhyay" };
-sendSmtpEmail.headers = { "Some-Custom-Name": "unique-id-1234" };
-sendSmtpEmail.params = { "parameter": "My param value", "subject": "common subject" };
-
-
-apiInstance.sendTransacEmail(sendSmtpEmail).then(function (data) {
- console.log('API called successfully. Returned data: ' + JSON.stringify(data));
-}, function (error) {
- console.error(error);
-});
-
-```
--------------------------------------------------------------------------------------------------------------------------
-## Get Contact attributes API example:
+```ts
+import BrevoApi from "@getbrevo/brevo";
-```shell
-const brevo = require('@getbrevo/brevo');
-
-let apiInstance = new brevo.ContactsApi()
-
-let apiKey = apiInstance.authentications['apiKey'];
-apiKey.apiKey = 'YOUR API KEY';
-
-apiInstance.getAttributes().then(function(data) {
- console.log('API called successfully. Returned data: ' + JSON.stringify(data));
-
-}, function(error) {
- console.error(error);
+const brevo = new BrevoApi({
+ headers: {
+ "api-key": "YOUR_API_KEY",
+ },
});
+brevo.smtp
+ .sendTransacEmail({
+ subject: "My {{params.subject}}",
+ htmlContent:
+ "This is my first transactional email {{params.parameter}}
",
+ sender: {
+ name: "John Doe",
+ email: "example@example.com",
+ },
+ to: [{ email: "example@example.com", name: "Jane Doe" }],
+ cc: [{ email: "example2@example2.com", name: "Janice Doe" }],
+ bcc: [{ email: "example@example.com", name: "John Doe" }],
+ replyTo: { email: "replyto@domain.com", name: "John Doe" },
+ headers: { "Some-Custom-Name": "unique-id-1234" },
+ params: { parameter: "My param value", subject: "New Subject" },
+ })
+ .then((data) => {
+ console.log(
+ "API called successfully. Returned data: " + JSON.stringify(data)
+ );
+ })
+ .catch((error) => {
+ console.error(error);
+ });
```
--------------------------------------------------------------------------------------------------------------------------
-## Get Account API example:
-
-```shell
-const brevo = require('@getbrevo/brevo');
-let apiInstance = new brevo.AccountApi()
-
-let apiKey = apiInstance.authentications['apiKey'];
-apiKey.apiKey = 'YOUR API KEY';
-
-apiInstance.getAccount().then(function(data) {
- console.log('API called successfully. Returned data: ' + JSON.stringify(data));
-
-}, function(error) {
- console.error(error);
-});
-
-```
--------------------------------------------------------------------------------------------------------------------------
-## Get Contacts API example:
-```shell
-const brevo = require('@getbrevo/brevo');
-
-let apiInstance = new brevo.ContactsApi()
-
-let apiKey = apiInstance.authentications['apiKey'];
-apiKey.apiKey = 'YOUR API KEY';
+For more examples, refer the [Endpoints Guide](https://developers.brevo.com/reference)
-apiInstance.getContacts().then(function(data) {
- console.log('API called successfully. Returned data: ' + JSON.stringify(data));
+## Contributing
-}, function(error) {
- console.error(error);
-});
-```
-
-For more examples, refer the [Endpoints Guide](https://developers.brevo.com/reference)
+Please refer to the [CONTRIBUTING](CONTRIBUTING.md) file.
diff --git a/api.ts b/api.ts
deleted file mode 100644
index b1119f1..0000000
--- a/api.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-// This is the entrypoint for the package
-export * from './api/apis';
-export * from './model/models';
diff --git a/api/accountApi.ts b/api/accountApi.ts
deleted file mode 100644
index f82689c..0000000
--- a/api/accountApi.ts
+++ /dev/null
@@ -1,252 +0,0 @@
-/**
- * Brevo API
- * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity |
- *
- * The version of the OpenAPI document: 3.0.0
- * Contact: contact@brevo.com
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
-
-
-import localVarRequest from 'request';
-import http from 'http';
-
-/* tslint:disable:no-unused-locals */
-import { ErrorModel } from '../model/errorModel';
-import { GetAccount } from '../model/getAccount';
-import { GetAccountActivity } from '../model/getAccountActivity';
-
-import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
-import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
-
-import { HttpError, RequestFile } from './apis';
-
-let defaultBasePath = 'https://api.brevo.com/v3';
-
-// ===============================================
-// This file is autogenerated - Please do not edit
-// ===============================================
-
-export enum AccountApiApiKeys {
- apiKey,
- partnerKey,
-}
-
-export class AccountApi {
- protected _basePath = defaultBasePath;
- protected _defaultHeaders : any = {};
- protected _useQuerystring : boolean = false;
-
- protected authentications = {
- 'default': new VoidAuth(),
- 'apiKey': new ApiKeyAuth('header', 'api-key'),
- 'partnerKey': new ApiKeyAuth('header', 'partner-key'),
- }
-
- protected interceptors: Interceptor[] = [];
-
- constructor(basePath?: string);
- constructor(basePathOrUsername: string, password?: string, basePath?: string) {
- if (password) {
- if (basePath) {
- this.basePath = basePath;
- }
- } else {
- if (basePathOrUsername) {
- this.basePath = basePathOrUsername
- }
- }
- }
-
- set useQuerystring(value: boolean) {
- this._useQuerystring = value;
- }
-
- set basePath(basePath: string) {
- this._basePath = basePath;
- }
-
- set defaultHeaders(defaultHeaders: any) {
- this._defaultHeaders = defaultHeaders;
- }
-
- get defaultHeaders() {
- return this._defaultHeaders;
- }
-
- get basePath() {
- return this._basePath;
- }
-
- public setDefaultAuthentication(auth: Authentication) {
- this.authentications.default = auth;
- }
-
- public setApiKey(key: AccountApiApiKeys, value: string) {
- (this.authentications as any)[AccountApiApiKeys[key]].apiKey = value;
- }
-
- public addInterceptor(interceptor: Interceptor) {
- this.interceptors.push(interceptor);
- }
-
- /**
- *
- * @summary Get your account information, plan and credits details
- */
- public async getAccount (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetAccount; }> {
- const localVarPath = this.basePath + '/account';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: GetAccount; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "GetAccount");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get user activity logs
- * @param startDate Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search.
- * @param endDate Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month.
- * @param limit Number of documents per page
- * @param offset Index of the first document in the page.
- */
- public async getAccountActivity (startDate?: string, endDate?: string, limit?: number, offset?: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetAccountActivity; }> {
- const localVarPath = this.basePath + '/organization/activities';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- if (startDate !== undefined) {
- localVarQueryParameters['startDate'] = ObjectSerializer.serialize(startDate, "string");
- }
-
- if (endDate !== undefined) {
- localVarQueryParameters['endDate'] = ObjectSerializer.serialize(endDate, "string");
- }
-
- if (limit !== undefined) {
- localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
- }
-
- if (offset !== undefined) {
- localVarQueryParameters['offset'] = ObjectSerializer.serialize(offset, "number");
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: GetAccountActivity; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "GetAccountActivity");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
-}
diff --git a/api/apis.ts b/api/apis.ts
deleted file mode 100644
index f621d6a..0000000
--- a/api/apis.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-export * from './accountApi';
-import { AccountApi } from './accountApi';
-export * from './companiesApi';
-import { CompaniesApi } from './companiesApi';
-export * from './contactsApi';
-import { ContactsApi } from './contactsApi';
-export * from './conversationsApi';
-import { ConversationsApi } from './conversationsApi';
-export * from './couponsApi';
-import { CouponsApi } from './couponsApi';
-export * from './dealsApi';
-import { DealsApi } from './dealsApi';
-export * from './domainsApi';
-import { DomainsApi } from './domainsApi';
-export * from './ecommerceApi';
-import { EcommerceApi } from './ecommerceApi';
-export * from './emailCampaignsApi';
-import { EmailCampaignsApi } from './emailCampaignsApi';
-export * from './eventsApi';
-import { EventsApi } from './eventsApi';
-export * from './externalFeedsApi';
-import { ExternalFeedsApi } from './externalFeedsApi';
-export * from './filesApi';
-import { FilesApi } from './filesApi';
-export * from './inboundParsingApi';
-import { InboundParsingApi } from './inboundParsingApi';
-export * from './masterAccountApi';
-import { MasterAccountApi } from './masterAccountApi';
-export * from './notesApi';
-import { NotesApi } from './notesApi';
-export * from './paymentsApi';
-import { PaymentsApi } from './paymentsApi';
-export * from './processApi';
-import { ProcessApi } from './processApi';
-export * from './resellerApi';
-import { ResellerApi } from './resellerApi';
-export * from './sMSCampaignsApi';
-import { SMSCampaignsApi } from './sMSCampaignsApi';
-export * from './sendersApi';
-import { SendersApi } from './sendersApi';
-export * from './tasksApi';
-import { TasksApi } from './tasksApi';
-export * from './transactionalEmailsApi';
-import { TransactionalEmailsApi } from './transactionalEmailsApi';
-export * from './transactionalSMSApi';
-import { TransactionalSMSApi } from './transactionalSMSApi';
-export * from './transactionalWhatsAppApi';
-import { TransactionalWhatsAppApi } from './transactionalWhatsAppApi';
-export * from './userApi';
-import { UserApi } from './userApi';
-export * from './webhooksApi';
-import { WebhooksApi } from './webhooksApi';
-export * from './whatsAppCampaignsApi';
-import { WhatsAppCampaignsApi } from './whatsAppCampaignsApi';
-import * as http from 'http';
-
-export class HttpError extends Error {
- constructor (public response: http.IncomingMessage, public body: any, public statusCode?: number) {
- super('HTTP request failed');
- this.name = 'HttpError';
- }
-}
-
-export { RequestFile } from '../model/models';
-
-export const APIS = [AccountApi, CompaniesApi, ContactsApi, ConversationsApi, CouponsApi, DealsApi, DomainsApi, EcommerceApi, EmailCampaignsApi, EventsApi, ExternalFeedsApi, FilesApi, InboundParsingApi, MasterAccountApi, NotesApi, PaymentsApi, ProcessApi, ResellerApi, SMSCampaignsApi, SendersApi, TasksApi, TransactionalEmailsApi, TransactionalSMSApi, TransactionalWhatsAppApi, UserApi, WebhooksApi, WhatsAppCampaignsApi];
diff --git a/api/companiesApi.ts b/api/companiesApi.ts
deleted file mode 100644
index 4127080..0000000
--- a/api/companiesApi.ts
+++ /dev/null
@@ -1,659 +0,0 @@
-/**
- * Brevo API
- * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity |
- *
- * The version of the OpenAPI document: 3.0.0
- * Contact: contact@brevo.com
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
-
-
-import localVarRequest from 'request';
-import http from 'http';
-
-/* tslint:disable:no-unused-locals */
-import { CompaniesIdPatchRequest } from '../model/companiesIdPatchRequest';
-import { CompaniesLinkUnlinkIdPatchRequest } from '../model/companiesLinkUnlinkIdPatchRequest';
-import { CompaniesList } from '../model/companiesList';
-import { CompaniesPost200Response } from '../model/companiesPost200Response';
-import { CompaniesPostRequest } from '../model/companiesPostRequest';
-import { Company } from '../model/company';
-import { CompanyAttributesInner } from '../model/companyAttributesInner';
-import { ErrorModel } from '../model/errorModel';
-
-import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
-import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
-
-import { HttpError, RequestFile } from './apis';
-
-let defaultBasePath = 'https://api.brevo.com/v3';
-
-// ===============================================
-// This file is autogenerated - Please do not edit
-// ===============================================
-
-export enum CompaniesApiApiKeys {
- apiKey,
- partnerKey,
-}
-
-export class CompaniesApi {
- protected _basePath = defaultBasePath;
- protected _defaultHeaders : any = {};
- protected _useQuerystring : boolean = false;
-
- protected authentications = {
- 'default': new VoidAuth(),
- 'apiKey': new ApiKeyAuth('header', 'api-key'),
- 'partnerKey': new ApiKeyAuth('header', 'partner-key'),
- }
-
- protected interceptors: Interceptor[] = [];
-
- constructor(basePath?: string);
- constructor(basePathOrUsername: string, password?: string, basePath?: string) {
- if (password) {
- if (basePath) {
- this.basePath = basePath;
- }
- } else {
- if (basePathOrUsername) {
- this.basePath = basePathOrUsername
- }
- }
- }
-
- set useQuerystring(value: boolean) {
- this._useQuerystring = value;
- }
-
- set basePath(basePath: string) {
- this._basePath = basePath;
- }
-
- set defaultHeaders(defaultHeaders: any) {
- this._defaultHeaders = defaultHeaders;
- }
-
- get defaultHeaders() {
- return this._defaultHeaders;
- }
-
- get basePath() {
- return this._basePath;
- }
-
- public setDefaultAuthentication(auth: Authentication) {
- this.authentications.default = auth;
- }
-
- public setApiKey(key: CompaniesApiApiKeys, value: string) {
- (this.authentications as any)[CompaniesApiApiKeys[key]].apiKey = value;
- }
-
- public addInterceptor(interceptor: Interceptor) {
- this.interceptors.push(interceptor);
- }
-
- /**
- *
- * @summary Get company attributes
- */
- public async companiesAttributesGet (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array; }> {
- const localVarPath = this.basePath + '/companies/attributes';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: Array; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "Array");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get all companies
- * @param filters Filter by attrbutes. If you have filter for owner on your side please send it as {\"attributes.owner\":\"5b1a17d914b73d35a76ca0c7\"}
- * @param linkedContactsIds Filter by linked contacts ids
- * @param linkedDealsIds Filter by linked deals ids
- * @param page Index of the first document of the page
- * @param limit Number of documents per page
- * @param sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed
- * @param sortBy The field used to sort field names.
- */
- public async companiesGet (filters?: string, linkedContactsIds?: number, linkedDealsIds?: string, page?: number, limit?: number, sort?: 'asc' | 'desc', sortBy?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: CompaniesList; }> {
- const localVarPath = this.basePath + '/companies';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json', 'response'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- if (filters !== undefined) {
- localVarQueryParameters['filters'] = ObjectSerializer.serialize(filters, "string");
- }
-
- if (linkedContactsIds !== undefined) {
- localVarQueryParameters['linkedContactsIds'] = ObjectSerializer.serialize(linkedContactsIds, "number");
- }
-
- if (linkedDealsIds !== undefined) {
- localVarQueryParameters['linkedDealsIds'] = ObjectSerializer.serialize(linkedDealsIds, "string");
- }
-
- if (page !== undefined) {
- localVarQueryParameters['page'] = ObjectSerializer.serialize(page, "number");
- }
-
- if (limit !== undefined) {
- localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
- }
-
- if (sort !== undefined) {
- localVarQueryParameters['sort'] = ObjectSerializer.serialize(sort, "'asc' | 'desc'");
- }
-
- if (sortBy !== undefined) {
- localVarQueryParameters['sortBy'] = ObjectSerializer.serialize(sortBy, "string");
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: CompaniesList; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "CompaniesList");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Delete a company
- * @param id
- */
- public async companiesIdDelete (id: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/companies/{id}'
- .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'id' is not null or undefined
- if (id === null || id === undefined) {
- throw new Error('Required parameter id was null or undefined when calling companiesIdDelete.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'DELETE',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get a company
- * @param id
- */
- public async companiesIdGet (id: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Company; }> {
- const localVarPath = this.basePath + '/companies/{id}'
- .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'id' is not null or undefined
- if (id === null || id === undefined) {
- throw new Error('Required parameter id was null or undefined when calling companiesIdGet.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: Company; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "Company");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Update a company
- * @param id
- * @param body Updated company details.
- */
- public async companiesIdPatch (id: string, body: CompaniesIdPatchRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Company; }> {
- const localVarPath = this.basePath + '/companies/{id}'
- .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'id' is not null or undefined
- if (id === null || id === undefined) {
- throw new Error('Required parameter id was null or undefined when calling companiesIdPatch.');
- }
-
- // verify required parameter 'body' is not null or undefined
- if (body === null || body === undefined) {
- throw new Error('Required parameter body was null or undefined when calling companiesIdPatch.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'PATCH',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(body, "CompaniesIdPatchRequest")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: Company; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "Company");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Link and Unlink company with contacts and deals
- * @param id
- * @param body Linked / Unlinked contacts and deals ids.
- */
- public async companiesLinkUnlinkIdPatch (id: string, body: CompaniesLinkUnlinkIdPatchRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/companies/link-unlink/{id}'
- .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json', 'response'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'id' is not null or undefined
- if (id === null || id === undefined) {
- throw new Error('Required parameter id was null or undefined when calling companiesLinkUnlinkIdPatch.');
- }
-
- // verify required parameter 'body' is not null or undefined
- if (body === null || body === undefined) {
- throw new Error('Required parameter body was null or undefined when calling companiesLinkUnlinkIdPatch.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'PATCH',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(body, "CompaniesLinkUnlinkIdPatchRequest")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Create a company
- * @param body Company create data.
- */
- public async companiesPost (body: CompaniesPostRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: CompaniesPost200Response; }> {
- const localVarPath = this.basePath + '/companies';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'body' is not null or undefined
- if (body === null || body === undefined) {
- throw new Error('Required parameter body was null or undefined when calling companiesPost.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(body, "CompaniesPostRequest")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: CompaniesPost200Response; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "CompaniesPost200Response");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
-}
diff --git a/api/contactsApi.ts b/api/contactsApi.ts
deleted file mode 100644
index c99e163..0000000
--- a/api/contactsApi.ts
+++ /dev/null
@@ -1,2490 +0,0 @@
-/**
- * Brevo API
- * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity |
- *
- * The version of the OpenAPI document: 3.0.0
- * Contact: contact@brevo.com
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
-
-
-import localVarRequest from 'request';
-import http from 'http';
-
-/* tslint:disable:no-unused-locals */
-import { AddContactToList } from '../model/addContactToList';
-import { CreateAttribute } from '../model/createAttribute';
-import { CreateContact } from '../model/createContact';
-import { CreateDoiContact } from '../model/createDoiContact';
-import { CreateList } from '../model/createList';
-import { CreateModel } from '../model/createModel';
-import { CreateUpdateContactModel } from '../model/createUpdateContactModel';
-import { CreateUpdateFolder } from '../model/createUpdateFolder';
-import { CreatedProcessId } from '../model/createdProcessId';
-import { ErrorModel } from '../model/errorModel';
-import { GetAttributes } from '../model/getAttributes';
-import { GetContactCampaignStats } from '../model/getContactCampaignStats';
-import { GetContacts } from '../model/getContacts';
-import { GetExtendedContactDetails } from '../model/getExtendedContactDetails';
-import { GetExtendedList } from '../model/getExtendedList';
-import { GetFolder } from '../model/getFolder';
-import { GetFolderLists } from '../model/getFolderLists';
-import { GetFolders } from '../model/getFolders';
-import { GetLists } from '../model/getLists';
-import { GetSegments } from '../model/getSegments';
-import { PostContactInfo } from '../model/postContactInfo';
-import { RemoveContactFromList } from '../model/removeContactFromList';
-import { RequestContactExport } from '../model/requestContactExport';
-import { RequestContactImport } from '../model/requestContactImport';
-import { UpdateAttribute } from '../model/updateAttribute';
-import { UpdateBatchContacts } from '../model/updateBatchContacts';
-import { UpdateContact } from '../model/updateContact';
-import { UpdateList } from '../model/updateList';
-
-import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
-import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
-
-import { HttpError, RequestFile } from './apis';
-
-let defaultBasePath = 'https://api.brevo.com/v3';
-
-// ===============================================
-// This file is autogenerated - Please do not edit
-// ===============================================
-
-export enum ContactsApiApiKeys {
- apiKey,
- partnerKey,
-}
-
-export class ContactsApi {
- protected _basePath = defaultBasePath;
- protected _defaultHeaders : any = {};
- protected _useQuerystring : boolean = false;
-
- protected authentications = {
- 'default': new VoidAuth(),
- 'apiKey': new ApiKeyAuth('header', 'api-key'),
- 'partnerKey': new ApiKeyAuth('header', 'partner-key'),
- }
-
- protected interceptors: Interceptor[] = [];
-
- constructor(basePath?: string);
- constructor(basePathOrUsername: string, password?: string, basePath?: string) {
- if (password) {
- if (basePath) {
- this.basePath = basePath;
- }
- } else {
- if (basePathOrUsername) {
- this.basePath = basePathOrUsername
- }
- }
- }
-
- set useQuerystring(value: boolean) {
- this._useQuerystring = value;
- }
-
- set basePath(basePath: string) {
- this._basePath = basePath;
- }
-
- set defaultHeaders(defaultHeaders: any) {
- this._defaultHeaders = defaultHeaders;
- }
-
- get defaultHeaders() {
- return this._defaultHeaders;
- }
-
- get basePath() {
- return this._basePath;
- }
-
- public setDefaultAuthentication(auth: Authentication) {
- this.authentications.default = auth;
- }
-
- public setApiKey(key: ContactsApiApiKeys, value: string) {
- (this.authentications as any)[ContactsApiApiKeys[key]].apiKey = value;
- }
-
- public addInterceptor(interceptor: Interceptor) {
- this.interceptors.push(interceptor);
- }
-
- /**
- *
- * @summary Add existing contacts to a list
- * @param listId Id of the list
- * @param contactEmails Emails addresses OR IDs of the contacts
- */
- public async addContactToList (listId: number, contactEmails: AddContactToList, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: PostContactInfo; }> {
- const localVarPath = this.basePath + '/contacts/lists/{listId}/contacts/add'
- .replace('{' + 'listId' + '}', encodeURIComponent(String(listId)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'listId' is not null or undefined
- if (listId === null || listId === undefined) {
- throw new Error('Required parameter listId was null or undefined when calling addContactToList.');
- }
-
- // verify required parameter 'contactEmails' is not null or undefined
- if (contactEmails === null || contactEmails === undefined) {
- throw new Error('Required parameter contactEmails was null or undefined when calling addContactToList.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(contactEmails, "AddContactToList")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: PostContactInfo; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "PostContactInfo");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Create contact attribute
- * @param attributeCategory Category of the attribute
- * @param attributeName Name of the attribute
- * @param createAttribute Values to create an attribute
- */
- public async createAttribute (attributeCategory: 'normal' | 'transactional' | 'category' | 'calculated' | 'global', attributeName: string, createAttribute: CreateAttribute, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/contacts/attributes/{attributeCategory}/{attributeName}'
- .replace('{' + 'attributeCategory' + '}', encodeURIComponent(String(attributeCategory)))
- .replace('{' + 'attributeName' + '}', encodeURIComponent(String(attributeName)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'attributeCategory' is not null or undefined
- if (attributeCategory === null || attributeCategory === undefined) {
- throw new Error('Required parameter attributeCategory was null or undefined when calling createAttribute.');
- }
-
- // verify required parameter 'attributeName' is not null or undefined
- if (attributeName === null || attributeName === undefined) {
- throw new Error('Required parameter attributeName was null or undefined when calling createAttribute.');
- }
-
- // verify required parameter 'createAttribute' is not null or undefined
- if (createAttribute === null || createAttribute === undefined) {
- throw new Error('Required parameter createAttribute was null or undefined when calling createAttribute.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(createAttribute, "CreateAttribute")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Create a contact
- * @param createContact Values to create a contact
- */
- public async createContact (createContact: CreateContact, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: CreateUpdateContactModel; }> {
- const localVarPath = this.basePath + '/contacts';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'createContact' is not null or undefined
- if (createContact === null || createContact === undefined) {
- throw new Error('Required parameter createContact was null or undefined when calling createContact.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(createContact, "CreateContact")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: CreateUpdateContactModel; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "CreateUpdateContactModel");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Create Contact via DOI (Double-Opt-In) Flow
- * @param createDoiContact Values to create the Double opt-in (DOI) contact
- */
- public async createDoiContact (createDoiContact: CreateDoiContact, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/contacts/doubleOptinConfirmation';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'createDoiContact' is not null or undefined
- if (createDoiContact === null || createDoiContact === undefined) {
- throw new Error('Required parameter createDoiContact was null or undefined when calling createDoiContact.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(createDoiContact, "CreateDoiContact")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Create a folder
- * @param createFolder Name of the folder
- */
- public async createFolder (createFolder: CreateUpdateFolder, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: CreateModel; }> {
- const localVarPath = this.basePath + '/contacts/folders';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'createFolder' is not null or undefined
- if (createFolder === null || createFolder === undefined) {
- throw new Error('Required parameter createFolder was null or undefined when calling createFolder.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(createFolder, "CreateUpdateFolder")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: CreateModel; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "CreateModel");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Create a list
- * @param createList Values to create a list
- */
- public async createList (createList: CreateList, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: CreateModel; }> {
- const localVarPath = this.basePath + '/contacts/lists';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'createList' is not null or undefined
- if (createList === null || createList === undefined) {
- throw new Error('Required parameter createList was null or undefined when calling createList.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(createList, "CreateList")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: CreateModel; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "CreateModel");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Delete an attribute
- * @param attributeCategory Category of the attribute
- * @param attributeName Name of the existing attribute
- */
- public async deleteAttribute (attributeCategory: 'normal' | 'transactional' | 'category' | 'calculated' | 'global', attributeName: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/contacts/attributes/{attributeCategory}/{attributeName}'
- .replace('{' + 'attributeCategory' + '}', encodeURIComponent(String(attributeCategory)))
- .replace('{' + 'attributeName' + '}', encodeURIComponent(String(attributeName)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'attributeCategory' is not null or undefined
- if (attributeCategory === null || attributeCategory === undefined) {
- throw new Error('Required parameter attributeCategory was null or undefined when calling deleteAttribute.');
- }
-
- // verify required parameter 'attributeName' is not null or undefined
- if (attributeName === null || attributeName === undefined) {
- throw new Error('Required parameter attributeName was null or undefined when calling deleteAttribute.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'DELETE',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Delete a contact
- * @param identifier Email (urlencoded) OR ID of the contact
- */
- public async deleteContact (identifier: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/contacts/{identifier}'
- .replace('{' + 'identifier' + '}', encodeURIComponent(String(identifier)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'identifier' is not null or undefined
- if (identifier === null || identifier === undefined) {
- throw new Error('Required parameter identifier was null or undefined when calling deleteContact.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'DELETE',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Delete a folder (and all its lists)
- * @param folderId Id of the folder
- */
- public async deleteFolder (folderId: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/contacts/folders/{folderId}'
- .replace('{' + 'folderId' + '}', encodeURIComponent(String(folderId)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'folderId' is not null or undefined
- if (folderId === null || folderId === undefined) {
- throw new Error('Required parameter folderId was null or undefined when calling deleteFolder.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'DELETE',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Delete a list
- * @param listId Id of the list
- */
- public async deleteList (listId: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/contacts/lists/{listId}'
- .replace('{' + 'listId' + '}', encodeURIComponent(String(listId)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'listId' is not null or undefined
- if (listId === null || listId === undefined) {
- throw new Error('Required parameter listId was null or undefined when calling deleteList.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'DELETE',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary List all attributes
- */
- public async getAttributes (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetAttributes; }> {
- const localVarPath = this.basePath + '/contacts/attributes';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: GetAttributes; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "GetAttributes");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- * Along with the contact details, this endpoint will show the statistics of contact for the recent 90 days by default. To fetch the earlier statistics, please use Get contact campaign stats (https://developers.brevo.com/reference/contacts-7#getcontactstats) endpoint with the appropriate date ranges.
- * @summary Get a contact\'s details
- * @param identifier Email (urlencoded) OR ID of the contact OR its SMS attribute value
- * @param startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate
- * @param endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate.
- */
- public async getContactInfo (identifier: string, startDate?: string, endDate?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetExtendedContactDetails; }> {
- const localVarPath = this.basePath + '/contacts/{identifier}'
- .replace('{' + 'identifier' + '}', encodeURIComponent(String(identifier)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'identifier' is not null or undefined
- if (identifier === null || identifier === undefined) {
- throw new Error('Required parameter identifier was null or undefined when calling getContactInfo.');
- }
-
- if (startDate !== undefined) {
- localVarQueryParameters['startDate'] = ObjectSerializer.serialize(startDate, "string");
- }
-
- if (endDate !== undefined) {
- localVarQueryParameters['endDate'] = ObjectSerializer.serialize(endDate, "string");
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: GetExtendedContactDetails; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "GetExtendedContactDetails");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get email campaigns\' statistics for a contact
- * @param identifier Email (urlencoded) OR ID of the contact
- * @param startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate
- * @param endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days
- */
- public async getContactStats (identifier: string, startDate?: string, endDate?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetContactCampaignStats; }> {
- const localVarPath = this.basePath + '/contacts/{identifier}/campaignStats'
- .replace('{' + 'identifier' + '}', encodeURIComponent(String(identifier)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'identifier' is not null or undefined
- if (identifier === null || identifier === undefined) {
- throw new Error('Required parameter identifier was null or undefined when calling getContactStats.');
- }
-
- if (startDate !== undefined) {
- localVarQueryParameters['startDate'] = ObjectSerializer.serialize(startDate, "string");
- }
-
- if (endDate !== undefined) {
- localVarQueryParameters['endDate'] = ObjectSerializer.serialize(endDate, "string");
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: GetContactCampaignStats; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "GetContactCampaignStats");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get all the contacts
- * @param limit Number of documents per page
- * @param offset Index of the first document of the page
- * @param modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result.
- * @param createdSince Filter (urlencoded) the contacts created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result.
- * @param sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
- * @param segmentId Id of the segment. **Either listIds or segmentId can be passed.**
- * @param listIds Ids of the list. **Either listIds or segmentId can be passed.**
- * @param filter Filter the contacts on the basis of attributes. **Allowed operator: equals. (e.g. filter=equals(FIRSTNAME,\"Antoine\"), filter=equals(B1, true), filter=equals(DOB, \"1989-11-23\"))**
- */
- public async getContacts (limit?: number, offset?: number, modifiedSince?: string, createdSince?: string, sort?: 'asc' | 'desc', segmentId?: number, listIds?: Array, filter?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetContacts; }> {
- const localVarPath = this.basePath + '/contacts';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- if (limit !== undefined) {
- localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
- }
-
- if (offset !== undefined) {
- localVarQueryParameters['offset'] = ObjectSerializer.serialize(offset, "number");
- }
-
- if (modifiedSince !== undefined) {
- localVarQueryParameters['modifiedSince'] = ObjectSerializer.serialize(modifiedSince, "string");
- }
-
- if (createdSince !== undefined) {
- localVarQueryParameters['createdSince'] = ObjectSerializer.serialize(createdSince, "string");
- }
-
- if (sort !== undefined) {
- localVarQueryParameters['sort'] = ObjectSerializer.serialize(sort, "'asc' | 'desc'");
- }
-
- if (segmentId !== undefined) {
- localVarQueryParameters['segmentId'] = ObjectSerializer.serialize(segmentId, "number");
- }
-
- if (listIds !== undefined) {
- localVarQueryParameters['listIds'] = ObjectSerializer.serialize(listIds, "Array");
- }
-
- if (filter !== undefined) {
- localVarQueryParameters['filter'] = ObjectSerializer.serialize(filter, "string");
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: GetContacts; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "GetContacts");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get contacts in a list
- * @param listId Id of the list
- * @param modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result.
- * @param limit Number of documents per page
- * @param offset Index of the first document of the page
- * @param sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
- */
- public async getContactsFromList (listId: number, modifiedSince?: string, limit?: number, offset?: number, sort?: 'asc' | 'desc', options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetContacts; }> {
- const localVarPath = this.basePath + '/contacts/lists/{listId}/contacts'
- .replace('{' + 'listId' + '}', encodeURIComponent(String(listId)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'listId' is not null or undefined
- if (listId === null || listId === undefined) {
- throw new Error('Required parameter listId was null or undefined when calling getContactsFromList.');
- }
-
- if (modifiedSince !== undefined) {
- localVarQueryParameters['modifiedSince'] = ObjectSerializer.serialize(modifiedSince, "string");
- }
-
- if (limit !== undefined) {
- localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
- }
-
- if (offset !== undefined) {
- localVarQueryParameters['offset'] = ObjectSerializer.serialize(offset, "number");
- }
-
- if (sort !== undefined) {
- localVarQueryParameters['sort'] = ObjectSerializer.serialize(sort, "'asc' | 'desc'");
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: GetContacts; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "GetContacts");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Returns a folder\'s details
- * @param folderId id of the folder
- */
- public async getFolder (folderId: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetFolder; }> {
- const localVarPath = this.basePath + '/contacts/folders/{folderId}'
- .replace('{' + 'folderId' + '}', encodeURIComponent(String(folderId)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'folderId' is not null or undefined
- if (folderId === null || folderId === undefined) {
- throw new Error('Required parameter folderId was null or undefined when calling getFolder.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: GetFolder; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "GetFolder");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get lists in a folder
- * @param folderId Id of the folder
- * @param limit Number of documents per page
- * @param offset Index of the first document of the page
- * @param sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
- */
- public async getFolderLists (folderId: number, limit?: number, offset?: number, sort?: 'asc' | 'desc', options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetFolderLists; }> {
- const localVarPath = this.basePath + '/contacts/folders/{folderId}/lists'
- .replace('{' + 'folderId' + '}', encodeURIComponent(String(folderId)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'folderId' is not null or undefined
- if (folderId === null || folderId === undefined) {
- throw new Error('Required parameter folderId was null or undefined when calling getFolderLists.');
- }
-
- if (limit !== undefined) {
- localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
- }
-
- if (offset !== undefined) {
- localVarQueryParameters['offset'] = ObjectSerializer.serialize(offset, "number");
- }
-
- if (sort !== undefined) {
- localVarQueryParameters['sort'] = ObjectSerializer.serialize(sort, "'asc' | 'desc'");
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: GetFolderLists; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "GetFolderLists");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get all folders
- * @param limit Number of documents per page
- * @param offset Index of the first document of the page
- * @param sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
- */
- public async getFolders (limit: number, offset: number, sort?: 'asc' | 'desc', options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetFolders; }> {
- const localVarPath = this.basePath + '/contacts/folders';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'limit' is not null or undefined
- if (limit === null || limit === undefined) {
- throw new Error('Required parameter limit was null or undefined when calling getFolders.');
- }
-
- // verify required parameter 'offset' is not null or undefined
- if (offset === null || offset === undefined) {
- throw new Error('Required parameter offset was null or undefined when calling getFolders.');
- }
-
- if (limit !== undefined) {
- localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
- }
-
- if (offset !== undefined) {
- localVarQueryParameters['offset'] = ObjectSerializer.serialize(offset, "number");
- }
-
- if (sort !== undefined) {
- localVarQueryParameters['sort'] = ObjectSerializer.serialize(sort, "'asc' | 'desc'");
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: GetFolders; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "GetFolders");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get a list\'s details
- * @param listId Id of the list
- * @param startDate Mandatory if endDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id.Prefer to pass your timezone in date-time format for accurate result
- * @param endDate Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id.Prefer to pass your timezone in date-time format for accurate result
- */
- public async getList (listId: number, startDate?: string, endDate?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetExtendedList; }> {
- const localVarPath = this.basePath + '/contacts/lists/{listId}'
- .replace('{' + 'listId' + '}', encodeURIComponent(String(listId)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'listId' is not null or undefined
- if (listId === null || listId === undefined) {
- throw new Error('Required parameter listId was null or undefined when calling getList.');
- }
-
- if (startDate !== undefined) {
- localVarQueryParameters['startDate'] = ObjectSerializer.serialize(startDate, "string");
- }
-
- if (endDate !== undefined) {
- localVarQueryParameters['endDate'] = ObjectSerializer.serialize(endDate, "string");
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: GetExtendedList; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "GetExtendedList");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get all the lists
- * @param limit Number of documents per page
- * @param offset Index of the first document of the page
- * @param sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
- */
- public async getLists (limit?: number, offset?: number, sort?: 'asc' | 'desc', options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetLists; }> {
- const localVarPath = this.basePath + '/contacts/lists';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- if (limit !== undefined) {
- localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
- }
-
- if (offset !== undefined) {
- localVarQueryParameters['offset'] = ObjectSerializer.serialize(offset, "number");
- }
-
- if (sort !== undefined) {
- localVarQueryParameters['sort'] = ObjectSerializer.serialize(sort, "'asc' | 'desc'");
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: GetLists; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "GetLists");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get all the Segments
- * @param limit Number of documents per page
- * @param offset Index of the first document of the page
- * @param sort Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
- */
- public async getSegments (limit: number, offset: number, sort?: 'asc' | 'desc', options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetSegments; }> {
- const localVarPath = this.basePath + '/contacts/segments';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'limit' is not null or undefined
- if (limit === null || limit === undefined) {
- throw new Error('Required parameter limit was null or undefined when calling getSegments.');
- }
-
- // verify required parameter 'offset' is not null or undefined
- if (offset === null || offset === undefined) {
- throw new Error('Required parameter offset was null or undefined when calling getSegments.');
- }
-
- if (limit !== undefined) {
- localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
- }
-
- if (offset !== undefined) {
- localVarQueryParameters['offset'] = ObjectSerializer.serialize(offset, "number");
- }
-
- if (sort !== undefined) {
- localVarQueryParameters['sort'] = ObjectSerializer.serialize(sort, "'asc' | 'desc'");
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: GetSegments; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "GetSegments");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- * It returns the background process ID which on completion calls the notify URL that you have set in the input. **Note**: - Any contact attribute that doesn\'t exist in your account will be ignored at import end.
- * @summary Import contacts
- * @param requestContactImport Values to import contacts in Brevo. To know more about the expected format, please have a look at ``https://help.brevo.com/hc/en-us/articles/209499265-Build-contacts-lists-for-your-email-marketing-campaigns``
- */
- public async importContacts (requestContactImport: RequestContactImport, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: CreatedProcessId; }> {
- const localVarPath = this.basePath + '/contacts/import';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'requestContactImport' is not null or undefined
- if (requestContactImport === null || requestContactImport === undefined) {
- throw new Error('Required parameter requestContactImport was null or undefined when calling importContacts.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(requestContactImport, "RequestContactImport")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: CreatedProcessId; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "CreatedProcessId");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Delete a contact from a list
- * @param listId Id of the list
- * @param contactEmails Emails addresses OR IDs of the contacts
- */
- public async removeContactFromList (listId: number, contactEmails: RemoveContactFromList, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: PostContactInfo; }> {
- const localVarPath = this.basePath + '/contacts/lists/{listId}/contacts/remove'
- .replace('{' + 'listId' + '}', encodeURIComponent(String(listId)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'listId' is not null or undefined
- if (listId === null || listId === undefined) {
- throw new Error('Required parameter listId was null or undefined when calling removeContactFromList.');
- }
-
- // verify required parameter 'contactEmails' is not null or undefined
- if (contactEmails === null || contactEmails === undefined) {
- throw new Error('Required parameter contactEmails was null or undefined when calling removeContactFromList.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(contactEmails, "RemoveContactFromList")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: PostContactInfo; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "PostContactInfo");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- * It returns the background process ID which on completion calls the notify URL that you have set in the input. File will be available in csv.
- * @summary Export contacts
- * @param requestContactExport Values to request a contact export
- */
- public async requestContactExport (requestContactExport: RequestContactExport, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: CreatedProcessId; }> {
- const localVarPath = this.basePath + '/contacts/export';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'requestContactExport' is not null or undefined
- if (requestContactExport === null || requestContactExport === undefined) {
- throw new Error('Required parameter requestContactExport was null or undefined when calling requestContactExport.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(requestContactExport, "RequestContactExport")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: CreatedProcessId; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "CreatedProcessId");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Update contact attribute
- * @param attributeCategory Category of the attribute
- * @param attributeName Name of the existing attribute
- * @param updateAttribute Values to update an attribute
- */
- public async updateAttribute (attributeCategory: 'category' | 'calculated' | 'global', attributeName: string, updateAttribute: UpdateAttribute, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/contacts/attributes/{attributeCategory}/{attributeName}'
- .replace('{' + 'attributeCategory' + '}', encodeURIComponent(String(attributeCategory)))
- .replace('{' + 'attributeName' + '}', encodeURIComponent(String(attributeName)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'attributeCategory' is not null or undefined
- if (attributeCategory === null || attributeCategory === undefined) {
- throw new Error('Required parameter attributeCategory was null or undefined when calling updateAttribute.');
- }
-
- // verify required parameter 'attributeName' is not null or undefined
- if (attributeName === null || attributeName === undefined) {
- throw new Error('Required parameter attributeName was null or undefined when calling updateAttribute.');
- }
-
- // verify required parameter 'updateAttribute' is not null or undefined
- if (updateAttribute === null || updateAttribute === undefined) {
- throw new Error('Required parameter updateAttribute was null or undefined when calling updateAttribute.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'PUT',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(updateAttribute, "UpdateAttribute")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Update multiple contacts
- * @param updateBatchContacts Values to update multiple contacts
- */
- public async updateBatchContacts (updateBatchContacts: UpdateBatchContacts, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/contacts/batch';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'updateBatchContacts' is not null or undefined
- if (updateBatchContacts === null || updateBatchContacts === undefined) {
- throw new Error('Required parameter updateBatchContacts was null or undefined when calling updateBatchContacts.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(updateBatchContacts, "UpdateBatchContacts")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Update a contact
- * @param identifier Email (urlencoded) OR ID of the contact
- * @param updateContact Values to update a contact
- */
- public async updateContact (identifier: string, updateContact: UpdateContact, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/contacts/{identifier}'
- .replace('{' + 'identifier' + '}', encodeURIComponent(String(identifier)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'identifier' is not null or undefined
- if (identifier === null || identifier === undefined) {
- throw new Error('Required parameter identifier was null or undefined when calling updateContact.');
- }
-
- // verify required parameter 'updateContact' is not null or undefined
- if (updateContact === null || updateContact === undefined) {
- throw new Error('Required parameter updateContact was null or undefined when calling updateContact.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'PUT',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(updateContact, "UpdateContact")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Update a folder
- * @param folderId Id of the folder
- * @param updateFolder Name of the folder
- */
- public async updateFolder (folderId: number, updateFolder: CreateUpdateFolder, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/contacts/folders/{folderId}'
- .replace('{' + 'folderId' + '}', encodeURIComponent(String(folderId)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'folderId' is not null or undefined
- if (folderId === null || folderId === undefined) {
- throw new Error('Required parameter folderId was null or undefined when calling updateFolder.');
- }
-
- // verify required parameter 'updateFolder' is not null or undefined
- if (updateFolder === null || updateFolder === undefined) {
- throw new Error('Required parameter updateFolder was null or undefined when calling updateFolder.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'PUT',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(updateFolder, "CreateUpdateFolder")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Update a list
- * @param listId Id of the list
- * @param updateList Values to update a list
- */
- public async updateList (listId: number, updateList: UpdateList, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/contacts/lists/{listId}'
- .replace('{' + 'listId' + '}', encodeURIComponent(String(listId)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'listId' is not null or undefined
- if (listId === null || listId === undefined) {
- throw new Error('Required parameter listId was null or undefined when calling updateList.');
- }
-
- // verify required parameter 'updateList' is not null or undefined
- if (updateList === null || updateList === undefined) {
- throw new Error('Required parameter updateList was null or undefined when calling updateList.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'PUT',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(updateList, "UpdateList")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
-}
diff --git a/api/conversationsApi.ts b/api/conversationsApi.ts
deleted file mode 100644
index 04bbf27..0000000
--- a/api/conversationsApi.ts
+++ /dev/null
@@ -1,781 +0,0 @@
-/**
- * Brevo API
- * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity |
- *
- * The version of the OpenAPI document: 3.0.0
- * Contact: contact@brevo.com
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
-
-
-import localVarRequest from 'request';
-import http from 'http';
-
-/* tslint:disable:no-unused-locals */
-import { ConversationsAgentOnlinePingPostRequest } from '../model/conversationsAgentOnlinePingPostRequest';
-import { ConversationsMessage } from '../model/conversationsMessage';
-import { ConversationsMessagesIdPutRequest } from '../model/conversationsMessagesIdPutRequest';
-import { ConversationsMessagesPostRequest } from '../model/conversationsMessagesPostRequest';
-import { ConversationsPushedMessagesIdPutRequest } from '../model/conversationsPushedMessagesIdPutRequest';
-import { ConversationsPushedMessagesPostRequest } from '../model/conversationsPushedMessagesPostRequest';
-import { ErrorModel } from '../model/errorModel';
-
-import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
-import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
-
-import { HttpError, RequestFile } from './apis';
-
-let defaultBasePath = 'https://api.brevo.com/v3';
-
-// ===============================================
-// This file is autogenerated - Please do not edit
-// ===============================================
-
-export enum ConversationsApiApiKeys {
- apiKey,
- partnerKey,
-}
-
-export class ConversationsApi {
- protected _basePath = defaultBasePath;
- protected _defaultHeaders : any = {};
- protected _useQuerystring : boolean = false;
-
- protected authentications = {
- 'default': new VoidAuth(),
- 'apiKey': new ApiKeyAuth('header', 'api-key'),
- 'partnerKey': new ApiKeyAuth('header', 'partner-key'),
- }
-
- protected interceptors: Interceptor[] = [];
-
- constructor(basePath?: string);
- constructor(basePathOrUsername: string, password?: string, basePath?: string) {
- if (password) {
- if (basePath) {
- this.basePath = basePath;
- }
- } else {
- if (basePathOrUsername) {
- this.basePath = basePathOrUsername
- }
- }
- }
-
- set useQuerystring(value: boolean) {
- this._useQuerystring = value;
- }
-
- set basePath(basePath: string) {
- this._basePath = basePath;
- }
-
- set defaultHeaders(defaultHeaders: any) {
- this._defaultHeaders = defaultHeaders;
- }
-
- get defaultHeaders() {
- return this._defaultHeaders;
- }
-
- get basePath() {
- return this._basePath;
- }
-
- public setDefaultAuthentication(auth: Authentication) {
- this.authentications.default = auth;
- }
-
- public setApiKey(key: ConversationsApiApiKeys, value: string) {
- (this.authentications as any)[ConversationsApiApiKeys[key]].apiKey = value;
- }
-
- public addInterceptor(interceptor: Interceptor) {
- this.interceptors.push(interceptor);
- }
-
- /**
- * We recommend pinging this endpoint every minute for as long as the agent has to be considered online.
- * @summary Sets agent’s status to online for 2-3 minutes
- * @param body Agent fields.
- */
- public async conversationsAgentOnlinePingPost (body: ConversationsAgentOnlinePingPostRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/conversations/agentOnlinePing';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'body' is not null or undefined
- if (body === null || body === undefined) {
- throw new Error('Required parameter body was null or undefined when calling conversationsAgentOnlinePingPost.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(body, "ConversationsAgentOnlinePingPostRequest")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- * Only agents’ messages can be deleted.
- * @summary Delete a message sent by an agent
- * @param id ID of the message
- */
- public async conversationsMessagesIdDelete (id: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/conversations/messages/{id}'
- .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'id' is not null or undefined
- if (id === null || id === undefined) {
- throw new Error('Required parameter id was null or undefined when calling conversationsMessagesIdDelete.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'DELETE',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get a message
- * @param id ID of the message
- */
- public async conversationsMessagesIdGet (id: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ConversationsMessage; }> {
- const localVarPath = this.basePath + '/conversations/messages/{id}'
- .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'id' is not null or undefined
- if (id === null || id === undefined) {
- throw new Error('Required parameter id was null or undefined when calling conversationsMessagesIdGet.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: ConversationsMessage; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "ConversationsMessage");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- * Only agents’ messages can be edited.
- * @summary Update a message sent by an agent
- * @param id ID of the message
- * @param body
- */
- public async conversationsMessagesIdPut (id: string, body?: ConversationsMessagesIdPutRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ConversationsMessage; }> {
- const localVarPath = this.basePath + '/conversations/messages/{id}'
- .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'id' is not null or undefined
- if (id === null || id === undefined) {
- throw new Error('Required parameter id was null or undefined when calling conversationsMessagesIdPut.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'PUT',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(body, "ConversationsMessagesIdPutRequest")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: ConversationsMessage; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "ConversationsMessage");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Send a message as an agent
- * @param body Message fields.
- */
- public async conversationsMessagesPost (body: ConversationsMessagesPostRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ConversationsMessage; }> {
- const localVarPath = this.basePath + '/conversations/messages';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'body' is not null or undefined
- if (body === null || body === undefined) {
- throw new Error('Required parameter body was null or undefined when calling conversationsMessagesPost.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(body, "ConversationsMessagesPostRequest")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: ConversationsMessage; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "ConversationsMessage");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Delete an automated message
- * @param id ID of the message
- */
- public async conversationsPushedMessagesIdDelete (id: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/conversations/pushedMessages/{id}'
- .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'id' is not null or undefined
- if (id === null || id === undefined) {
- throw new Error('Required parameter id was null or undefined when calling conversationsPushedMessagesIdDelete.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'DELETE',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get an automated message
- * @param id ID of the message sent previously
- */
- public async conversationsPushedMessagesIdGet (id: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ConversationsMessage; }> {
- const localVarPath = this.basePath + '/conversations/pushedMessages/{id}'
- .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'id' is not null or undefined
- if (id === null || id === undefined) {
- throw new Error('Required parameter id was null or undefined when calling conversationsPushedMessagesIdGet.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: ConversationsMessage; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "ConversationsMessage");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Update an automated message
- * @param id ID of the message
- * @param body
- */
- public async conversationsPushedMessagesIdPut (id: string, body: ConversationsPushedMessagesIdPutRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ConversationsMessage; }> {
- const localVarPath = this.basePath + '/conversations/pushedMessages/{id}'
- .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'id' is not null or undefined
- if (id === null || id === undefined) {
- throw new Error('Required parameter id was null or undefined when calling conversationsPushedMessagesIdPut.');
- }
-
- // verify required parameter 'body' is not null or undefined
- if (body === null || body === undefined) {
- throw new Error('Required parameter body was null or undefined when calling conversationsPushedMessagesIdPut.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'PUT',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(body, "ConversationsPushedMessagesIdPutRequest")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: ConversationsMessage; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "ConversationsMessage");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- * Example of automated messages: order status, announce new features in your web app, etc.
- * @summary Send an automated message to a visitor
- * @param body
- */
- public async conversationsPushedMessagesPost (body: ConversationsPushedMessagesPostRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ConversationsMessage; }> {
- const localVarPath = this.basePath + '/conversations/pushedMessages';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'body' is not null or undefined
- if (body === null || body === undefined) {
- throw new Error('Required parameter body was null or undefined when calling conversationsPushedMessagesPost.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(body, "ConversationsPushedMessagesPostRequest")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: ConversationsMessage; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "ConversationsMessage");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
-}
diff --git a/api/couponsApi.ts b/api/couponsApi.ts
deleted file mode 100644
index f53bcbd..0000000
--- a/api/couponsApi.ts
+++ /dev/null
@@ -1,489 +0,0 @@
-/**
- * Brevo API
- * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity |
- *
- * The version of the OpenAPI document: 3.0.0
- * Contact: contact@brevo.com
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
-
-
-import localVarRequest from 'request';
-import http from 'http';
-
-/* tslint:disable:no-unused-locals */
-import { CreateCouponCollection201Response } from '../model/createCouponCollection201Response';
-import { CreateCouponCollectionRequest } from '../model/createCouponCollectionRequest';
-import { CreateCouponsRequest } from '../model/createCouponsRequest';
-import { ErrorModel } from '../model/errorModel';
-import { GetCouponCollection } from '../model/getCouponCollection';
-import { UpdateCouponCollection200Response } from '../model/updateCouponCollection200Response';
-import { UpdateCouponCollectionRequest } from '../model/updateCouponCollectionRequest';
-
-import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
-import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
-
-import { HttpError, RequestFile } from './apis';
-
-let defaultBasePath = 'https://api.brevo.com/v3';
-
-// ===============================================
-// This file is autogenerated - Please do not edit
-// ===============================================
-
-export enum CouponsApiApiKeys {
- apiKey,
- partnerKey,
-}
-
-export class CouponsApi {
- protected _basePath = defaultBasePath;
- protected _defaultHeaders : any = {};
- protected _useQuerystring : boolean = false;
-
- protected authentications = {
- 'default': new VoidAuth(),
- 'apiKey': new ApiKeyAuth('header', 'api-key'),
- 'partnerKey': new ApiKeyAuth('header', 'partner-key'),
- }
-
- protected interceptors: Interceptor[] = [];
-
- constructor(basePath?: string);
- constructor(basePathOrUsername: string, password?: string, basePath?: string) {
- if (password) {
- if (basePath) {
- this.basePath = basePath;
- }
- } else {
- if (basePathOrUsername) {
- this.basePath = basePathOrUsername
- }
- }
- }
-
- set useQuerystring(value: boolean) {
- this._useQuerystring = value;
- }
-
- set basePath(basePath: string) {
- this._basePath = basePath;
- }
-
- set defaultHeaders(defaultHeaders: any) {
- this._defaultHeaders = defaultHeaders;
- }
-
- get defaultHeaders() {
- return this._defaultHeaders;
- }
-
- get basePath() {
- return this._basePath;
- }
-
- public setDefaultAuthentication(auth: Authentication) {
- this.authentications.default = auth;
- }
-
- public setApiKey(key: CouponsApiApiKeys, value: string) {
- (this.authentications as any)[CouponsApiApiKeys[key]].apiKey = value;
- }
-
- public addInterceptor(interceptor: Interceptor) {
- this.interceptors.push(interceptor);
- }
-
- /**
- *
- * @summary Create а coupon collection
- * @param createCouponCollection Values to create a coupon collection
- */
- public async createCouponCollection (createCouponCollection: CreateCouponCollectionRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: CreateCouponCollection201Response; }> {
- const localVarPath = this.basePath + '/couponCollections';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'createCouponCollection' is not null or undefined
- if (createCouponCollection === null || createCouponCollection === undefined) {
- throw new Error('Required parameter createCouponCollection was null or undefined when calling createCouponCollection.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(createCouponCollection, "CreateCouponCollectionRequest")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: CreateCouponCollection201Response; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "CreateCouponCollection201Response");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Create coupons for a coupon collection
- * @param createCoupons Values to create coupons
- */
- public async createCoupons (createCoupons: CreateCouponsRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/coupons';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'createCoupons' is not null or undefined
- if (createCoupons === null || createCoupons === undefined) {
- throw new Error('Required parameter createCoupons was null or undefined when calling createCoupons.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(createCoupons, "CreateCouponsRequest")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get a coupon collection by id
- * @param id Id of the collection to return
- */
- public async getCouponCollection (id: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetCouponCollection; }> {
- const localVarPath = this.basePath + '/couponCollections/{id}'
- .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json', 'response'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'id' is not null or undefined
- if (id === null || id === undefined) {
- throw new Error('Required parameter id was null or undefined when calling getCouponCollection.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: GetCouponCollection; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "GetCouponCollection");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get all your coupon collections
- * @param limit Number of documents returned per page
- * @param offset Index of the first document on the page
- * @param sort Sort the results by creation time in ascending/descending order
- * @param sortBy The field used to sort coupon collections
- */
- public async getCouponCollections (limit?: number, offset?: number, sort?: 'asc' | 'desc', sortBy?: 'createdAt' | 'remainingCoupons' | 'expirationDate', options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetCouponCollection; }> {
- const localVarPath = this.basePath + '/couponCollections';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json', 'response'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- if (limit !== undefined) {
- localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
- }
-
- if (offset !== undefined) {
- localVarQueryParameters['offset'] = ObjectSerializer.serialize(offset, "number");
- }
-
- if (sort !== undefined) {
- localVarQueryParameters['sort'] = ObjectSerializer.serialize(sort, "'asc' | 'desc'");
- }
-
- if (sortBy !== undefined) {
- localVarQueryParameters['sortBy'] = ObjectSerializer.serialize(sortBy, "'createdAt' | 'remainingCoupons' | 'expirationDate'");
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: GetCouponCollection; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "GetCouponCollection");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Update a coupon collection by id
- * @param id Id of the collection to update
- * @param updateCouponCollection Values to update the coupon collection
- */
- public async updateCouponCollection (id: string, updateCouponCollection?: UpdateCouponCollectionRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: UpdateCouponCollection200Response; }> {
- const localVarPath = this.basePath + '/couponCollections/{id}'
- .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'id' is not null or undefined
- if (id === null || id === undefined) {
- throw new Error('Required parameter id was null or undefined when calling updateCouponCollection.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'PATCH',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(updateCouponCollection, "UpdateCouponCollectionRequest")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: UpdateCouponCollection200Response; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "UpdateCouponCollection200Response");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
-}
diff --git a/api/dealsApi.ts b/api/dealsApi.ts
deleted file mode 100644
index 7bb4e14..0000000
--- a/api/dealsApi.ts
+++ /dev/null
@@ -1,870 +0,0 @@
-/**
- * Brevo API
- * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity |
- *
- * The version of the OpenAPI document: 3.0.0
- * Contact: contact@brevo.com
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
-
-
-import localVarRequest from 'request';
-import http from 'http';
-
-/* tslint:disable:no-unused-locals */
-import { CrmDealsIdPatchRequest } from '../model/crmDealsIdPatchRequest';
-import { CrmDealsLinkUnlinkIdPatchRequest } from '../model/crmDealsLinkUnlinkIdPatchRequest';
-import { CrmDealsPost201Response } from '../model/crmDealsPost201Response';
-import { CrmDealsPostRequest } from '../model/crmDealsPostRequest';
-import { Deal } from '../model/deal';
-import { DealAttributesInner } from '../model/dealAttributesInner';
-import { DealsList } from '../model/dealsList';
-import { ErrorModel } from '../model/errorModel';
-import { Pipeline } from '../model/pipeline';
-
-import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
-import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
-
-import { HttpError, RequestFile } from './apis';
-
-let defaultBasePath = 'https://api.brevo.com/v3';
-
-// ===============================================
-// This file is autogenerated - Please do not edit
-// ===============================================
-
-export enum DealsApiApiKeys {
- apiKey,
- partnerKey,
-}
-
-export class DealsApi {
- protected _basePath = defaultBasePath;
- protected _defaultHeaders : any = {};
- protected _useQuerystring : boolean = false;
-
- protected authentications = {
- 'default': new VoidAuth(),
- 'apiKey': new ApiKeyAuth('header', 'api-key'),
- 'partnerKey': new ApiKeyAuth('header', 'partner-key'),
- }
-
- protected interceptors: Interceptor[] = [];
-
- constructor(basePath?: string);
- constructor(basePathOrUsername: string, password?: string, basePath?: string) {
- if (password) {
- if (basePath) {
- this.basePath = basePath;
- }
- } else {
- if (basePathOrUsername) {
- this.basePath = basePathOrUsername
- }
- }
- }
-
- set useQuerystring(value: boolean) {
- this._useQuerystring = value;
- }
-
- set basePath(basePath: string) {
- this._basePath = basePath;
- }
-
- set defaultHeaders(defaultHeaders: any) {
- this._defaultHeaders = defaultHeaders;
- }
-
- get defaultHeaders() {
- return this._defaultHeaders;
- }
-
- get basePath() {
- return this._basePath;
- }
-
- public setDefaultAuthentication(auth: Authentication) {
- this.authentications.default = auth;
- }
-
- public setApiKey(key: DealsApiApiKeys, value: string) {
- (this.authentications as any)[DealsApiApiKeys[key]].apiKey = value;
- }
-
- public addInterceptor(interceptor: Interceptor) {
- this.interceptors.push(interceptor);
- }
-
- /**
- *
- * @summary Get deal attributes
- */
- public async crmAttributesDealsGet (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array; }> {
- const localVarPath = this.basePath + '/crm/attributes/deals';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: Array; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "Array");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get all deals
- * @param filtersAttributesDealName Filter by attributes. If you have a filter for the owner on your end, please send it as filters[attributes.deal_owner] and utilize the account email for the filtering.
- * @param filtersLinkedCompaniesIds Filter by linked companies ids
- * @param filtersLinkedContactsIds Filter by linked companies ids
- * @param offset Index of the first document of the page
- * @param limit Number of documents per page
- * @param sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed
- * @param sortBy The field used to sort field names.
- */
- public async crmDealsGet (filtersAttributesDealName?: string, filtersLinkedCompaniesIds?: string, filtersLinkedContactsIds?: string, offset?: number, limit?: number, sort?: 'asc' | 'desc', sortBy?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DealsList; }> {
- const localVarPath = this.basePath + '/crm/deals';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json', 'response'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- if (filtersAttributesDealName !== undefined) {
- localVarQueryParameters['filters[attributes.deal_name]'] = ObjectSerializer.serialize(filtersAttributesDealName, "string");
- }
-
- if (filtersLinkedCompaniesIds !== undefined) {
- localVarQueryParameters['filters[linkedCompaniesIds]'] = ObjectSerializer.serialize(filtersLinkedCompaniesIds, "string");
- }
-
- if (filtersLinkedContactsIds !== undefined) {
- localVarQueryParameters['filters[linkedContactsIds]'] = ObjectSerializer.serialize(filtersLinkedContactsIds, "string");
- }
-
- if (offset !== undefined) {
- localVarQueryParameters['offset'] = ObjectSerializer.serialize(offset, "number");
- }
-
- if (limit !== undefined) {
- localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
- }
-
- if (sort !== undefined) {
- localVarQueryParameters['sort'] = ObjectSerializer.serialize(sort, "'asc' | 'desc'");
- }
-
- if (sortBy !== undefined) {
- localVarQueryParameters['sortBy'] = ObjectSerializer.serialize(sortBy, "string");
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: DealsList; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "DealsList");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Delete a deal
- * @param id
- */
- public async crmDealsIdDelete (id: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/crm/deals/{id}'
- .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'id' is not null or undefined
- if (id === null || id === undefined) {
- throw new Error('Required parameter id was null or undefined when calling crmDealsIdDelete.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'DELETE',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get a deal
- * @param id
- */
- public async crmDealsIdGet (id: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Deal; }> {
- const localVarPath = this.basePath + '/crm/deals/{id}'
- .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'id' is not null or undefined
- if (id === null || id === undefined) {
- throw new Error('Required parameter id was null or undefined when calling crmDealsIdGet.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: Deal; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "Deal");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Update a deal
- * @param id
- * @param body Updated deal details.
- */
- public async crmDealsIdPatch (id: string, body: CrmDealsIdPatchRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/crm/deals/{id}'
- .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'id' is not null or undefined
- if (id === null || id === undefined) {
- throw new Error('Required parameter id was null or undefined when calling crmDealsIdPatch.');
- }
-
- // verify required parameter 'body' is not null or undefined
- if (body === null || body === undefined) {
- throw new Error('Required parameter body was null or undefined when calling crmDealsIdPatch.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'PATCH',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(body, "CrmDealsIdPatchRequest")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Link and Unlink a deal with contacts and companies
- * @param id
- * @param body Linked / Unlinked contacts and companies ids.
- */
- public async crmDealsLinkUnlinkIdPatch (id: string, body: CrmDealsLinkUnlinkIdPatchRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/crm/deals/link-unlink/{id}'
- .replace('{' + 'id' + '}', encodeURIComponent(String(id)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json', 'response'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'id' is not null or undefined
- if (id === null || id === undefined) {
- throw new Error('Required parameter id was null or undefined when calling crmDealsLinkUnlinkIdPatch.');
- }
-
- // verify required parameter 'body' is not null or undefined
- if (body === null || body === undefined) {
- throw new Error('Required parameter body was null or undefined when calling crmDealsLinkUnlinkIdPatch.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'PATCH',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(body, "CrmDealsLinkUnlinkIdPatchRequest")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Create a deal
- * @param body Deal create data.
- */
- public async crmDealsPost (body: CrmDealsPostRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: CrmDealsPost201Response; }> {
- const localVarPath = this.basePath + '/crm/deals';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'body' is not null or undefined
- if (body === null || body === undefined) {
- throw new Error('Required parameter body was null or undefined when calling crmDealsPost.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(body, "CrmDealsPostRequest")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: CrmDealsPost201Response; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "CrmDealsPost201Response");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get all pipelines
- */
- public async crmPipelineDetailsAllGet (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array; }> {
- const localVarPath = this.basePath + '/crm/pipeline/details/all';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: Array; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "Array");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- * This endpoint is deprecated. Prefer /crm/pipeline/details/{pipelineID} instead.
- * @summary Get pipeline stages
- */
- public async crmPipelineDetailsGet (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Pipeline; }> {
- const localVarPath = this.basePath + '/crm/pipeline/details';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: Pipeline; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "Pipeline");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get a pipeline
- * @param pipelineID
- */
- public async crmPipelineDetailsPipelineIDGet (pipelineID: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array; }> {
- const localVarPath = this.basePath + '/crm/pipeline/details/{pipelineID}'
- .replace('{' + 'pipelineID' + '}', encodeURIComponent(String(pipelineID)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'pipelineID' is not null or undefined
- if (pipelineID === null || pipelineID === undefined) {
- throw new Error('Required parameter pipelineID was null or undefined when calling crmPipelineDetailsPipelineIDGet.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: Array; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "Array");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
-}
diff --git a/api/domainsApi.ts b/api/domainsApi.ts
deleted file mode 100644
index 7e2d664..0000000
--- a/api/domainsApi.ts
+++ /dev/null
@@ -1,461 +0,0 @@
-/**
- * Brevo API
- * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity |
- *
- * The version of the OpenAPI document: 3.0.0
- * Contact: contact@brevo.com
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
-
-
-import localVarRequest from 'request';
-import http from 'http';
-
-/* tslint:disable:no-unused-locals */
-import { AuthenticateDomainModel } from '../model/authenticateDomainModel';
-import { CreateDomain } from '../model/createDomain';
-import { CreateDomainModel } from '../model/createDomainModel';
-import { ErrorModel } from '../model/errorModel';
-import { GetDomainConfigurationModel } from '../model/getDomainConfigurationModel';
-import { GetDomainsList } from '../model/getDomainsList';
-
-import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
-import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
-
-import { HttpError, RequestFile } from './apis';
-
-let defaultBasePath = 'https://api.brevo.com/v3';
-
-// ===============================================
-// This file is autogenerated - Please do not edit
-// ===============================================
-
-export enum DomainsApiApiKeys {
- apiKey,
- partnerKey,
-}
-
-export class DomainsApi {
- protected _basePath = defaultBasePath;
- protected _defaultHeaders : any = {};
- protected _useQuerystring : boolean = false;
-
- protected authentications = {
- 'default': new VoidAuth(),
- 'apiKey': new ApiKeyAuth('header', 'api-key'),
- 'partnerKey': new ApiKeyAuth('header', 'partner-key'),
- }
-
- protected interceptors: Interceptor[] = [];
-
- constructor(basePath?: string);
- constructor(basePathOrUsername: string, password?: string, basePath?: string) {
- if (password) {
- if (basePath) {
- this.basePath = basePath;
- }
- } else {
- if (basePathOrUsername) {
- this.basePath = basePathOrUsername
- }
- }
- }
-
- set useQuerystring(value: boolean) {
- this._useQuerystring = value;
- }
-
- set basePath(basePath: string) {
- this._basePath = basePath;
- }
-
- set defaultHeaders(defaultHeaders: any) {
- this._defaultHeaders = defaultHeaders;
- }
-
- get defaultHeaders() {
- return this._defaultHeaders;
- }
-
- get basePath() {
- return this._basePath;
- }
-
- public setDefaultAuthentication(auth: Authentication) {
- this.authentications.default = auth;
- }
-
- public setApiKey(key: DomainsApiApiKeys, value: string) {
- (this.authentications as any)[DomainsApiApiKeys[key]].apiKey = value;
- }
-
- public addInterceptor(interceptor: Interceptor) {
- this.interceptors.push(interceptor);
- }
-
- /**
- *
- * @summary Authenticate a domain
- * @param domainName Domain name
- */
- public async authenticateDomain (domainName: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: AuthenticateDomainModel; }> {
- const localVarPath = this.basePath + '/senders/domains/{domainName}/authenticate'
- .replace('{' + 'domainName' + '}', encodeURIComponent(String(domainName)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'domainName' is not null or undefined
- if (domainName === null || domainName === undefined) {
- throw new Error('Required parameter domainName was null or undefined when calling authenticateDomain.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'PUT',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: AuthenticateDomainModel; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "AuthenticateDomainModel");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Create a new domain
- * @param domainName domain\'s name
- */
- public async createDomain (domainName?: CreateDomain, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: CreateDomainModel; }> {
- const localVarPath = this.basePath + '/senders/domains';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(domainName, "CreateDomain")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: CreateDomainModel; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "CreateDomainModel");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Delete a domain
- * @param domainName Domain name
- */
- public async deleteDomain (domainName: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/senders/domains/{domainName}'
- .replace('{' + 'domainName' + '}', encodeURIComponent(String(domainName)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'domainName' is not null or undefined
- if (domainName === null || domainName === undefined) {
- throw new Error('Required parameter domainName was null or undefined when calling deleteDomain.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'DELETE',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Validate domain configuration
- * @param domainName Domain name
- */
- public async getDomainConfiguration (domainName: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetDomainConfigurationModel; }> {
- const localVarPath = this.basePath + '/senders/domains/{domainName}'
- .replace('{' + 'domainName' + '}', encodeURIComponent(String(domainName)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'domainName' is not null or undefined
- if (domainName === null || domainName === undefined) {
- throw new Error('Required parameter domainName was null or undefined when calling getDomainConfiguration.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: GetDomainConfigurationModel; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "GetDomainConfigurationModel");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get the list of all your domains
- */
- public async getDomains (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetDomainsList; }> {
- const localVarPath = this.basePath + '/senders/domains';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: GetDomainsList; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "GetDomainsList");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
-}
diff --git a/api/ecommerceApi.ts b/api/ecommerceApi.ts
deleted file mode 100644
index b629a36..0000000
--- a/api/ecommerceApi.ts
+++ /dev/null
@@ -1,1502 +0,0 @@
-/**
- * Brevo API
- * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | | 422 | Error. Unprocessable Entity |
- *
- * The version of the OpenAPI document: 3.0.0
- * Contact: contact@brevo.com
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
-
-
-import localVarRequest from 'request';
-import http from 'http';
-
-/* tslint:disable:no-unused-locals */
-import { CreateCategoryModel } from '../model/createCategoryModel';
-import { CreateProductModel } from '../model/createProductModel';
-import { CreateUpdateBatchCategory } from '../model/createUpdateBatchCategory';
-import { CreateUpdateBatchCategoryModel } from '../model/createUpdateBatchCategoryModel';
-import { CreateUpdateBatchProducts } from '../model/createUpdateBatchProducts';
-import { CreateUpdateBatchProductsModel } from '../model/createUpdateBatchProductsModel';
-import { CreateUpdateCategory } from '../model/createUpdateCategory';
-import { CreateUpdateProduct } from '../model/createUpdateProduct';
-import { EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response } from '../model/ecommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response';
-import { EcommerceAttributionMetricsGet200Response } from '../model/ecommerceAttributionMetricsGet200Response';
-import { EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response } from '../model/ecommerceAttributionProductsConversionSourceConversionSourceIdGet200Response';
-import { EcommerceConfigDisplayCurrencyGet200Response } from '../model/ecommerceConfigDisplayCurrencyGet200Response';
-import { ErrorModel } from '../model/errorModel';
-import { GetCategories } from '../model/getCategories';
-import { GetCategoryDetails } from '../model/getCategoryDetails';
-import { GetOrders } from '../model/getOrders';
-import { GetProductDetails } from '../model/getProductDetails';
-import { GetProducts } from '../model/getProducts';
-import { Order } from '../model/order';
-import { OrderBatch } from '../model/orderBatch';
-
-import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
-import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
-
-import { HttpError, RequestFile } from './apis';
-
-let defaultBasePath = 'https://api.brevo.com/v3';
-
-// ===============================================
-// This file is autogenerated - Please do not edit
-// ===============================================
-
-export enum EcommerceApiApiKeys {
- apiKey,
- partnerKey,
-}
-
-export class EcommerceApi {
- protected _basePath = defaultBasePath;
- protected _defaultHeaders : any = {};
- protected _useQuerystring : boolean = false;
-
- protected authentications = {
- 'default': new VoidAuth(),
- 'apiKey': new ApiKeyAuth('header', 'api-key'),
- 'partnerKey': new ApiKeyAuth('header', 'partner-key'),
- }
-
- protected interceptors: Interceptor[] = [];
-
- constructor(basePath?: string);
- constructor(basePathOrUsername: string, password?: string, basePath?: string) {
- if (password) {
- if (basePath) {
- this.basePath = basePath;
- }
- } else {
- if (basePathOrUsername) {
- this.basePath = basePathOrUsername
- }
- }
- }
-
- set useQuerystring(value: boolean) {
- this._useQuerystring = value;
- }
-
- set basePath(basePath: string) {
- this._basePath = basePath;
- }
-
- set defaultHeaders(defaultHeaders: any) {
- this._defaultHeaders = defaultHeaders;
- }
-
- get defaultHeaders() {
- return this._defaultHeaders;
- }
-
- get basePath() {
- return this._basePath;
- }
-
- public setDefaultAuthentication(auth: Authentication) {
- this.authentications.default = auth;
- }
-
- public setApiKey(key: EcommerceApiApiKeys, value: string) {
- (this.authentications as any)[EcommerceApiApiKeys[key]].apiKey = value;
- }
-
- public addInterceptor(interceptor: Interceptor) {
- this.interceptors.push(interceptor);
- }
-
- /**
- * Create multiple orders at one time instead of one order at a time
- * @summary Create orders in batch
- * @param orderBatch
- */
- public async createBatchOrder (orderBatch: OrderBatch, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/orders/status/batch';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'orderBatch' is not null or undefined
- if (orderBatch === null || orderBatch === undefined) {
- throw new Error('Required parameter orderBatch was null or undefined when calling createBatchOrder.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(orderBatch, "OrderBatch")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- * Manages the transactional status of the order
- * @summary Managing the status of the order
- * @param order
- */
- public async createOrder (order: Order, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/orders/status';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'order' is not null or undefined
- if (order === null || order === undefined) {
- throw new Error('Required parameter order was null or undefined when calling createOrder.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(order, "Order")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Create categories in batch
- * @param createUpdateBatchCategory Values to create a batch of categories
- */
- public async createUpdateBatchCategory (createUpdateBatchCategory: CreateUpdateBatchCategory, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: CreateUpdateBatchCategoryModel; }> {
- const localVarPath = this.basePath + '/categories/batch';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'createUpdateBatchCategory' is not null or undefined
- if (createUpdateBatchCategory === null || createUpdateBatchCategory === undefined) {
- throw new Error('Required parameter createUpdateBatchCategory was null or undefined when calling createUpdateBatchCategory.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(createUpdateBatchCategory, "CreateUpdateBatchCategory")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: CreateUpdateBatchCategoryModel; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "CreateUpdateBatchCategoryModel");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Create products in batch
- * @param createUpdateBatchProducts Values to create a batch of products
- */
- public async createUpdateBatchProducts (createUpdateBatchProducts: CreateUpdateBatchProducts, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: CreateUpdateBatchProductsModel; }> {
- const localVarPath = this.basePath + '/products/batch';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'createUpdateBatchProducts' is not null or undefined
- if (createUpdateBatchProducts === null || createUpdateBatchProducts === undefined) {
- throw new Error('Required parameter createUpdateBatchProducts was null or undefined when calling createUpdateBatchProducts.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(createUpdateBatchProducts, "CreateUpdateBatchProducts")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: CreateUpdateBatchProductsModel; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "CreateUpdateBatchProductsModel");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Create/Update a category
- * @param createUpdateCategory Values to create/update a category
- */
- public async createUpdateCategory (createUpdateCategory: CreateUpdateCategory, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: CreateCategoryModel; }> {
- const localVarPath = this.basePath + '/categories';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'createUpdateCategory' is not null or undefined
- if (createUpdateCategory === null || createUpdateCategory === undefined) {
- throw new Error('Required parameter createUpdateCategory was null or undefined when calling createUpdateCategory.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(createUpdateCategory, "CreateUpdateCategory")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: CreateCategoryModel; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "CreateCategoryModel");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Create/Update a product
- * @param createUpdateProduct Values to create/update a product
- */
- public async createUpdateProduct (createUpdateProduct: CreateUpdateProduct, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: CreateProductModel; }> {
- const localVarPath = this.basePath + '/products';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'createUpdateProduct' is not null or undefined
- if (createUpdateProduct === null || createUpdateProduct === undefined) {
- throw new Error('Required parameter createUpdateProduct was null or undefined when calling createUpdateProduct.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- body: ObjectSerializer.serialize(createUpdateProduct, "CreateUpdateProduct")
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: CreateProductModel; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "CreateProductModel");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- * Getting access to Brevo eCommerce.
- * @summary Activate the eCommerce app
- */
- public async ecommerceActivatePost (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
- const localVarPath = this.basePath + '/ecommerce/activate';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'POST',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get detailed attribution metrics for a single Brevo campaign
- * @param conversionSource The Brevo campaign type for which data will be retrieved
- * @param conversionSourceId The Brevo campaign id for which data will be retrieved
- */
- public async ecommerceAttributionMetricsConversionSourceConversionSourceIdGet (conversionSource: 'email_campaign', conversionSourceId: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response; }> {
- const localVarPath = this.basePath + '/ecommerce/attribution/metrics/{conversionSource}/{conversionSourceId}'
- .replace('{' + 'conversionSource' + '}', encodeURIComponent(String(conversionSource)))
- .replace('{' + 'conversionSourceId' + '}', encodeURIComponent(String(conversionSourceId)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'conversionSource' is not null or undefined
- if (conversionSource === null || conversionSource === undefined) {
- throw new Error('Required parameter conversionSource was null or undefined when calling ecommerceAttributionMetricsConversionSourceConversionSourceIdGet.');
- }
-
- // verify required parameter 'conversionSourceId' is not null or undefined
- if (conversionSourceId === null || conversionSourceId === undefined) {
- throw new Error('Required parameter conversionSourceId was null or undefined when calling ecommerceAttributionMetricsConversionSourceConversionSourceIdGet.');
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "EcommerceAttributionMetricsConversionSourceConversionSourceIdGet200Response");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get attribution metrics for one or more Brevo campaigns
- * @param periodFrom When getting metrics for a specific period, define the starting datetime in RFC3339 format
- * @param periodTo When getting metrics for a specific period, define the end datetime in RFC3339 format
- * @param emailCampaignId The email campaign id(s) to get metrics for
- */
- public async ecommerceAttributionMetricsGet (periodFrom?: Date, periodTo?: Date, emailCampaignId?: Array, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: EcommerceAttributionMetricsGet200Response; }> {
- const localVarPath = this.basePath + '/ecommerce/attribution/metrics';
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- if (periodFrom !== undefined) {
- localVarQueryParameters['periodFrom'] = ObjectSerializer.serialize(periodFrom, "Date");
- }
-
- if (periodTo !== undefined) {
- localVarQueryParameters['periodTo'] = ObjectSerializer.serialize(periodTo, "Date");
- }
-
- if (emailCampaignId !== undefined) {
- localVarQueryParameters['emailCampaignId[]'] = ObjectSerializer.serialize(emailCampaignId, "Array");
- }
-
- (Object).assign(localVarHeaderParams, options.headers);
-
- let localVarUseFormData = false;
-
- let localVarRequestOptions: localVarRequest.Options = {
- method: 'GET',
- qs: localVarQueryParameters,
- headers: localVarHeaderParams,
- uri: localVarPath,
- useQuerystring: this._useQuerystring,
- json: true,
- };
-
- let authenticationPromise = Promise.resolve();
- if (this.authentications.apiKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
- }
- if (this.authentications.partnerKey.apiKey) {
- authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
- }
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
-
- let interceptorPromise = authenticationPromise;
- for (const interceptor of this.interceptors) {
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
- }
-
- return interceptorPromise.then(() => {
- if (Object.keys(localVarFormParams).length) {
- if (localVarUseFormData) {
- (localVarRequestOptions).formData = localVarFormParams;
- } else {
- localVarRequestOptions.form = localVarFormParams;
- }
- }
- return new Promise<{ response: http.IncomingMessage; body: EcommerceAttributionMetricsGet200Response; }>((resolve, reject) => {
- localVarRequest(localVarRequestOptions, (error, response, body) => {
- if (error) {
- reject(error);
- } else {
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
- body = ObjectSerializer.deserialize(body, "EcommerceAttributionMetricsGet200Response");
- resolve({ response: response, body: body });
- } else {
- reject(new HttpError(response, body, response.statusCode));
- }
- }
- });
- });
- });
- }
- /**
- *
- * @summary Get attributed product sales for a single Brevo campaign
- * @param conversionSource The Brevo campaign type for which data will be retrieved
- * @param conversionSourceId The Brevo campaign id for which data will be retrieved
- */
- public async ecommerceAttributionProductsConversionSourceConversionSourceIdGet (conversionSource: 'email_campaign', conversionSourceId: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: EcommerceAttributionProductsConversionSourceConversionSourceIdGet200Response; }> {
- const localVarPath = this.basePath + '/ecommerce/attribution/products/{conversionSource}/{conversionSourceId}'
- .replace('{' + 'conversionSource' + '}', encodeURIComponent(String(conversionSource)))
- .replace('{' + 'conversionSourceId' + '}', encodeURIComponent(String(conversionSourceId)));
- let localVarQueryParameters: any = {};
- let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
- const produces = ['application/json'];
- // give precedence to 'application/json'
- if (produces.indexOf('application/json') >= 0) {
- localVarHeaderParams.Accept = 'application/json';
- } else {
- localVarHeaderParams.Accept = produces.join(',');
- }
- let localVarFormParams: any = {};
-
- // verify required parameter 'conversionSource' is not null or undefined
- if (conversionSource === null || conversionSource === undefined) {
- throw new Error('Required parameter conversionSource was null or undefined when calling ecommerceAttributionProductsConversionSourceConversionSourceIdGet.');
- }
-
- // verify required parameter 'conversionSourceId' is not null or undefined
- if (conversionSourceId === null || conversionSourceId === undefined) {
- throw new Error('Required parameter conversionSourceId was null or undefined when calling ecommerceAttributionProductsConversionSourceConversionSourceIdGet.');
- }
-
- (