diff --git a/.fern/metadata.json b/.fern/metadata.json index 028f542..a4f544f 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,7 +1,7 @@ { - "cliVersion": "4.25.0", + "cliVersion": "4.43.1", "generatorName": "fernapi/fern-typescript-sdk", - "generatorVersion": "3.48.2", + "generatorVersion": "3.59.4", "generatorConfig": { "generateWireTests": true, "namespaceExport": "Brevo", @@ -15,6 +15,6 @@ } } }, - "originGitCommit": "0270908073ab43956eab9fce001fe4f6c09affc5", - "sdkVersion": "5.0.2" + "originGitCommit": "7d08ac3fbe2aa66ba3d56077e8582739d530298b", + "sdkVersion": "5.0.3" } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c70c5b..4163539 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,10 @@ name: ci on: [push] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + jobs: compile: runs-on: ubuntu-latest @@ -74,5 +78,13 @@ jobs: elif [[ ${GITHUB_REF} == *beta* ]]; then publish --access public --tag beta else - publish --access public + PKG_NAME=$(node -p "require('./package.json').name") + PKG_VERSION=$(node -p "require('./package.json').version") + CURRENT_LATEST=$(npm view "${PKG_NAME}" dist-tags.latest 2>/dev/null || echo "0.0.0") + if npx -y semver "${PKG_VERSION}" -r "<${CURRENT_LATEST}" > /dev/null 2>&1; then + echo "Publishing ${PKG_VERSION} with --tag backport (current latest is ${CURRENT_LATEST})" + publish --access public --tag backport + else + publish --access public + fi fi \ No newline at end of file diff --git a/biome.json b/biome.json index 371d365..5084b70 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/2.3.11/schema.json", + "$schema": "https://biomejs.dev/schemas/2.4.3/schema.json", "root": true, "vcs": { "enabled": false diff --git a/package.json b/package.json index 424efc4..08a3db8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@getbrevo/brevo", - "version": "5.0.2", + "version": "5.0.3", "private": false, "repository": { "type": "git", @@ -12,7 +12,6 @@ "types": "./dist/cjs/index.d.ts", "exports": { ".": { - "types": "./dist/cjs/index.d.ts", "import": { "types": "./dist/esm/index.d.mts", "default": "./dist/esm/index.mjs" @@ -23,6 +22,358 @@ }, "default": "./dist/cjs/index.js" }, + "./account": { + "import": { + "types": "./dist/esm/api/resources/account/exports.d.mts", + "default": "./dist/esm/api/resources/account/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/account/exports.d.ts", + "default": "./dist/cjs/api/resources/account/exports.js" + }, + "default": "./dist/cjs/api/resources/account/exports.js" + }, + "./masterAccount": { + "import": { + "types": "./dist/esm/api/resources/masterAccount/exports.d.mts", + "default": "./dist/esm/api/resources/masterAccount/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/masterAccount/exports.d.ts", + "default": "./dist/cjs/api/resources/masterAccount/exports.js" + }, + "default": "./dist/cjs/api/resources/masterAccount/exports.js" + }, + "./user": { + "import": { + "types": "./dist/esm/api/resources/user/exports.d.mts", + "default": "./dist/esm/api/resources/user/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/user/exports.d.ts", + "default": "./dist/cjs/api/resources/user/exports.js" + }, + "default": "./dist/cjs/api/resources/user/exports.js" + }, + "./process": { + "import": { + "types": "./dist/esm/api/resources/process/exports.d.mts", + "default": "./dist/esm/api/resources/process/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/process/exports.d.ts", + "default": "./dist/cjs/api/resources/process/exports.js" + }, + "default": "./dist/cjs/api/resources/process/exports.js" + }, + "./senders": { + "import": { + "types": "./dist/esm/api/resources/senders/exports.d.mts", + "default": "./dist/esm/api/resources/senders/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/senders/exports.d.ts", + "default": "./dist/cjs/api/resources/senders/exports.js" + }, + "default": "./dist/cjs/api/resources/senders/exports.js" + }, + "./domains": { + "import": { + "types": "./dist/esm/api/resources/domains/exports.d.mts", + "default": "./dist/esm/api/resources/domains/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/domains/exports.d.ts", + "default": "./dist/cjs/api/resources/domains/exports.js" + }, + "default": "./dist/cjs/api/resources/domains/exports.js" + }, + "./webhooks": { + "import": { + "types": "./dist/esm/api/resources/webhooks/exports.d.mts", + "default": "./dist/esm/api/resources/webhooks/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/webhooks/exports.d.ts", + "default": "./dist/cjs/api/resources/webhooks/exports.js" + }, + "default": "./dist/cjs/api/resources/webhooks/exports.js" + }, + "./externalFeeds": { + "import": { + "types": "./dist/esm/api/resources/externalFeeds/exports.d.mts", + "default": "./dist/esm/api/resources/externalFeeds/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/externalFeeds/exports.d.ts", + "default": "./dist/cjs/api/resources/externalFeeds/exports.js" + }, + "default": "./dist/cjs/api/resources/externalFeeds/exports.js" + }, + "./customObjects": { + "import": { + "types": "./dist/esm/api/resources/customObjects/exports.d.mts", + "default": "./dist/esm/api/resources/customObjects/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/customObjects/exports.d.ts", + "default": "./dist/cjs/api/resources/customObjects/exports.js" + }, + "default": "./dist/cjs/api/resources/customObjects/exports.js" + }, + "./contacts": { + "import": { + "types": "./dist/esm/api/resources/contacts/exports.d.mts", + "default": "./dist/esm/api/resources/contacts/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/contacts/exports.d.ts", + "default": "./dist/cjs/api/resources/contacts/exports.js" + }, + "default": "./dist/cjs/api/resources/contacts/exports.js" + }, + "./conversations": { + "import": { + "types": "./dist/esm/api/resources/conversations/exports.d.mts", + "default": "./dist/esm/api/resources/conversations/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/conversations/exports.d.ts", + "default": "./dist/cjs/api/resources/conversations/exports.js" + }, + "default": "./dist/cjs/api/resources/conversations/exports.js" + }, + "./ecommerce": { + "import": { + "types": "./dist/esm/api/resources/ecommerce/exports.d.mts", + "default": "./dist/esm/api/resources/ecommerce/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/ecommerce/exports.d.ts", + "default": "./dist/cjs/api/resources/ecommerce/exports.js" + }, + "default": "./dist/cjs/api/resources/ecommerce/exports.js" + }, + "./coupons": { + "import": { + "types": "./dist/esm/api/resources/coupons/exports.d.mts", + "default": "./dist/esm/api/resources/coupons/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/coupons/exports.d.ts", + "default": "./dist/cjs/api/resources/coupons/exports.js" + }, + "default": "./dist/cjs/api/resources/coupons/exports.js" + }, + "./payments": { + "import": { + "types": "./dist/esm/api/resources/payments/exports.d.mts", + "default": "./dist/esm/api/resources/payments/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/payments/exports.d.ts", + "default": "./dist/cjs/api/resources/payments/exports.js" + }, + "default": "./dist/cjs/api/resources/payments/exports.js" + }, + "./event": { + "import": { + "types": "./dist/esm/api/resources/event/exports.d.mts", + "default": "./dist/esm/api/resources/event/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/event/exports.d.ts", + "default": "./dist/cjs/api/resources/event/exports.js" + }, + "default": "./dist/cjs/api/resources/event/exports.js" + }, + "./inboundParsing": { + "import": { + "types": "./dist/esm/api/resources/inboundParsing/exports.d.mts", + "default": "./dist/esm/api/resources/inboundParsing/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/inboundParsing/exports.d.ts", + "default": "./dist/cjs/api/resources/inboundParsing/exports.js" + }, + "default": "./dist/cjs/api/resources/inboundParsing/exports.js" + }, + "./balance": { + "import": { + "types": "./dist/esm/api/resources/balance/exports.d.mts", + "default": "./dist/esm/api/resources/balance/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/balance/exports.d.ts", + "default": "./dist/cjs/api/resources/balance/exports.js" + }, + "default": "./dist/cjs/api/resources/balance/exports.js" + }, + "./program": { + "import": { + "types": "./dist/esm/api/resources/program/exports.d.mts", + "default": "./dist/esm/api/resources/program/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/program/exports.d.ts", + "default": "./dist/cjs/api/resources/program/exports.js" + }, + "default": "./dist/cjs/api/resources/program/exports.js" + }, + "./reward": { + "import": { + "types": "./dist/esm/api/resources/reward/exports.d.mts", + "default": "./dist/esm/api/resources/reward/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/reward/exports.d.ts", + "default": "./dist/cjs/api/resources/reward/exports.js" + }, + "default": "./dist/cjs/api/resources/reward/exports.js" + }, + "./tier": { + "import": { + "types": "./dist/esm/api/resources/tier/exports.d.mts", + "default": "./dist/esm/api/resources/tier/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/tier/exports.d.ts", + "default": "./dist/cjs/api/resources/tier/exports.js" + }, + "default": "./dist/cjs/api/resources/tier/exports.js" + }, + "./emailCampaigns": { + "import": { + "types": "./dist/esm/api/resources/emailCampaigns/exports.d.mts", + "default": "./dist/esm/api/resources/emailCampaigns/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/emailCampaigns/exports.d.ts", + "default": "./dist/cjs/api/resources/emailCampaigns/exports.js" + }, + "default": "./dist/cjs/api/resources/emailCampaigns/exports.js" + }, + "./smsCampaigns": { + "import": { + "types": "./dist/esm/api/resources/smsCampaigns/exports.d.mts", + "default": "./dist/esm/api/resources/smsCampaigns/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/smsCampaigns/exports.d.ts", + "default": "./dist/cjs/api/resources/smsCampaigns/exports.js" + }, + "default": "./dist/cjs/api/resources/smsCampaigns/exports.js" + }, + "./whatsAppCampaigns": { + "import": { + "types": "./dist/esm/api/resources/whatsAppCampaigns/exports.d.mts", + "default": "./dist/esm/api/resources/whatsAppCampaigns/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/whatsAppCampaigns/exports.d.ts", + "default": "./dist/cjs/api/resources/whatsAppCampaigns/exports.js" + }, + "default": "./dist/cjs/api/resources/whatsAppCampaigns/exports.js" + }, + "./companies": { + "import": { + "types": "./dist/esm/api/resources/companies/exports.d.mts", + "default": "./dist/esm/api/resources/companies/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/companies/exports.d.ts", + "default": "./dist/cjs/api/resources/companies/exports.js" + }, + "default": "./dist/cjs/api/resources/companies/exports.js" + }, + "./deals": { + "import": { + "types": "./dist/esm/api/resources/deals/exports.d.mts", + "default": "./dist/esm/api/resources/deals/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/deals/exports.d.ts", + "default": "./dist/cjs/api/resources/deals/exports.js" + }, + "default": "./dist/cjs/api/resources/deals/exports.js" + }, + "./files": { + "import": { + "types": "./dist/esm/api/resources/files/exports.d.mts", + "default": "./dist/esm/api/resources/files/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/files/exports.d.ts", + "default": "./dist/cjs/api/resources/files/exports.js" + }, + "default": "./dist/cjs/api/resources/files/exports.js" + }, + "./notes": { + "import": { + "types": "./dist/esm/api/resources/notes/exports.d.mts", + "default": "./dist/esm/api/resources/notes/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/notes/exports.d.ts", + "default": "./dist/cjs/api/resources/notes/exports.js" + }, + "default": "./dist/cjs/api/resources/notes/exports.js" + }, + "./tasks": { + "import": { + "types": "./dist/esm/api/resources/tasks/exports.d.mts", + "default": "./dist/esm/api/resources/tasks/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/tasks/exports.d.ts", + "default": "./dist/cjs/api/resources/tasks/exports.js" + }, + "default": "./dist/cjs/api/resources/tasks/exports.js" + }, + "./transactionalWhatsApp": { + "import": { + "types": "./dist/esm/api/resources/transactionalWhatsApp/exports.d.mts", + "default": "./dist/esm/api/resources/transactionalWhatsApp/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/transactionalWhatsApp/exports.d.ts", + "default": "./dist/cjs/api/resources/transactionalWhatsApp/exports.js" + }, + "default": "./dist/cjs/api/resources/transactionalWhatsApp/exports.js" + }, + "./transactionalEmails": { + "import": { + "types": "./dist/esm/api/resources/transactionalEmails/exports.d.mts", + "default": "./dist/esm/api/resources/transactionalEmails/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/transactionalEmails/exports.d.ts", + "default": "./dist/cjs/api/resources/transactionalEmails/exports.js" + }, + "default": "./dist/cjs/api/resources/transactionalEmails/exports.js" + }, + "./transactionalSms": { + "import": { + "types": "./dist/esm/api/resources/transactionalSms/exports.d.mts", + "default": "./dist/esm/api/resources/transactionalSms/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/transactionalSms/exports.d.ts", + "default": "./dist/cjs/api/resources/transactionalSms/exports.js" + }, + "default": "./dist/cjs/api/resources/transactionalSms/exports.js" + }, + "./smsTemplates": { + "import": { + "types": "./dist/esm/api/resources/smsTemplates/exports.d.mts", + "default": "./dist/esm/api/resources/smsTemplates/exports.mjs" + }, + "require": { + "types": "./dist/cjs/api/resources/smsTemplates/exports.d.ts", + "default": "./dist/cjs/api/resources/smsTemplates/exports.js" + }, + "default": "./dist/cjs/api/resources/smsTemplates/exports.js" + }, "./package.json": "./package.json" }, "files": [ @@ -53,13 +404,14 @@ "msw": "2.11.2", "@types/node": "^18.19.70", "typescript": "~5.7.2", - "@biomejs/biome": "2.3.11" + "@biomejs/biome": "2.4.3" }, "browser": { "fs": false, "os": false, "path": false, - "stream": false + "stream": false, + "crypto": false }, "packageManager": "pnpm@10.20.0", "engines": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 08ec090..410054a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: devDependencies: '@biomejs/biome': - specifier: 2.3.11 - version: 2.3.11 + specifier: 2.4.3 + version: 2.4.3 '@types/node': specifier: ^18.19.70 version: 18.19.130 @@ -19,68 +19,68 @@ importers: version: 2.11.2(@types/node@18.19.130)(typescript@5.7.3) ts-loader: specifier: ^9.5.1 - version: 9.5.4(typescript@5.7.3)(webpack@5.105.2) + version: 9.5.4(typescript@5.7.3)(webpack@5.105.4) typescript: specifier: ~5.7.2 version: 5.7.3 vitest: specifier: ^3.2.4 - version: 3.2.4(@types/node@18.19.130)(msw@2.11.2(@types/node@18.19.130)(typescript@5.7.3))(terser@5.46.0) + version: 3.2.4(@types/node@18.19.130)(msw@2.11.2(@types/node@18.19.130)(typescript@5.7.3))(terser@5.46.1) webpack: specifier: ^5.97.1 - version: 5.105.2 + version: 5.105.4 packages: - '@biomejs/biome@2.3.11': - resolution: {integrity: sha512-/zt+6qazBWguPG6+eWmiELqO+9jRsMZ/DBU3lfuU2ngtIQYzymocHhKiZRyrbra4aCOoyTg/BmY+6WH5mv9xmQ==} + '@biomejs/biome@2.4.3': + resolution: {integrity: sha512-cBrjf6PNF6yfL8+kcNl85AjiK2YHNsbU0EvDOwiZjBPbMbQ5QcgVGFpjD0O52p8nec5O8NYw7PKw3xUR7fPAkQ==} engines: {node: '>=14.21.3'} hasBin: true - '@biomejs/cli-darwin-arm64@2.3.11': - resolution: {integrity: sha512-/uXXkBcPKVQY7rc9Ys2CrlirBJYbpESEDme7RKiBD6MmqR2w3j0+ZZXRIL2xiaNPsIMMNhP1YnA+jRRxoOAFrA==} + '@biomejs/cli-darwin-arm64@2.4.3': + resolution: {integrity: sha512-eOafSFlI/CF4id2tlwq9CVHgeEqvTL5SrhWff6ZORp6S3NL65zdsR3ugybItkgF8Pf4D9GSgtbB6sE3UNgOM9w==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [darwin] - '@biomejs/cli-darwin-x64@2.3.11': - resolution: {integrity: sha512-fh7nnvbweDPm2xEmFjfmq7zSUiox88plgdHF9OIW4i99WnXrAC3o2P3ag9judoUMv8FCSUnlwJCM1B64nO5Fbg==} + '@biomejs/cli-darwin-x64@2.4.3': + resolution: {integrity: sha512-V2+av4ilbWcBMNufTtMMXVW00nPwyIjI5qf7n9wSvUaZ+tt0EvMGk46g9sAFDJBEDOzSyoRXiSP6pCvKTOEbPA==} engines: {node: '>=14.21.3'} cpu: [x64] os: [darwin] - '@biomejs/cli-linux-arm64-musl@2.3.11': - resolution: {integrity: sha512-XPSQ+XIPZMLaZ6zveQdwNjbX+QdROEd1zPgMwD47zvHV+tCGB88VH+aynyGxAHdzL+Tm/+DtKST5SECs4iwCLg==} + '@biomejs/cli-linux-arm64-musl@2.4.3': + resolution: {integrity: sha512-QuFzvsGo8BA4Xm7jGX5idkw6BqFblcCPySMTvq0AhGYnhUej5VJIDJbmTKfHqwjHepZiC4fA+T5i6wmiZolZNw==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] - '@biomejs/cli-linux-arm64@2.3.11': - resolution: {integrity: sha512-l4xkGa9E7Uc0/05qU2lMYfN1H+fzzkHgaJoy98wO+b/7Gl78srbCRRgwYSW+BTLixTBrM6Ede5NSBwt7rd/i6g==} + '@biomejs/cli-linux-arm64@2.4.3': + resolution: {integrity: sha512-0m+O0x9FgK99FAwDK+fiDtjs2wnqq7bvfj17KJVeCkTwT/liI+Q9njJG7lwXK0iSJVXeFNRIxukpVI3SifMYAA==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] - '@biomejs/cli-linux-x64-musl@2.3.11': - resolution: {integrity: sha512-vU7a8wLs5C9yJ4CB8a44r12aXYb8yYgBn+WeyzbMjaCMklzCv1oXr8x+VEyWodgJt9bDmhiaW/I0RHbn7rsNmw==} + '@biomejs/cli-linux-x64-musl@2.4.3': + resolution: {integrity: sha512-qEc0OCpj/uytruQ4wLM0yWNJLZy0Up8H1Er5MW3SrstqM6J2d4XqdNA86xzCy8MQCHpoVZ3lFye3GBlIL4/ljw==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] - '@biomejs/cli-linux-x64@2.3.11': - resolution: {integrity: sha512-/1s9V/H3cSe0r0Mv/Z8JryF5x9ywRxywomqZVLHAoa/uN0eY7F8gEngWKNS5vbbN/BsfpCG5yeBT5ENh50Frxg==} + '@biomejs/cli-linux-x64@2.4.3': + resolution: {integrity: sha512-NVqh0saIU0u5OfOp/0jFdlKRE59+XyMvWmtx0f6Nm/2OpdxBl04coRIftBbY9d1gfu+23JVv4CItAqPYrjYh5w==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] - '@biomejs/cli-win32-arm64@2.3.11': - resolution: {integrity: sha512-PZQ6ElCOnkYapSsysiTy0+fYX+agXPlWugh6+eQ6uPKI3vKAqNp6TnMhoM3oY2NltSB89hz59o8xIfOdyhi9Iw==} + '@biomejs/cli-win32-arm64@2.4.3': + resolution: {integrity: sha512-gRO96vrIARilv/Cp2ZnmNNL5LSZg3RO75GPp13hsLO3N4YVpE7saaMDp2bcyV48y2N2Pbit1brkGVGta0yd6VQ==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [win32] - '@biomejs/cli-win32-x64@2.3.11': - resolution: {integrity: sha512-43VrG813EW+b5+YbDbz31uUsheX+qFKCpXeY9kfdAx+ww3naKxeVkTD9zLIWxUPfJquANMHrmW3wbe/037G0Qg==} + '@biomejs/cli-win32-x64@2.4.3': + resolution: {integrity: sha512-vSm/vOJe06pf14aGHfHl3Ar91Nlx4YYmohElDJ+17UbRwe99n987S/MhAlQOkONqf1utJor04ChkCPmKb8SWdw==} engines: {node: '>=14.21.3'} cpu: [x64] os: [win32] @@ -91,158 +91,158 @@ packages: '@bundled-es-modules/statuses@1.0.1': resolution: {integrity: sha512-yn7BklA5acgcBr+7w064fGV+SGIFySjCKpqjcWgBAIfrAkY+4GQTJJHQMeT3V/sgz23VTEVV8TtOmkvJAhFVfg==} - '@esbuild/aix-ppc64@0.27.3': - resolution: {integrity: sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==} + '@esbuild/aix-ppc64@0.27.4': + resolution: {integrity: sha512-cQPwL2mp2nSmHHJlCyoXgHGhbEPMrEEU5xhkcy3Hs/O7nGZqEpZ2sUtLaL9MORLtDfRvVl2/3PAuEkYZH0Ty8Q==} engines: {node: '>=18'} cpu: [ppc64] os: [aix] - '@esbuild/android-arm64@0.27.3': - resolution: {integrity: sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==} + '@esbuild/android-arm64@0.27.4': + resolution: {integrity: sha512-gdLscB7v75wRfu7QSm/zg6Rx29VLdy9eTr2t44sfTW7CxwAtQghZ4ZnqHk3/ogz7xao0QAgrkradbBzcqFPasw==} engines: {node: '>=18'} cpu: [arm64] os: [android] - '@esbuild/android-arm@0.27.3': - resolution: {integrity: sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==} + '@esbuild/android-arm@0.27.4': + resolution: {integrity: sha512-X9bUgvxiC8CHAGKYufLIHGXPJWnr0OCdR0anD2e21vdvgCI8lIfqFbnoeOz7lBjdrAGUhqLZLcQo6MLhTO2DKQ==} engines: {node: '>=18'} cpu: [arm] os: [android] - '@esbuild/android-x64@0.27.3': - resolution: {integrity: sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==} + '@esbuild/android-x64@0.27.4': + resolution: {integrity: sha512-PzPFnBNVF292sfpfhiyiXCGSn9HZg5BcAz+ivBuSsl6Rk4ga1oEXAamhOXRFyMcjwr2DVtm40G65N3GLeH1Lvw==} engines: {node: '>=18'} cpu: [x64] os: [android] - '@esbuild/darwin-arm64@0.27.3': - resolution: {integrity: sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==} + '@esbuild/darwin-arm64@0.27.4': + resolution: {integrity: sha512-b7xaGIwdJlht8ZFCvMkpDN6uiSmnxxK56N2GDTMYPr2/gzvfdQN8rTfBsvVKmIVY/X7EM+/hJKEIbbHs9oA4tQ==} engines: {node: '>=18'} cpu: [arm64] os: [darwin] - '@esbuild/darwin-x64@0.27.3': - resolution: {integrity: sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==} + '@esbuild/darwin-x64@0.27.4': + resolution: {integrity: sha512-sR+OiKLwd15nmCdqpXMnuJ9W2kpy0KigzqScqHI3Hqwr7IXxBp3Yva+yJwoqh7rE8V77tdoheRYataNKL4QrPw==} engines: {node: '>=18'} cpu: [x64] os: [darwin] - '@esbuild/freebsd-arm64@0.27.3': - resolution: {integrity: sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==} + '@esbuild/freebsd-arm64@0.27.4': + resolution: {integrity: sha512-jnfpKe+p79tCnm4GVav68A7tUFeKQwQyLgESwEAUzyxk/TJr4QdGog9sqWNcUbr/bZt/O/HXouspuQDd9JxFSw==} engines: {node: '>=18'} cpu: [arm64] os: [freebsd] - '@esbuild/freebsd-x64@0.27.3': - resolution: {integrity: sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==} + '@esbuild/freebsd-x64@0.27.4': + resolution: {integrity: sha512-2kb4ceA/CpfUrIcTUl1wrP/9ad9Atrp5J94Lq69w7UwOMolPIGrfLSvAKJp0RTvkPPyn6CIWrNy13kyLikZRZQ==} engines: {node: '>=18'} cpu: [x64] os: [freebsd] - '@esbuild/linux-arm64@0.27.3': - resolution: {integrity: sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==} + '@esbuild/linux-arm64@0.27.4': + resolution: {integrity: sha512-7nQOttdzVGth1iz57kxg9uCz57dxQLHWxopL6mYuYthohPKEK0vU0C3O21CcBK6KDlkYVcnDXY099HcCDXd9dA==} engines: {node: '>=18'} cpu: [arm64] os: [linux] - '@esbuild/linux-arm@0.27.3': - resolution: {integrity: sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==} + '@esbuild/linux-arm@0.27.4': + resolution: {integrity: sha512-aBYgcIxX/wd5n2ys0yESGeYMGF+pv6g0DhZr3G1ZG4jMfruU9Tl1i2Z+Wnj9/KjGz1lTLCcorqE2viePZqj4Eg==} engines: {node: '>=18'} cpu: [arm] os: [linux] - '@esbuild/linux-ia32@0.27.3': - resolution: {integrity: sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==} + '@esbuild/linux-ia32@0.27.4': + resolution: {integrity: sha512-oPtixtAIzgvzYcKBQM/qZ3R+9TEUd1aNJQu0HhGyqtx6oS7qTpvjheIWBbes4+qu1bNlo2V4cbkISr8q6gRBFA==} engines: {node: '>=18'} cpu: [ia32] os: [linux] - '@esbuild/linux-loong64@0.27.3': - resolution: {integrity: sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==} + '@esbuild/linux-loong64@0.27.4': + resolution: {integrity: sha512-8mL/vh8qeCoRcFH2nM8wm5uJP+ZcVYGGayMavi8GmRJjuI3g1v6Z7Ni0JJKAJW+m0EtUuARb6Lmp4hMjzCBWzA==} engines: {node: '>=18'} cpu: [loong64] os: [linux] - '@esbuild/linux-mips64el@0.27.3': - resolution: {integrity: sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==} + '@esbuild/linux-mips64el@0.27.4': + resolution: {integrity: sha512-1RdrWFFiiLIW7LQq9Q2NES+HiD4NyT8Itj9AUeCl0IVCA459WnPhREKgwrpaIfTOe+/2rdntisegiPWn/r/aAw==} engines: {node: '>=18'} cpu: [mips64el] os: [linux] - '@esbuild/linux-ppc64@0.27.3': - resolution: {integrity: sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==} + '@esbuild/linux-ppc64@0.27.4': + resolution: {integrity: sha512-tLCwNG47l3sd9lpfyx9LAGEGItCUeRCWeAx6x2Jmbav65nAwoPXfewtAdtbtit/pJFLUWOhpv0FpS6GQAmPrHA==} engines: {node: '>=18'} cpu: [ppc64] os: [linux] - '@esbuild/linux-riscv64@0.27.3': - resolution: {integrity: sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==} + '@esbuild/linux-riscv64@0.27.4': + resolution: {integrity: sha512-BnASypppbUWyqjd1KIpU4AUBiIhVr6YlHx/cnPgqEkNoVOhHg+YiSVxM1RLfiy4t9cAulbRGTNCKOcqHrEQLIw==} engines: {node: '>=18'} cpu: [riscv64] os: [linux] - '@esbuild/linux-s390x@0.27.3': - resolution: {integrity: sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==} + '@esbuild/linux-s390x@0.27.4': + resolution: {integrity: sha512-+eUqgb/Z7vxVLezG8bVB9SfBie89gMueS+I0xYh2tJdw3vqA/0ImZJ2ROeWwVJN59ihBeZ7Tu92dF/5dy5FttA==} engines: {node: '>=18'} cpu: [s390x] os: [linux] - '@esbuild/linux-x64@0.27.3': - resolution: {integrity: sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==} + '@esbuild/linux-x64@0.27.4': + resolution: {integrity: sha512-S5qOXrKV8BQEzJPVxAwnryi2+Iq5pB40gTEIT69BQONqR7JH1EPIcQ/Uiv9mCnn05jff9umq/5nqzxlqTOg9NA==} engines: {node: '>=18'} cpu: [x64] os: [linux] - '@esbuild/netbsd-arm64@0.27.3': - resolution: {integrity: sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==} + '@esbuild/netbsd-arm64@0.27.4': + resolution: {integrity: sha512-xHT8X4sb0GS8qTqiwzHqpY00C95DPAq7nAwX35Ie/s+LO9830hrMd3oX0ZMKLvy7vsonee73x0lmcdOVXFzd6Q==} engines: {node: '>=18'} cpu: [arm64] os: [netbsd] - '@esbuild/netbsd-x64@0.27.3': - resolution: {integrity: sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==} + '@esbuild/netbsd-x64@0.27.4': + resolution: {integrity: sha512-RugOvOdXfdyi5Tyv40kgQnI0byv66BFgAqjdgtAKqHoZTbTF2QqfQrFwa7cHEORJf6X2ht+l9ABLMP0dnKYsgg==} engines: {node: '>=18'} cpu: [x64] os: [netbsd] - '@esbuild/openbsd-arm64@0.27.3': - resolution: {integrity: sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==} + '@esbuild/openbsd-arm64@0.27.4': + resolution: {integrity: sha512-2MyL3IAaTX+1/qP0O1SwskwcwCoOI4kV2IBX1xYnDDqthmq5ArrW94qSIKCAuRraMgPOmG0RDTA74mzYNQA9ow==} engines: {node: '>=18'} cpu: [arm64] os: [openbsd] - '@esbuild/openbsd-x64@0.27.3': - resolution: {integrity: sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==} + '@esbuild/openbsd-x64@0.27.4': + resolution: {integrity: sha512-u8fg/jQ5aQDfsnIV6+KwLOf1CmJnfu1ShpwqdwC0uA7ZPwFws55Ngc12vBdeUdnuWoQYx/SOQLGDcdlfXhYmXQ==} engines: {node: '>=18'} cpu: [x64] os: [openbsd] - '@esbuild/openharmony-arm64@0.27.3': - resolution: {integrity: sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==} + '@esbuild/openharmony-arm64@0.27.4': + resolution: {integrity: sha512-JkTZrl6VbyO8lDQO3yv26nNr2RM2yZzNrNHEsj9bm6dOwwu9OYN28CjzZkH57bh4w0I2F7IodpQvUAEd1mbWXg==} engines: {node: '>=18'} cpu: [arm64] os: [openharmony] - '@esbuild/sunos-x64@0.27.3': - resolution: {integrity: sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==} + '@esbuild/sunos-x64@0.27.4': + resolution: {integrity: sha512-/gOzgaewZJfeJTlsWhvUEmUG4tWEY2Spp5M20INYRg2ZKl9QPO3QEEgPeRtLjEWSW8FilRNacPOg8R1uaYkA6g==} engines: {node: '>=18'} cpu: [x64] os: [sunos] - '@esbuild/win32-arm64@0.27.3': - resolution: {integrity: sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==} + '@esbuild/win32-arm64@0.27.4': + resolution: {integrity: sha512-Z9SExBg2y32smoDQdf1HRwHRt6vAHLXcxD2uGgO/v2jK7Y718Ix4ndsbNMU/+1Qiem9OiOdaqitioZwxivhXYg==} engines: {node: '>=18'} cpu: [arm64] os: [win32] - '@esbuild/win32-ia32@0.27.3': - resolution: {integrity: sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==} + '@esbuild/win32-ia32@0.27.4': + resolution: {integrity: sha512-DAyGLS0Jz5G5iixEbMHi5KdiApqHBWMGzTtMiJ72ZOLhbu/bzxgAe8Ue8CTS3n3HbIUHQz/L51yMdGMeoxXNJw==} engines: {node: '>=18'} cpu: [ia32] os: [win32] - '@esbuild/win32-x64@0.27.3': - resolution: {integrity: sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==} + '@esbuild/win32-x64@0.27.4': + resolution: {integrity: sha512-+knoa0BDoeXgkNvvV1vvbZX4+hizelrkwmGJBdT17t8FNPwG2lKemmuMZlmaNQ3ws3DKKCxpb4zRZEIp3UxFCg==} engines: {node: '>=18'} cpu: [x64] os: [win32] @@ -311,128 +311,128 @@ packages: '@open-draft/until@2.1.0': resolution: {integrity: sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg==} - '@rollup/rollup-android-arm-eabi@4.57.1': - resolution: {integrity: sha512-A6ehUVSiSaaliTxai040ZpZ2zTevHYbvu/lDoeAteHI8QnaosIzm4qwtezfRg1jOYaUmnzLX1AOD6Z+UJjtifg==} + '@rollup/rollup-android-arm-eabi@4.60.0': + resolution: {integrity: sha512-WOhNW9K8bR3kf4zLxbfg6Pxu2ybOUbB2AjMDHSQx86LIF4rH4Ft7vmMwNt0loO0eonglSNy4cpD3MKXXKQu0/A==} cpu: [arm] os: [android] - '@rollup/rollup-android-arm64@4.57.1': - resolution: {integrity: sha512-dQaAddCY9YgkFHZcFNS/606Exo8vcLHwArFZ7vxXq4rigo2bb494/xKMMwRRQW6ug7Js6yXmBZhSBRuBvCCQ3w==} + '@rollup/rollup-android-arm64@4.60.0': + resolution: {integrity: sha512-u6JHLll5QKRvjciE78bQXDmqRqNs5M/3GVqZeMwvmjaNODJih/WIrJlFVEihvV0MiYFmd+ZyPr9wxOVbPAG2Iw==} cpu: [arm64] os: [android] - '@rollup/rollup-darwin-arm64@4.57.1': - resolution: {integrity: sha512-crNPrwJOrRxagUYeMn/DZwqN88SDmwaJ8Cvi/TN1HnWBU7GwknckyosC2gd0IqYRsHDEnXf328o9/HC6OkPgOg==} + '@rollup/rollup-darwin-arm64@4.60.0': + resolution: {integrity: sha512-qEF7CsKKzSRc20Ciu2Zw1wRrBz4g56F7r/vRwY430UPp/nt1x21Q/fpJ9N5l47WWvJlkNCPJz3QRVw008fi7yA==} cpu: [arm64] os: [darwin] - '@rollup/rollup-darwin-x64@4.57.1': - resolution: {integrity: sha512-Ji8g8ChVbKrhFtig5QBV7iMaJrGtpHelkB3lsaKzadFBe58gmjfGXAOfI5FV0lYMH8wiqsxKQ1C9B0YTRXVy4w==} + '@rollup/rollup-darwin-x64@4.60.0': + resolution: {integrity: sha512-WADYozJ4QCnXCH4wPB+3FuGmDPoFseVCUrANmA5LWwGmC6FL14BWC7pcq+FstOZv3baGX65tZ378uT6WG8ynTw==} cpu: [x64] os: [darwin] - '@rollup/rollup-freebsd-arm64@4.57.1': - resolution: {integrity: sha512-R+/WwhsjmwodAcz65guCGFRkMb4gKWTcIeLy60JJQbXrJ97BOXHxnkPFrP+YwFlaS0m+uWJTstrUA9o+UchFug==} + '@rollup/rollup-freebsd-arm64@4.60.0': + resolution: {integrity: sha512-6b8wGHJlDrGeSE3aH5mGNHBjA0TTkxdoNHik5EkvPHCt351XnigA4pS7Wsj/Eo9Y8RBU6f35cjN9SYmCFBtzxw==} cpu: [arm64] os: [freebsd] - '@rollup/rollup-freebsd-x64@4.57.1': - resolution: {integrity: sha512-IEQTCHeiTOnAUC3IDQdzRAGj3jOAYNr9kBguI7MQAAZK3caezRrg0GxAb6Hchg4lxdZEI5Oq3iov/w/hnFWY9Q==} + '@rollup/rollup-freebsd-x64@4.60.0': + resolution: {integrity: sha512-h25Ga0t4jaylMB8M/JKAyrvvfxGRjnPQIR8lnCayyzEjEOx2EJIlIiMbhpWxDRKGKF8jbNH01NnN663dH638mA==} cpu: [x64] os: [freebsd] - '@rollup/rollup-linux-arm-gnueabihf@4.57.1': - resolution: {integrity: sha512-F8sWbhZ7tyuEfsmOxwc2giKDQzN3+kuBLPwwZGyVkLlKGdV1nvnNwYD0fKQ8+XS6hp9nY7B+ZeK01EBUE7aHaw==} + '@rollup/rollup-linux-arm-gnueabihf@4.60.0': + resolution: {integrity: sha512-RzeBwv0B3qtVBWtcuABtSuCzToo2IEAIQrcyB/b2zMvBWVbjo8bZDjACUpnaafaxhTw2W+imQbP2BD1usasK4g==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm-musleabihf@4.57.1': - resolution: {integrity: sha512-rGfNUfn0GIeXtBP1wL5MnzSj98+PZe/AXaGBCRmT0ts80lU5CATYGxXukeTX39XBKsxzFpEeK+Mrp9faXOlmrw==} + '@rollup/rollup-linux-arm-musleabihf@4.60.0': + resolution: {integrity: sha512-Sf7zusNI2CIU1HLzuu9Tc5YGAHEZs5Lu7N1ssJG4Tkw6e0MEsN7NdjUDDfGNHy2IU+ENyWT+L2obgWiguWibWQ==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm64-gnu@4.57.1': - resolution: {integrity: sha512-MMtej3YHWeg/0klK2Qodf3yrNzz6CGjo2UntLvk2RSPlhzgLvYEB3frRvbEF2wRKh1Z2fDIg9KRPe1fawv7C+g==} + '@rollup/rollup-linux-arm64-gnu@4.60.0': + resolution: {integrity: sha512-DX2x7CMcrJzsE91q7/O02IJQ5/aLkVtYFryqCjduJhUfGKG6yJV8hxaw8pZa93lLEpPTP/ohdN4wFz7yp/ry9A==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-arm64-musl@4.57.1': - resolution: {integrity: sha512-1a/qhaaOXhqXGpMFMET9VqwZakkljWHLmZOX48R0I/YLbhdxr1m4gtG1Hq7++VhVUmf+L3sTAf9op4JlhQ5u1Q==} + '@rollup/rollup-linux-arm64-musl@4.60.0': + resolution: {integrity: sha512-09EL+yFVbJZlhcQfShpswwRZ0Rg+z/CsSELFCnPt3iK+iqwGsI4zht3secj5vLEs957QvFFXnzAT0FFPIxSrkQ==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-loong64-gnu@4.57.1': - resolution: {integrity: sha512-QWO6RQTZ/cqYtJMtxhkRkidoNGXc7ERPbZN7dVW5SdURuLeVU7lwKMpo18XdcmpWYd0qsP1bwKPf7DNSUinhvA==} + '@rollup/rollup-linux-loong64-gnu@4.60.0': + resolution: {integrity: sha512-i9IcCMPr3EXm8EQg5jnja0Zyc1iFxJjZWlb4wr7U2Wx/GrddOuEafxRdMPRYVaXjgbhvqalp6np07hN1w9kAKw==} cpu: [loong64] os: [linux] - '@rollup/rollup-linux-loong64-musl@4.57.1': - resolution: {integrity: sha512-xpObYIf+8gprgWaPP32xiN5RVTi/s5FCR+XMXSKmhfoJjrpRAjCuuqQXyxUa/eJTdAE6eJ+KDKaoEqjZQxh3Gw==} + '@rollup/rollup-linux-loong64-musl@4.60.0': + resolution: {integrity: sha512-DGzdJK9kyJ+B78MCkWeGnpXJ91tK/iKA6HwHxF4TAlPIY7GXEvMe8hBFRgdrR9Ly4qebR/7gfUs9y2IoaVEyog==} cpu: [loong64] os: [linux] - '@rollup/rollup-linux-ppc64-gnu@4.57.1': - resolution: {integrity: sha512-4BrCgrpZo4hvzMDKRqEaW1zeecScDCR+2nZ86ATLhAoJ5FQ+lbHVD3ttKe74/c7tNT9c6F2viwB3ufwp01Oh2w==} + '@rollup/rollup-linux-ppc64-gnu@4.60.0': + resolution: {integrity: sha512-RwpnLsqC8qbS8z1H1AxBA1H6qknR4YpPR9w2XX0vo2Sz10miu57PkNcnHVaZkbqyw/kUWfKMI73jhmfi9BRMUQ==} cpu: [ppc64] os: [linux] - '@rollup/rollup-linux-ppc64-musl@4.57.1': - resolution: {integrity: sha512-NOlUuzesGauESAyEYFSe3QTUguL+lvrN1HtwEEsU2rOwdUDeTMJdO5dUYl/2hKf9jWydJrO9OL/XSSf65R5+Xw==} + '@rollup/rollup-linux-ppc64-musl@4.60.0': + resolution: {integrity: sha512-Z8pPf54Ly3aqtdWC3G4rFigZgNvd+qJlOE52fmko3KST9SoGfAdSRCwyoyG05q1HrrAblLbk1/PSIV+80/pxLg==} cpu: [ppc64] os: [linux] - '@rollup/rollup-linux-riscv64-gnu@4.57.1': - resolution: {integrity: sha512-ptA88htVp0AwUUqhVghwDIKlvJMD/fmL/wrQj99PRHFRAG6Z5nbWoWG4o81Nt9FT+IuqUQi+L31ZKAFeJ5Is+A==} + '@rollup/rollup-linux-riscv64-gnu@4.60.0': + resolution: {integrity: sha512-3a3qQustp3COCGvnP4SvrMHnPQ9d1vzCakQVRTliaz8cIp/wULGjiGpbcqrkv0WrHTEp8bQD/B3HBjzujVWLOA==} cpu: [riscv64] os: [linux] - '@rollup/rollup-linux-riscv64-musl@4.57.1': - resolution: {integrity: sha512-S51t7aMMTNdmAMPpBg7OOsTdn4tySRQvklmL3RpDRyknk87+Sp3xaumlatU+ppQ+5raY7sSTcC2beGgvhENfuw==} + '@rollup/rollup-linux-riscv64-musl@4.60.0': + resolution: {integrity: sha512-pjZDsVH/1VsghMJ2/kAaxt6dL0psT6ZexQVrijczOf+PeP2BUqTHYejk3l6TlPRydggINOeNRhvpLa0AYpCWSQ==} cpu: [riscv64] os: [linux] - '@rollup/rollup-linux-s390x-gnu@4.57.1': - resolution: {integrity: sha512-Bl00OFnVFkL82FHbEqy3k5CUCKH6OEJL54KCyx2oqsmZnFTR8IoNqBF+mjQVcRCT5sB6yOvK8A37LNm/kPJiZg==} + '@rollup/rollup-linux-s390x-gnu@4.60.0': + resolution: {integrity: sha512-3ObQs0BhvPgiUVZrN7gqCSvmFuMWvWvsjG5ayJ3Lraqv+2KhOsp+pUbigqbeWqueGIsnn+09HBw27rJ+gYK4VQ==} cpu: [s390x] os: [linux] - '@rollup/rollup-linux-x64-gnu@4.57.1': - resolution: {integrity: sha512-ABca4ceT4N+Tv/GtotnWAeXZUZuM/9AQyCyKYyKnpk4yoA7QIAuBt6Hkgpw8kActYlew2mvckXkvx0FfoInnLg==} + '@rollup/rollup-linux-x64-gnu@4.60.0': + resolution: {integrity: sha512-EtylprDtQPdS5rXvAayrNDYoJhIz1/vzN2fEubo3yLE7tfAw+948dO0g4M0vkTVFhKojnF+n6C8bDNe+gDRdTg==} cpu: [x64] os: [linux] - '@rollup/rollup-linux-x64-musl@4.57.1': - resolution: {integrity: sha512-HFps0JeGtuOR2convgRRkHCekD7j+gdAuXM+/i6kGzQtFhlCtQkpwtNzkNj6QhCDp7DRJ7+qC/1Vg2jt5iSOFw==} + '@rollup/rollup-linux-x64-musl@4.60.0': + resolution: {integrity: sha512-k09oiRCi/bHU9UVFqD17r3eJR9bn03TyKraCrlz5ULFJGdJGi7VOmm9jl44vOJvRJ6P7WuBi/s2A97LxxHGIdw==} cpu: [x64] os: [linux] - '@rollup/rollup-openbsd-x64@4.57.1': - resolution: {integrity: sha512-H+hXEv9gdVQuDTgnqD+SQffoWoc0Of59AStSzTEj/feWTBAnSfSD3+Dql1ZruJQxmykT/JVY0dE8Ka7z0DH1hw==} + '@rollup/rollup-openbsd-x64@4.60.0': + resolution: {integrity: sha512-1o/0/pIhozoSaDJoDcec+IVLbnRtQmHwPV730+AOD29lHEEo4F5BEUB24H0OBdhbBBDwIOSuf7vgg0Ywxdfiiw==} cpu: [x64] os: [openbsd] - '@rollup/rollup-openharmony-arm64@4.57.1': - resolution: {integrity: sha512-4wYoDpNg6o/oPximyc/NG+mYUejZrCU2q+2w6YZqrAs2UcNUChIZXjtafAiiZSUc7On8v5NyNj34Kzj/Ltk6dQ==} + '@rollup/rollup-openharmony-arm64@4.60.0': + resolution: {integrity: sha512-pESDkos/PDzYwtyzB5p/UoNU/8fJo68vcXM9ZW2V0kjYayj1KaaUfi1NmTUTUpMn4UhU4gTuK8gIaFO4UGuMbA==} cpu: [arm64] os: [openharmony] - '@rollup/rollup-win32-arm64-msvc@4.57.1': - resolution: {integrity: sha512-O54mtsV/6LW3P8qdTcamQmuC990HDfR71lo44oZMZlXU4tzLrbvTii87Ni9opq60ds0YzuAlEr/GNwuNluZyMQ==} + '@rollup/rollup-win32-arm64-msvc@4.60.0': + resolution: {integrity: sha512-hj1wFStD7B1YBeYmvY+lWXZ7ey73YGPcViMShYikqKT1GtstIKQAtfUI6yrzPjAy/O7pO0VLXGmUVWXQMaYgTQ==} cpu: [arm64] os: [win32] - '@rollup/rollup-win32-ia32-msvc@4.57.1': - resolution: {integrity: sha512-P3dLS+IerxCT/7D2q2FYcRdWRl22dNbrbBEtxdWhXrfIMPP9lQhb5h4Du04mdl5Woq05jVCDPCMF7Ub0NAjIew==} + '@rollup/rollup-win32-ia32-msvc@4.60.0': + resolution: {integrity: sha512-SyaIPFoxmUPlNDq5EHkTbiKzmSEmq/gOYFI/3HHJ8iS/v1mbugVa7dXUzcJGQfoytp9DJFLhHH4U3/eTy2Bq4w==} cpu: [ia32] os: [win32] - '@rollup/rollup-win32-x64-gnu@4.57.1': - resolution: {integrity: sha512-VMBH2eOOaKGtIJYleXsi2B8CPVADrh+TyNxJ4mWPnKfLB/DBUmzW+5m1xUrcwWoMfSLagIRpjUFeW5CO5hyciQ==} + '@rollup/rollup-win32-x64-gnu@4.60.0': + resolution: {integrity: sha512-RdcryEfzZr+lAr5kRm2ucN9aVlCCa2QNq4hXelZxb8GG0NJSazq44Z3PCCc8wISRuCVnGs0lQJVX5Vp6fKA+IA==} cpu: [x64] os: [win32] - '@rollup/rollup-win32-x64-msvc@4.57.1': - resolution: {integrity: sha512-mxRFDdHIWRxg3UfIIAwCm6NzvxG0jDX/wBN6KsQFTvKFqqg9vTrWUE68qEjHt19A5wwx5X5aUi2zuZT7YR0jrA==} + '@rollup/rollup-win32-x64-msvc@4.60.0': + resolution: {integrity: sha512-PrsWNQ8BuE00O3Xsx3ALh2Df8fAj9+cvvX9AIA6o4KpATR98c9mud4XtDWVvsEuyia5U4tVSTKygawyJkjm60w==} cpu: [x64] os: [win32] @@ -549,8 +549,8 @@ packages: peerDependencies: acorn: ^8.14.0 - acorn@8.15.0: - resolution: {integrity: sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==} + acorn@8.16.0: + resolution: {integrity: sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==} engines: {node: '>=0.4.0'} hasBin: true @@ -567,8 +567,8 @@ packages: peerDependencies: ajv: ^8.8.2 - ajv@8.17.1: - resolution: {integrity: sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==} + ajv@8.18.0: + resolution: {integrity: sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==} ansi-regex@5.0.1: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} @@ -582,8 +582,9 @@ packages: resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} engines: {node: '>=12'} - baseline-browser-mapping@2.9.19: - resolution: {integrity: sha512-ipDqC8FrAl/76p2SSWKSI+H9tFwm7vYqXQrItCuiVPt26Km0jS+NzSsBWAaBusvSbQcfJG+JitdMm+wZAgTYqg==} + baseline-browser-mapping@2.10.10: + resolution: {integrity: sha512-sUoJ3IMxx4AyRqO4MLeHlnGDkyXRoUG0/AI9fjK+vS72ekpV0yWVY7O0BVjmBcRtkNcsAO2QDZ4tdKKGoI6YaQ==} + engines: {node: '>=6.0.0'} hasBin: true braces@3.0.3: @@ -602,8 +603,8 @@ packages: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} - caniuse-lite@1.0.30001769: - resolution: {integrity: sha512-BCfFL1sHijQlBGWBMuJyhZUhzo7wer5sVj9hqekB/7xn0Ypy+pER/edCYQm4exbXj4WiySGp40P8UuTh6w1srg==} + caniuse-lite@1.0.30001781: + resolution: {integrity: sha512-RdwNCyMsNBftLjW6w01z8bKEvT6e/5tpPVEgtn22TiLGlstHOVecsX2KHFkD5e/vRnIE4EGzpuIODb3mtswtkw==} chai@5.3.3: resolution: {integrity: sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==} @@ -656,14 +657,14 @@ packages: resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} engines: {node: '>=6'} - electron-to-chromium@1.5.286: - resolution: {integrity: sha512-9tfDXhJ4RKFNerfjdCcZfufu49vg620741MNs26a9+bhLThdB+plgMeou98CAaHu/WATj2iHOOHTp1hWtABj2A==} + electron-to-chromium@1.5.321: + resolution: {integrity: sha512-L2C7Q279W2D/J4PLZLk7sebOILDSWos7bMsMNN06rK482umHUrh/3lM8G7IlHFOYip2oAg5nha1rCMxr/rs6ZQ==} emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} - enhanced-resolve@5.19.0: - resolution: {integrity: sha512-phv3E1Xl4tQOShqSte26C7Fl84EwUdZsyOuSSk9qtAGyyQs2s3jJzComh+Abf4g187lUUAvH+H26omrqia2aGg==} + enhanced-resolve@5.20.1: + resolution: {integrity: sha512-Qohcme7V1inbAfvjItgw0EaxVX5q2rdVEZHRBrEQdRZTssLDGsL8Lwrznl8oQ/6kuTJONLaDcGjkNP247XEhcA==} engines: {node: '>=10.13.0'} es-module-lexer@1.7.0: @@ -672,8 +673,8 @@ packages: es-module-lexer@2.0.0: resolution: {integrity: sha512-5POEcUuZybH7IdmGsD8wlf0AI55wMecM9rVBTI/qEAy2c1kTOm3DjFYjrBdI2K3BaJjJYfYFeRtM0t9ssnRuxw==} - esbuild@0.27.3: - resolution: {integrity: sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==} + esbuild@0.27.4: + resolution: {integrity: sha512-Rq4vbHnYkK5fws5NF7MYTU68FPRE1ajX7heQ/8QXXWqNgqqJ/GkmmyxIzUnf2Sr/bakf8l54716CcMGHYhMrrQ==} engines: {node: '>=18'} hasBin: true @@ -742,8 +743,8 @@ packages: graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} - graphql@16.12.0: - resolution: {integrity: sha512-DKKrynuQRne0PNpEbzuEdHlYOMksHSUI8Zc9Unei5gTsMNA2/vMpoMz/yKba50pejK56qj98qM0SjYxAKi13gQ==} + graphql@16.13.1: + resolution: {integrity: sha512-gGgrVCoDKlIZ8fIqXBBb0pPKqDgki0Z/FSKNiQzSGj2uEYHr1tq5wmBegGwJx6QB5S5cM0khSBpi/JFHMCvsmQ==} engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0} has-flag@4.0.0: @@ -827,8 +828,8 @@ packages: neo-async@2.6.2: resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} - node-releases@2.0.27: - resolution: {integrity: sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==} + node-releases@2.0.36: + resolution: {integrity: sha512-TdC8FSgHz8Mwtw9g5L4gR/Sh9XhSP/0DEkQxfEFXOpiul5IiHgHan2VhYYb6agDSfp4KuvltmGApc8HMgUrIkA==} outvariant@1.4.3: resolution: {integrity: sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA==} @@ -846,21 +847,18 @@ packages: picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} - picomatch@2.3.1: - resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + picomatch@2.3.2: + resolution: {integrity: sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==} engines: {node: '>=8.6'} - picomatch@4.0.3: - resolution: {integrity: sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==} + picomatch@4.0.4: + resolution: {integrity: sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==} engines: {node: '>=12'} - postcss@8.5.6: - resolution: {integrity: sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==} + postcss@8.5.8: + resolution: {integrity: sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==} engines: {node: ^10 || ^12 || >=14} - randombytes@2.1.0: - resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} - require-directory@2.1.1: resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} engines: {node: '>=0.10.0'} @@ -872,14 +870,11 @@ packages: rettime@0.7.0: resolution: {integrity: sha512-LPRKoHnLKd/r3dVxcwO7vhCW+orkOGj9ViueosEBK6ie89CijnfRlhaDhHq/3Hxu4CkWQtxwlBG0mzTQY6uQjw==} - rollup@4.57.1: - resolution: {integrity: sha512-oQL6lgK3e2QZeQ7gcgIkS2YZPg5slw37hYufJ3edKlfQSGGm8ICoxswK15ntSzF/a8+h7ekRy7k7oWc3BQ7y8A==} + rollup@4.60.0: + resolution: {integrity: sha512-yqjxruMGBQJ2gG4HtjZtAfXArHomazDHoFwFFmZZl0r7Pdo7qCIXKqKHZc8yeoMgzJJ+pO6pEEHa+V7uzWlrAQ==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true - safe-buffer@5.2.1: - resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} - schema-utils@4.3.3: resolution: {integrity: sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==} engines: {node: '>= 10.13.0'} @@ -889,9 +884,6 @@ packages: engines: {node: '>=10'} hasBin: true - serialize-javascript@6.0.2: - resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==} - siginfo@2.0.0: resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} @@ -946,12 +938,12 @@ packages: resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} engines: {node: '>=10'} - tapable@2.3.0: - resolution: {integrity: sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==} + tapable@2.3.1: + resolution: {integrity: sha512-b+u3CEM6FjDHru+nhUSjDofpWSBp2rINziJWgApm72wwGasQ/wKXftZe4tI2Y5HPv6OpzXSZHOFq87H4vfsgsw==} engines: {node: '>=6'} - terser-webpack-plugin@5.3.16: - resolution: {integrity: sha512-h9oBFCWrq78NyWWVcSwZarJkZ01c2AyGrzs1crmHZO3QUg9D61Wu4NPjBy69n7JqylFF5y+CsUZYmYEIZ3mR+Q==} + terser-webpack-plugin@5.4.0: + resolution: {integrity: sha512-Bn5vxm48flOIfkdl5CaD2+1CiUVbonWQ3KQPyP7/EuIl9Gbzq/gQFOzaMFUEgVjB1396tcK0SG8XcNJ/2kDH8g==} engines: {node: '>= 10.13.0'} peerDependencies: '@swc/core': '*' @@ -966,8 +958,8 @@ packages: uglify-js: optional: true - terser@5.46.0: - resolution: {integrity: sha512-jTwoImyr/QbOWFFso3YoU3ik0jBBDJ6JTOQiy/J2YxVJdZCc+5u7skhNwiOR3FQIygFqVUPHl7qbbxtjW2K3Qg==} + terser@5.46.1: + resolution: {integrity: sha512-vzCjQO/rgUuK9sf8VJZvjqiqiHFaZLnOiimmUuOKODxWL8mm/xua7viT7aqX7dgPY60otQjUotzFMmCB4VdmqQ==} engines: {node: '>=10'} hasBin: true @@ -993,19 +985,19 @@ packages: resolution: {integrity: sha512-azl+t0z7pw/z958Gy9svOTuzqIk6xq+NSheJzn5MMWtWTFywIacg2wUlzKFGtt3cthx0r2SxMK0yzJOR0IES7Q==} engines: {node: '>=14.0.0'} - tldts-core@7.0.23: - resolution: {integrity: sha512-0g9vrtDQLrNIiCj22HSe9d4mLVG3g5ph5DZ8zCKBr4OtrspmNB6ss7hVyzArAeE88ceZocIEGkyW1Ime7fxPtQ==} + tldts-core@7.0.27: + resolution: {integrity: sha512-YQ7uPjgWUibIK6DW5lrKujGwUKhLevU4hcGbP5O6TcIUb+oTjJYJVWPS4nZsIHrEEEG6myk/oqAJUEQmpZrHsg==} - tldts@7.0.23: - resolution: {integrity: sha512-ASdhgQIBSay0R/eXggAkQ53G4nTJqTXqC2kbaBbdDwM7SkjyZyO0OaaN1/FH7U/yCeqOHDwFO5j8+Os/IS1dXw==} + tldts@7.0.27: + resolution: {integrity: sha512-I4FZcVFcqCRuT0ph6dCDpPuO4Xgzvh+spkcTr1gK7peIvxWauoloVO0vuy1FQnijT63ss6AsHB6+OIM4aXHbPg==} hasBin: true to-regex-range@5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} - tough-cookie@6.0.0: - resolution: {integrity: sha512-kXuRi1mtaKMrsLUxz3sQYvVl37B0Ns6MzfrtV5DvJceE9bPyspOqk9xxv7XbZWcfLWbFmm997vl83qUWVJA64w==} + tough-cookie@6.0.1: + resolution: {integrity: sha512-LktZQb3IeoUWB9lqR5EWTHgW/VTITCXg4D21M+lvybRVdylLrRMnqaIONLVb5mav8vM19m44HIcGq4qASeu2Qw==} engines: {node: '>=16'} ts-loader@9.5.4: @@ -1110,12 +1102,12 @@ packages: resolution: {integrity: sha512-Zn5uXdcFNIA1+1Ei5McRd+iRzfhENPCe7LeABkJtNulSxjma+l7ltNx55BWZkRlwRnpOgHqxnjyaDgJnNXnqzg==} engines: {node: '>=10.13.0'} - webpack-sources@3.3.3: - resolution: {integrity: sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg==} + webpack-sources@3.3.4: + resolution: {integrity: sha512-7tP1PdV4vF+lYPnkMR0jMY5/la2ub5Fc/8VQrrU+lXkiM6C4TjVfGw7iKfyhnTQOsD+6Q/iKw0eFciziRgD58Q==} engines: {node: '>=10.13.0'} - webpack@5.105.2: - resolution: {integrity: sha512-dRXm0a2qcHPUBEzVk8uph0xWSjV/xZxenQQbLwnwP7caQCYpqG1qddwlyEkIDkYn0K8tvmcrZ+bOrzoQ3HxCDw==} + webpack@5.105.4: + resolution: {integrity: sha512-jTywjboN9aHxFlToqb0K0Zs9SbBoW4zRUlGzI2tYNxVYcEi/IPpn+Xi4ye5jTLvX2YeLuic/IvxNot+Q1jMoOw==} engines: {node: '>=10.13.0'} hasBin: true peerDependencies: @@ -1155,39 +1147,39 @@ packages: snapshots: - '@biomejs/biome@2.3.11': + '@biomejs/biome@2.4.3': optionalDependencies: - '@biomejs/cli-darwin-arm64': 2.3.11 - '@biomejs/cli-darwin-x64': 2.3.11 - '@biomejs/cli-linux-arm64': 2.3.11 - '@biomejs/cli-linux-arm64-musl': 2.3.11 - '@biomejs/cli-linux-x64': 2.3.11 - '@biomejs/cli-linux-x64-musl': 2.3.11 - '@biomejs/cli-win32-arm64': 2.3.11 - '@biomejs/cli-win32-x64': 2.3.11 - - '@biomejs/cli-darwin-arm64@2.3.11': + '@biomejs/cli-darwin-arm64': 2.4.3 + '@biomejs/cli-darwin-x64': 2.4.3 + '@biomejs/cli-linux-arm64': 2.4.3 + '@biomejs/cli-linux-arm64-musl': 2.4.3 + '@biomejs/cli-linux-x64': 2.4.3 + '@biomejs/cli-linux-x64-musl': 2.4.3 + '@biomejs/cli-win32-arm64': 2.4.3 + '@biomejs/cli-win32-x64': 2.4.3 + + '@biomejs/cli-darwin-arm64@2.4.3': optional: true - '@biomejs/cli-darwin-x64@2.3.11': + '@biomejs/cli-darwin-x64@2.4.3': optional: true - '@biomejs/cli-linux-arm64-musl@2.3.11': + '@biomejs/cli-linux-arm64-musl@2.4.3': optional: true - '@biomejs/cli-linux-arm64@2.3.11': + '@biomejs/cli-linux-arm64@2.4.3': optional: true - '@biomejs/cli-linux-x64-musl@2.3.11': + '@biomejs/cli-linux-x64-musl@2.4.3': optional: true - '@biomejs/cli-linux-x64@2.3.11': + '@biomejs/cli-linux-x64@2.4.3': optional: true - '@biomejs/cli-win32-arm64@2.3.11': + '@biomejs/cli-win32-arm64@2.4.3': optional: true - '@biomejs/cli-win32-x64@2.3.11': + '@biomejs/cli-win32-x64@2.4.3': optional: true '@bundled-es-modules/cookie@2.0.1': @@ -1198,82 +1190,82 @@ snapshots: dependencies: statuses: 2.0.2 - '@esbuild/aix-ppc64@0.27.3': + '@esbuild/aix-ppc64@0.27.4': optional: true - '@esbuild/android-arm64@0.27.3': + '@esbuild/android-arm64@0.27.4': optional: true - '@esbuild/android-arm@0.27.3': + '@esbuild/android-arm@0.27.4': optional: true - '@esbuild/android-x64@0.27.3': + '@esbuild/android-x64@0.27.4': optional: true - '@esbuild/darwin-arm64@0.27.3': + '@esbuild/darwin-arm64@0.27.4': optional: true - '@esbuild/darwin-x64@0.27.3': + '@esbuild/darwin-x64@0.27.4': optional: true - '@esbuild/freebsd-arm64@0.27.3': + '@esbuild/freebsd-arm64@0.27.4': optional: true - '@esbuild/freebsd-x64@0.27.3': + '@esbuild/freebsd-x64@0.27.4': optional: true - '@esbuild/linux-arm64@0.27.3': + '@esbuild/linux-arm64@0.27.4': optional: true - '@esbuild/linux-arm@0.27.3': + '@esbuild/linux-arm@0.27.4': optional: true - '@esbuild/linux-ia32@0.27.3': + '@esbuild/linux-ia32@0.27.4': optional: true - '@esbuild/linux-loong64@0.27.3': + '@esbuild/linux-loong64@0.27.4': optional: true - '@esbuild/linux-mips64el@0.27.3': + '@esbuild/linux-mips64el@0.27.4': optional: true - '@esbuild/linux-ppc64@0.27.3': + '@esbuild/linux-ppc64@0.27.4': optional: true - '@esbuild/linux-riscv64@0.27.3': + '@esbuild/linux-riscv64@0.27.4': optional: true - '@esbuild/linux-s390x@0.27.3': + '@esbuild/linux-s390x@0.27.4': optional: true - '@esbuild/linux-x64@0.27.3': + '@esbuild/linux-x64@0.27.4': optional: true - '@esbuild/netbsd-arm64@0.27.3': + '@esbuild/netbsd-arm64@0.27.4': optional: true - '@esbuild/netbsd-x64@0.27.3': + '@esbuild/netbsd-x64@0.27.4': optional: true - '@esbuild/openbsd-arm64@0.27.3': + '@esbuild/openbsd-arm64@0.27.4': optional: true - '@esbuild/openbsd-x64@0.27.3': + '@esbuild/openbsd-x64@0.27.4': optional: true - '@esbuild/openharmony-arm64@0.27.3': + '@esbuild/openharmony-arm64@0.27.4': optional: true - '@esbuild/sunos-x64@0.27.3': + '@esbuild/sunos-x64@0.27.4': optional: true - '@esbuild/win32-arm64@0.27.3': + '@esbuild/win32-arm64@0.27.4': optional: true - '@esbuild/win32-ia32@0.27.3': + '@esbuild/win32-ia32@0.27.4': optional: true - '@esbuild/win32-x64@0.27.3': + '@esbuild/win32-x64@0.27.4': optional: true '@inquirer/ansi@1.0.2': {} @@ -1341,79 +1333,79 @@ snapshots: '@open-draft/until@2.1.0': {} - '@rollup/rollup-android-arm-eabi@4.57.1': + '@rollup/rollup-android-arm-eabi@4.60.0': optional: true - '@rollup/rollup-android-arm64@4.57.1': + '@rollup/rollup-android-arm64@4.60.0': optional: true - '@rollup/rollup-darwin-arm64@4.57.1': + '@rollup/rollup-darwin-arm64@4.60.0': optional: true - '@rollup/rollup-darwin-x64@4.57.1': + '@rollup/rollup-darwin-x64@4.60.0': optional: true - '@rollup/rollup-freebsd-arm64@4.57.1': + '@rollup/rollup-freebsd-arm64@4.60.0': optional: true - '@rollup/rollup-freebsd-x64@4.57.1': + '@rollup/rollup-freebsd-x64@4.60.0': optional: true - '@rollup/rollup-linux-arm-gnueabihf@4.57.1': + '@rollup/rollup-linux-arm-gnueabihf@4.60.0': optional: true - '@rollup/rollup-linux-arm-musleabihf@4.57.1': + '@rollup/rollup-linux-arm-musleabihf@4.60.0': optional: true - '@rollup/rollup-linux-arm64-gnu@4.57.1': + '@rollup/rollup-linux-arm64-gnu@4.60.0': optional: true - '@rollup/rollup-linux-arm64-musl@4.57.1': + '@rollup/rollup-linux-arm64-musl@4.60.0': optional: true - '@rollup/rollup-linux-loong64-gnu@4.57.1': + '@rollup/rollup-linux-loong64-gnu@4.60.0': optional: true - '@rollup/rollup-linux-loong64-musl@4.57.1': + '@rollup/rollup-linux-loong64-musl@4.60.0': optional: true - '@rollup/rollup-linux-ppc64-gnu@4.57.1': + '@rollup/rollup-linux-ppc64-gnu@4.60.0': optional: true - '@rollup/rollup-linux-ppc64-musl@4.57.1': + '@rollup/rollup-linux-ppc64-musl@4.60.0': optional: true - '@rollup/rollup-linux-riscv64-gnu@4.57.1': + '@rollup/rollup-linux-riscv64-gnu@4.60.0': optional: true - '@rollup/rollup-linux-riscv64-musl@4.57.1': + '@rollup/rollup-linux-riscv64-musl@4.60.0': optional: true - '@rollup/rollup-linux-s390x-gnu@4.57.1': + '@rollup/rollup-linux-s390x-gnu@4.60.0': optional: true - '@rollup/rollup-linux-x64-gnu@4.57.1': + '@rollup/rollup-linux-x64-gnu@4.60.0': optional: true - '@rollup/rollup-linux-x64-musl@4.57.1': + '@rollup/rollup-linux-x64-musl@4.60.0': optional: true - '@rollup/rollup-openbsd-x64@4.57.1': + '@rollup/rollup-openbsd-x64@4.60.0': optional: true - '@rollup/rollup-openharmony-arm64@4.57.1': + '@rollup/rollup-openharmony-arm64@4.60.0': optional: true - '@rollup/rollup-win32-arm64-msvc@4.57.1': + '@rollup/rollup-win32-arm64-msvc@4.60.0': optional: true - '@rollup/rollup-win32-ia32-msvc@4.57.1': + '@rollup/rollup-win32-ia32-msvc@4.60.0': optional: true - '@rollup/rollup-win32-x64-gnu@4.57.1': + '@rollup/rollup-win32-x64-gnu@4.60.0': optional: true - '@rollup/rollup-win32-x64-msvc@4.57.1': + '@rollup/rollup-win32-x64-msvc@4.60.0': optional: true '@types/chai@5.2.3': @@ -1453,14 +1445,14 @@ snapshots: chai: 5.3.3 tinyrainbow: 2.0.0 - '@vitest/mocker@3.2.4(msw@2.11.2(@types/node@18.19.130)(typescript@5.7.3))(vite@7.3.1(@types/node@18.19.130)(terser@5.46.0))': + '@vitest/mocker@3.2.4(msw@2.11.2(@types/node@18.19.130)(typescript@5.7.3))(vite@7.3.1(@types/node@18.19.130)(terser@5.46.1))': dependencies: '@vitest/spy': 3.2.4 estree-walker: 3.0.3 magic-string: 0.30.21 optionalDependencies: msw: 2.11.2(@types/node@18.19.130)(typescript@5.7.3) - vite: 7.3.1(@types/node@18.19.130)(terser@5.46.0) + vite: 7.3.1(@types/node@18.19.130)(terser@5.46.1) '@vitest/pretty-format@3.2.4': dependencies: @@ -1568,22 +1560,22 @@ snapshots: '@xtuc/long@4.2.2': {} - acorn-import-phases@1.0.4(acorn@8.15.0): + acorn-import-phases@1.0.4(acorn@8.16.0): dependencies: - acorn: 8.15.0 + acorn: 8.16.0 - acorn@8.15.0: {} + acorn@8.16.0: {} - ajv-formats@2.1.1(ajv@8.17.1): + ajv-formats@2.1.1(ajv@8.18.0): optionalDependencies: - ajv: 8.17.1 + ajv: 8.18.0 - ajv-keywords@5.1.0(ajv@8.17.1): + ajv-keywords@5.1.0(ajv@8.18.0): dependencies: - ajv: 8.17.1 + ajv: 8.18.0 fast-deep-equal: 3.1.3 - ajv@8.17.1: + ajv@8.18.0: dependencies: fast-deep-equal: 3.1.3 fast-uri: 3.1.0 @@ -1598,7 +1590,7 @@ snapshots: assertion-error@2.0.1: {} - baseline-browser-mapping@2.9.19: {} + baseline-browser-mapping@2.10.10: {} braces@3.0.3: dependencies: @@ -1606,17 +1598,17 @@ snapshots: browserslist@4.28.1: dependencies: - baseline-browser-mapping: 2.9.19 - caniuse-lite: 1.0.30001769 - electron-to-chromium: 1.5.286 - node-releases: 2.0.27 + baseline-browser-mapping: 2.10.10 + caniuse-lite: 1.0.30001781 + electron-to-chromium: 1.5.321 + node-releases: 2.0.36 update-browserslist-db: 1.2.3(browserslist@4.28.1) buffer-from@1.1.2: {} cac@6.7.14: {} - caniuse-lite@1.0.30001769: {} + caniuse-lite@1.0.30001781: {} chai@5.3.3: dependencies: @@ -1659,47 +1651,47 @@ snapshots: deep-eql@5.0.2: {} - electron-to-chromium@1.5.286: {} + electron-to-chromium@1.5.321: {} emoji-regex@8.0.0: {} - enhanced-resolve@5.19.0: + enhanced-resolve@5.20.1: dependencies: graceful-fs: 4.2.11 - tapable: 2.3.0 + tapable: 2.3.1 es-module-lexer@1.7.0: {} es-module-lexer@2.0.0: {} - esbuild@0.27.3: + esbuild@0.27.4: optionalDependencies: - '@esbuild/aix-ppc64': 0.27.3 - '@esbuild/android-arm': 0.27.3 - '@esbuild/android-arm64': 0.27.3 - '@esbuild/android-x64': 0.27.3 - '@esbuild/darwin-arm64': 0.27.3 - '@esbuild/darwin-x64': 0.27.3 - '@esbuild/freebsd-arm64': 0.27.3 - '@esbuild/freebsd-x64': 0.27.3 - '@esbuild/linux-arm': 0.27.3 - '@esbuild/linux-arm64': 0.27.3 - '@esbuild/linux-ia32': 0.27.3 - '@esbuild/linux-loong64': 0.27.3 - '@esbuild/linux-mips64el': 0.27.3 - '@esbuild/linux-ppc64': 0.27.3 - '@esbuild/linux-riscv64': 0.27.3 - '@esbuild/linux-s390x': 0.27.3 - '@esbuild/linux-x64': 0.27.3 - '@esbuild/netbsd-arm64': 0.27.3 - '@esbuild/netbsd-x64': 0.27.3 - '@esbuild/openbsd-arm64': 0.27.3 - '@esbuild/openbsd-x64': 0.27.3 - '@esbuild/openharmony-arm64': 0.27.3 - '@esbuild/sunos-x64': 0.27.3 - '@esbuild/win32-arm64': 0.27.3 - '@esbuild/win32-ia32': 0.27.3 - '@esbuild/win32-x64': 0.27.3 + '@esbuild/aix-ppc64': 0.27.4 + '@esbuild/android-arm': 0.27.4 + '@esbuild/android-arm64': 0.27.4 + '@esbuild/android-x64': 0.27.4 + '@esbuild/darwin-arm64': 0.27.4 + '@esbuild/darwin-x64': 0.27.4 + '@esbuild/freebsd-arm64': 0.27.4 + '@esbuild/freebsd-x64': 0.27.4 + '@esbuild/linux-arm': 0.27.4 + '@esbuild/linux-arm64': 0.27.4 + '@esbuild/linux-ia32': 0.27.4 + '@esbuild/linux-loong64': 0.27.4 + '@esbuild/linux-mips64el': 0.27.4 + '@esbuild/linux-ppc64': 0.27.4 + '@esbuild/linux-riscv64': 0.27.4 + '@esbuild/linux-s390x': 0.27.4 + '@esbuild/linux-x64': 0.27.4 + '@esbuild/netbsd-arm64': 0.27.4 + '@esbuild/netbsd-x64': 0.27.4 + '@esbuild/openbsd-arm64': 0.27.4 + '@esbuild/openbsd-x64': 0.27.4 + '@esbuild/openharmony-arm64': 0.27.4 + '@esbuild/sunos-x64': 0.27.4 + '@esbuild/win32-arm64': 0.27.4 + '@esbuild/win32-ia32': 0.27.4 + '@esbuild/win32-x64': 0.27.4 escalade@3.2.0: {} @@ -1728,9 +1720,9 @@ snapshots: fast-uri@3.1.0: {} - fdir@6.5.0(picomatch@4.0.3): + fdir@6.5.0(picomatch@4.0.4): optionalDependencies: - picomatch: 4.0.3 + picomatch: 4.0.4 fill-range@7.1.1: dependencies: @@ -1745,7 +1737,7 @@ snapshots: graceful-fs@4.2.11: {} - graphql@16.12.0: {} + graphql@16.13.1: {} has-flag@4.0.0: {} @@ -1782,7 +1774,7 @@ snapshots: micromatch@4.0.8: dependencies: braces: 3.0.3 - picomatch: 2.3.1 + picomatch: 2.3.2 mime-db@1.52.0: {} @@ -1802,7 +1794,7 @@ snapshots: '@open-draft/until': 2.1.0 '@types/cookie': 0.6.0 '@types/statuses': 2.0.6 - graphql: 16.12.0 + graphql: 16.13.1 headers-polyfill: 4.0.3 is-node-process: 1.2.0 outvariant: 1.4.3 @@ -1810,7 +1802,7 @@ snapshots: picocolors: 1.1.1 rettime: 0.7.0 strict-event-emitter: 0.5.1 - tough-cookie: 6.0.0 + tough-cookie: 6.0.1 type-fest: 4.41.0 yargs: 17.7.2 optionalDependencies: @@ -1824,7 +1816,7 @@ snapshots: neo-async@2.6.2: {} - node-releases@2.0.27: {} + node-releases@2.0.36: {} outvariant@1.4.3: {} @@ -1836,72 +1828,62 @@ snapshots: picocolors@1.1.1: {} - picomatch@2.3.1: {} + picomatch@2.3.2: {} - picomatch@4.0.3: {} + picomatch@4.0.4: {} - postcss@8.5.6: + postcss@8.5.8: dependencies: nanoid: 3.3.11 picocolors: 1.1.1 source-map-js: 1.2.1 - randombytes@2.1.0: - dependencies: - safe-buffer: 5.2.1 - require-directory@2.1.1: {} require-from-string@2.0.2: {} rettime@0.7.0: {} - rollup@4.57.1: + rollup@4.60.0: dependencies: '@types/estree': 1.0.8 optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.57.1 - '@rollup/rollup-android-arm64': 4.57.1 - '@rollup/rollup-darwin-arm64': 4.57.1 - '@rollup/rollup-darwin-x64': 4.57.1 - '@rollup/rollup-freebsd-arm64': 4.57.1 - '@rollup/rollup-freebsd-x64': 4.57.1 - '@rollup/rollup-linux-arm-gnueabihf': 4.57.1 - '@rollup/rollup-linux-arm-musleabihf': 4.57.1 - '@rollup/rollup-linux-arm64-gnu': 4.57.1 - '@rollup/rollup-linux-arm64-musl': 4.57.1 - '@rollup/rollup-linux-loong64-gnu': 4.57.1 - '@rollup/rollup-linux-loong64-musl': 4.57.1 - '@rollup/rollup-linux-ppc64-gnu': 4.57.1 - '@rollup/rollup-linux-ppc64-musl': 4.57.1 - '@rollup/rollup-linux-riscv64-gnu': 4.57.1 - '@rollup/rollup-linux-riscv64-musl': 4.57.1 - '@rollup/rollup-linux-s390x-gnu': 4.57.1 - '@rollup/rollup-linux-x64-gnu': 4.57.1 - '@rollup/rollup-linux-x64-musl': 4.57.1 - '@rollup/rollup-openbsd-x64': 4.57.1 - '@rollup/rollup-openharmony-arm64': 4.57.1 - '@rollup/rollup-win32-arm64-msvc': 4.57.1 - '@rollup/rollup-win32-ia32-msvc': 4.57.1 - '@rollup/rollup-win32-x64-gnu': 4.57.1 - '@rollup/rollup-win32-x64-msvc': 4.57.1 + '@rollup/rollup-android-arm-eabi': 4.60.0 + '@rollup/rollup-android-arm64': 4.60.0 + '@rollup/rollup-darwin-arm64': 4.60.0 + '@rollup/rollup-darwin-x64': 4.60.0 + '@rollup/rollup-freebsd-arm64': 4.60.0 + '@rollup/rollup-freebsd-x64': 4.60.0 + '@rollup/rollup-linux-arm-gnueabihf': 4.60.0 + '@rollup/rollup-linux-arm-musleabihf': 4.60.0 + '@rollup/rollup-linux-arm64-gnu': 4.60.0 + '@rollup/rollup-linux-arm64-musl': 4.60.0 + '@rollup/rollup-linux-loong64-gnu': 4.60.0 + '@rollup/rollup-linux-loong64-musl': 4.60.0 + '@rollup/rollup-linux-ppc64-gnu': 4.60.0 + '@rollup/rollup-linux-ppc64-musl': 4.60.0 + '@rollup/rollup-linux-riscv64-gnu': 4.60.0 + '@rollup/rollup-linux-riscv64-musl': 4.60.0 + '@rollup/rollup-linux-s390x-gnu': 4.60.0 + '@rollup/rollup-linux-x64-gnu': 4.60.0 + '@rollup/rollup-linux-x64-musl': 4.60.0 + '@rollup/rollup-openbsd-x64': 4.60.0 + '@rollup/rollup-openharmony-arm64': 4.60.0 + '@rollup/rollup-win32-arm64-msvc': 4.60.0 + '@rollup/rollup-win32-ia32-msvc': 4.60.0 + '@rollup/rollup-win32-x64-gnu': 4.60.0 + '@rollup/rollup-win32-x64-msvc': 4.60.0 fsevents: 2.3.3 - safe-buffer@5.2.1: {} - schema-utils@4.3.3: dependencies: '@types/json-schema': 7.0.15 - ajv: 8.17.1 - ajv-formats: 2.1.1(ajv@8.17.1) - ajv-keywords: 5.1.0(ajv@8.17.1) + ajv: 8.18.0 + ajv-formats: 2.1.1(ajv@8.18.0) + ajv-keywords: 5.1.0(ajv@8.18.0) semver@7.7.4: {} - serialize-javascript@6.0.2: - dependencies: - randombytes: 2.1.0 - siginfo@2.0.0: {} signal-exit@4.1.0: {} @@ -1947,21 +1929,20 @@ snapshots: dependencies: has-flag: 4.0.0 - tapable@2.3.0: {} + tapable@2.3.1: {} - terser-webpack-plugin@5.3.16(webpack@5.105.2): + terser-webpack-plugin@5.4.0(webpack@5.105.4): dependencies: '@jridgewell/trace-mapping': 0.3.31 jest-worker: 27.5.1 schema-utils: 4.3.3 - serialize-javascript: 6.0.2 - terser: 5.46.0 - webpack: 5.105.2 + terser: 5.46.1 + webpack: 5.105.4 - terser@5.46.0: + terser@5.46.1: dependencies: '@jridgewell/source-map': 0.3.11 - acorn: 8.15.0 + acorn: 8.16.0 commander: 2.20.3 source-map-support: 0.5.21 @@ -1971,8 +1952,8 @@ snapshots: tinyglobby@0.2.15: dependencies: - fdir: 6.5.0(picomatch@4.0.3) - picomatch: 4.0.3 + fdir: 6.5.0(picomatch@4.0.4) + picomatch: 4.0.4 tinypool@1.1.1: {} @@ -1980,29 +1961,29 @@ snapshots: tinyspy@4.0.4: {} - tldts-core@7.0.23: {} + tldts-core@7.0.27: {} - tldts@7.0.23: + tldts@7.0.27: dependencies: - tldts-core: 7.0.23 + tldts-core: 7.0.27 to-regex-range@5.0.1: dependencies: is-number: 7.0.0 - tough-cookie@6.0.0: + tough-cookie@6.0.1: dependencies: - tldts: 7.0.23 + tldts: 7.0.27 - ts-loader@9.5.4(typescript@5.7.3)(webpack@5.105.2): + ts-loader@9.5.4(typescript@5.7.3)(webpack@5.105.4): dependencies: chalk: 4.1.2 - enhanced-resolve: 5.19.0 + enhanced-resolve: 5.20.1 micromatch: 4.0.8 semver: 7.7.4 source-map: 0.7.6 typescript: 5.7.3 - webpack: 5.105.2 + webpack: 5.105.4 type-fest@4.41.0: {} @@ -2016,13 +1997,13 @@ snapshots: escalade: 3.2.0 picocolors: 1.1.1 - vite-node@3.2.4(@types/node@18.19.130)(terser@5.46.0): + vite-node@3.2.4(@types/node@18.19.130)(terser@5.46.1): dependencies: cac: 6.7.14 debug: 4.4.3 es-module-lexer: 1.7.0 pathe: 2.0.3 - vite: 7.3.1(@types/node@18.19.130)(terser@5.46.0) + vite: 7.3.1(@types/node@18.19.130)(terser@5.46.1) transitivePeerDependencies: - '@types/node' - jiti @@ -2037,24 +2018,24 @@ snapshots: - tsx - yaml - vite@7.3.1(@types/node@18.19.130)(terser@5.46.0): + vite@7.3.1(@types/node@18.19.130)(terser@5.46.1): dependencies: - esbuild: 0.27.3 - fdir: 6.5.0(picomatch@4.0.3) - picomatch: 4.0.3 - postcss: 8.5.6 - rollup: 4.57.1 + esbuild: 0.27.4 + fdir: 6.5.0(picomatch@4.0.4) + picomatch: 4.0.4 + postcss: 8.5.8 + rollup: 4.60.0 tinyglobby: 0.2.15 optionalDependencies: '@types/node': 18.19.130 fsevents: 2.3.3 - terser: 5.46.0 + terser: 5.46.1 - vitest@3.2.4(@types/node@18.19.130)(msw@2.11.2(@types/node@18.19.130)(typescript@5.7.3))(terser@5.46.0): + vitest@3.2.4(@types/node@18.19.130)(msw@2.11.2(@types/node@18.19.130)(typescript@5.7.3))(terser@5.46.1): dependencies: '@types/chai': 5.2.3 '@vitest/expect': 3.2.4 - '@vitest/mocker': 3.2.4(msw@2.11.2(@types/node@18.19.130)(typescript@5.7.3))(vite@7.3.1(@types/node@18.19.130)(terser@5.46.0)) + '@vitest/mocker': 3.2.4(msw@2.11.2(@types/node@18.19.130)(typescript@5.7.3))(vite@7.3.1(@types/node@18.19.130)(terser@5.46.1)) '@vitest/pretty-format': 3.2.4 '@vitest/runner': 3.2.4 '@vitest/snapshot': 3.2.4 @@ -2065,15 +2046,15 @@ snapshots: expect-type: 1.3.0 magic-string: 0.30.21 pathe: 2.0.3 - picomatch: 4.0.3 + picomatch: 4.0.4 std-env: 3.10.0 tinybench: 2.9.0 tinyexec: 0.3.2 tinyglobby: 0.2.15 tinypool: 1.1.1 tinyrainbow: 2.0.0 - vite: 7.3.1(@types/node@18.19.130)(terser@5.46.0) - vite-node: 3.2.4(@types/node@18.19.130)(terser@5.46.0) + vite: 7.3.1(@types/node@18.19.130)(terser@5.46.1) + vite-node: 3.2.4(@types/node@18.19.130)(terser@5.46.1) why-is-node-running: 2.3.0 optionalDependencies: '@types/node': 18.19.130 @@ -2096,9 +2077,9 @@ snapshots: glob-to-regexp: 0.4.1 graceful-fs: 4.2.11 - webpack-sources@3.3.3: {} + webpack-sources@3.3.4: {} - webpack@5.105.2: + webpack@5.105.4: dependencies: '@types/eslint-scope': 3.7.7 '@types/estree': 1.0.8 @@ -2106,11 +2087,11 @@ snapshots: '@webassemblyjs/ast': 1.14.1 '@webassemblyjs/wasm-edit': 1.14.1 '@webassemblyjs/wasm-parser': 1.14.1 - acorn: 8.15.0 - acorn-import-phases: 1.0.4(acorn@8.15.0) + acorn: 8.16.0 + acorn-import-phases: 1.0.4(acorn@8.16.0) browserslist: 4.28.1 chrome-trace-event: 1.0.4 - enhanced-resolve: 5.19.0 + enhanced-resolve: 5.20.1 es-module-lexer: 2.0.0 eslint-scope: 5.1.1 events: 3.3.0 @@ -2121,10 +2102,10 @@ snapshots: mime-types: 2.1.35 neo-async: 2.6.2 schema-utils: 4.3.3 - tapable: 2.3.0 - terser-webpack-plugin: 5.3.16(webpack@5.105.2) + tapable: 2.3.1 + terser-webpack-plugin: 5.4.0(webpack@5.105.4) watchpack: 2.5.1 - webpack-sources: 3.3.3 + webpack-sources: 3.3.4 transitivePeerDependencies: - '@swc/core' - esbuild diff --git a/reference.md b/reference.md index 6309719..afdc72f 100644 --- a/reference.md +++ b/reference.md @@ -3638,22 +3638,16 @@ await client.webhooks.createWebhook({
- -To have it activated please send us a request and we will activate it for your account. + +This is an enterprise feature. Contact us to activate it for your account. -Exports webhook event history to CSV format for analysis and reporting. - -Use this to: -- Generate comprehensive webhook event reports -- Analyze webhook delivery patterns and success rates -- Export event data for external analysis tools -- Create historical reports for compliance and auditing -- Track webhook performance and reliability metrics +Submits a request to export webhook event history as a CSV file. The download link is sent to the `notifyURL` you provide in the request body. -Key information returned: -- Process ID for tracking export completion -- CSV file will be delivered to specified webhook URL +Use this endpoint to: +- Export webhook event history filtered by date range, event type, or email address +- Generate reports for compliance, auditing, or performance analysis +- Track delivery patterns and webhook reliability over time
@@ -4381,12 +4375,8 @@ await client.externalFeeds.deleteExternalFeed({
- -Custom objects are only available to Enterprise plans. - -This feature is in beta. These are subject to change. - - +Custom objects are only available to Enterprise plans. +This feature is in beta. These are subject to change. This API allows bulk upsert of object records in a single request. Each object record may include - Attributes - Identifiers @@ -4400,8 +4390,8 @@ This API allows bulk upsert of object records in a single request. Each object r - Max 500 attributes defined per object record upsert request - This is coherent with schema limitation: an object cannot have more than 500 attributes. - Worth noting: Nothing happens If an attribute is mentioned in the request, but was not previously defined for the object schema (no error, no attribute creation) - - Max 10 associations defined per object record upsert request - - This is coherent with schema limitation: an object cannot have more than 10 associations with other objects. and each object record can be linked to max 10 other records. + - Max 10 associations defined per associated object type, in each record of the request + - This is not a schema limitation. You can associate an object record to an unlimited number of other object records by running multiple requests. **Errors:** - Make sure both object records exist before associating them, else the API will return an error. - This route does not create objects. The object where the object records are upserted by this API must be created already else the API will return an error "invalid object type". @@ -4470,12 +4460,8 @@ await client.customObjects.upsertrecords({
- -Custom objects are only available to Enterprise plans. - -This feature is in beta. These are subject to change. - - +Custom objects are only available to Enterprise plans. +This feature is in beta. These are subject to change. This API retrieves a list of object records along with their associated records and provides the total count of records for the specified object. **Note**: Contact as object type is not supported in this endpoint.
@@ -4606,26 +4592,6 @@ await client.customObjects.batchDeleteObjectRecords({
-#### 📝 Description - -
-
- -
-
- - -Accepted Number Formats - -91xxxxxxxxxx -+91xxxxxxxxxx -0091xxxxxxxxxx - -
-
-
-
- #### 🔌 Usage
@@ -4683,6 +4649,8 @@ await client.contacts.getContacts();
+Follow this format when passing a "SMS" phone number as an attribute. +Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx Creates new contacts on Brevo. Contacts can be created by passing either -

1. email address of the contact (email_id),
2. phone number of the contact (to be passed as "SMS" field in "attributes" along with proper country code), For example- {"SMS":"+91xxxxxxxxxx"} or {"SMS":"0091xxxxxxxxxx"}
3. ext_id
@@ -5045,9 +5013,7 @@ await client.contacts.updateBatchContacts();
- -attributes param in this endpoint is an object containing key-value pairs where values can be either a string, integer, array, or boolean. You can create key-value pairs with these four datatypes. When a value is an array, it should be an array of strings. - +attributes param in this endpoint is an object containing key-value pairs where values can be either a string, integer, array, or boolean. You can create key-value pairs with these four datatypes. When a value is an array, it should be an array of strings.
@@ -5180,17 +5146,11 @@ await client.contacts.requestContactExport({
- -Ongoing changes for this endpoint - +Ongoing changes for this endpoint We're dropping support for the response attributes totalSubscribers and totalBlacklisted. - These are non breaking changes. - The default value for the attributes will be 0. - -The uniqueSubscribers field is deprecated - +The uniqueSubscribers field is deprecated
@@ -5302,13 +5262,9 @@ await client.contacts.createFolder({});
- -Ongoing changes for this endpoint. - +Ongoing changes for this endpoint. We're dropping support for the response attributes totalSubscribers and totalBlacklisted. - -These are non breaking changes. The default value for the attributes will be 0. - +These are non breaking changes. The default value for the attributes will be 0.
@@ -5476,13 +5432,9 @@ await client.contacts.deleteFolder({
- -Ongoing changes for this endpoint. - +Ongoing changes for this endpoint. We're dropping support for the response attributes totalSubscribers and totalBlacklisted. - -These are non breaking changes. The default value for the attributes will be 0. - +These are non breaking changes. The default value for the attributes will be 0.
@@ -5610,13 +5562,9 @@ await client.contacts.importContacts();
- -Ongoing changes for this endpoint. - +Ongoing changes for this endpoint. We're dropping support for the response attributes totalSubscribers and totalBlacklisted. - -These are non breaking changes. The default value for the attributes will be 0. - +These are non breaking changes. The default value for the attributes will be 0.
@@ -6092,14 +6040,8 @@ await client.contacts.getSegments();
- -Accepted Number Formats - -91xxxxxxxxxx -+91xxxxxxxxxx -0091xxxxxxxxxx - - +Follow this format when passing a "SMS" phone number as an attribute. +Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx There are 2 ways to get a contact

Option 1- https://api.brevo.com/v3/contacts/{identifier}

Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={}

Option 1 only works if identifierType is email_id (for EMAIL), phone_id (for SMS) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL, SMS and ID of the contact.

Option 2 works for all identifierType, use email_id for EMAIL attribute, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute

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.
@@ -6165,6 +6107,8 @@ await client.contacts.getContactInfo({
+Follow this format when passing a "SMS" phone number as an attribute. +Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx

If a blocklisted contact's email address is updated, it is going to remove that blocklisting from the contact and they will be resubscribed.
There are 2 ways to update a contact

Option 1- https://api.brevo.com/v3/contacts/{identifier}

Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={}

Option 1 only works if identifierType is email_id (for EMAIL) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL and ID of the contact.

Option 2 works for all identifierType, use email_id for EMAIL attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute
@@ -7525,8 +7469,7 @@ await client.ecommerce.createOrder({ id: "14", products: [{ price: 99.99, - productId: "P1", - quantity: 10 + productId: "P1" }], status: "completed", updatedAt: "2021-07-30T10:59:23.383Z" @@ -7600,8 +7543,7 @@ await client.ecommerce.createBatchOrder({ id: "14", products: [{ price: 99.99, - productId: "P1", - quantity: 10 + productId: "P1" }], status: "completed", updatedAt: "2021-07-30T10:59:23.383Z" @@ -8316,6 +8258,73 @@ await client.payments.deletePaymentRequest({ ## Event +
client.event.getEvents({ ...params }) -> Brevo.GetEventsList +
+
+ +#### 📝 Description + +
+
+ +
+
+ + +This endpoint currently only supports custom events. + + +Retrieve a list of events filtered by various criteria. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.event.getEvents(); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Brevo.GetEventsRequest` + +
+
+ +
+
+ +**requestOptions:** `EventClient.RequestOptions` + +
+
+
+
+ + +
+
+
+
client.event.createEvent({ ...params }) -> void
@@ -8378,6 +8387,72 @@ await client.event.createEvent({
+ +
+ + +
client.event.createBatchEvents({ ...params }) -> Brevo.BatchAcceptedResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create multiple events to track contacts' interactions in a single request. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.event.createBatchEvents([{ + event_name: "order_created", + identifiers: {} + }]); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Brevo.CreateBatchEventsRequestItem[]` + +
+
+ +
+
+ +**requestOptions:** `EventClient.RequestOptions` + +
+
+
+
+ +
@@ -9550,8 +9625,8 @@ Returns transaction history ```typescript await client.balance.getTransactionHistoryApi({ pid: "pid", - contact_id: 1, - balance_definition_id: "balance_definition_id" + contactId: 1, + balanceDefinitionId: "balanceDefinitionId" }); ``` @@ -10238,6 +10313,72 @@ await client.program.getParameterSubscriptionInfo({ + + + + +
client.program.deleteContactSubscription({ ...params }) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete subscription for a contact +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.program.deleteContactSubscription({ + pid: "pid", + cid: 1 +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Brevo.DeleteContactSubscriptionRequest` + +
+
+ +
+
+ +**requestOptions:** `ProgramClient.RequestOptions` + +
+
+
+
+ +
@@ -11844,11 +11985,8 @@ await client.tier.deleteTier({
- -The response payload for this endpoint has changed - -You now need to specify which type of statistics you would like to retrieve. For more information visit [this page](https://developers.brevo.com/changelog/get-all-marketing-campaigns). - +The response payload for this endpoint has changed +You now need to specify which type of statistics you would like to retrieve. For more information visit [this page](https://developers.brevo.com/changelog/get-all-marketing-campaigns).
@@ -13172,19 +13310,11 @@ await client.whatsAppCampaigns.getWhatsAppCampaigns();
- -You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. - -[Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account - - - -This API requires the List and Segment ids as recipients in Body params. You can use the below Contact endpoints to get the required information. - +You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. +[Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account +This API requires the List and Segment ids as recipients in Body params.You can use the below Contact endpoints to get the required information. [Get all the Lists](https://developers.brevo.com/reference/getlists-1) - -[Get all the Segments](https://developers.brevo.com/reference/getsegments) - +[Get all the Segments](https://developers.brevo.com/reference/getsegments)
@@ -13252,11 +13382,8 @@ await client.whatsAppCampaigns.createWhatsAppCampaign({
- -You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. - -[Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account - +You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. +[Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
@@ -13311,11 +13438,8 @@ await client.whatsAppCampaigns.getWhatsAppConfig();
- -You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. - -[Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account - +You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. +[Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
@@ -13432,11 +13556,8 @@ await client.whatsAppCampaigns.getWhatsAppTemplates();
- -You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. - -[Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account - +You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. +[Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
@@ -13501,11 +13622,11 @@ await client.whatsAppCampaigns.sendWhatsAppTemplateApproval({
- -You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. - -[Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account - +You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. +[Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account +This API requires the List and Segment ids as recipients in Body params.You can use the below Contact endpoints to get the required information. +[Get all the Lists](https://developers.brevo.com/reference/getlists-1) +[Get all the Segments](https://developers.brevo.com/reference/getsegments)
@@ -13570,19 +13691,11 @@ await client.whatsAppCampaigns.getWhatsAppCampaign({
- -You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. - -[Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account - - - -This API requires the List and Segment ids as recipients in Body params. You can use the below Contact endpoints to get the required information. - +You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. +[Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account +This API requires the List and Segment ids as recipients in Body params.You can use the below Contact endpoints to get the required information. [Get all the Lists](https://developers.brevo.com/reference/getlists-1) - -[Get all the Segments](https://developers.brevo.com/reference/getsegments) - +[Get all the Segments](https://developers.brevo.com/reference/getsegments)
@@ -14103,6 +14216,108 @@ await client.companies.createACompanyDealAttribute({ + + + + +
client.companies.deleteAnAttribute({ ...params }) -> void +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.companies.deleteAnAttribute({ + id: "id" +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Brevo.DeleteCrmAttributesIdRequest` + +
+
+ +
+
+ +**requestOptions:** `CompaniesClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.companies.updateAnAttribute({ ...params }) -> void +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.companies.updateAnAttribute({ + id: "id" +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Brevo.PatchCrmAttributesIdRequest` + +
+
+ +
+
+ +**requestOptions:** `CompaniesClient.RequestOptions` + +
+
+
+
+ +
@@ -15527,7 +15742,8 @@ await client.tasks.getAllTaskTypes();
-You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account +You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. +[Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account This endpoint is used to send a WhatsApp message.
(**The first message you send using the API must contain a Template ID. You must create a template on WhatsApp on the Brevo platform to fetch the Template ID.**)
@@ -16262,13 +16478,9 @@ await client.transactionalEmails.getTransacEmailsList();
- -You can get the uuid using either of the following methods: - +You can get the uuid using either of the following methods: Send a GET request to https://api.brevo.com/v3/smtp/emails and pass the message_id in the url. Use your api-key to authenticate the request and you will get your uuid as a response. - -The uuid can also be fetched from the transactional logs page in your Brevo account, from the address URL. - +The uuid can also be fetched from the transactional logs page in your Brevo account, from the address URL.
@@ -16918,15 +17130,9 @@ await client.transactionalEmails.sendTestTemplate({
- -If the user includes stop code in the Transactional SMS, then it will be switched to Marketing SMS automatically and it will be interpreted as a Marketing SMS. To send Transactional SMS as Transactional, it is important not to use stop code. - -Note: For adding a stop code, client has to add reply STOP to [STOP_CODE] and the [STOP_CODE] will be replaced with the number. - - - -Transactional SMS can be sent at any time without time restrictions. However, if a message is categorized as Marketing, it must adhere to specific time restrictions. Messages sent outside of these restricted hours will experience delays and will be processed during allowable times. Specifically, Marketing SMS cannot be processed between 10pm and 8am, on Sundays, and on French public holidays. - +If the user includes stop code in the Transactional SMS, then it will be switched to Marketing SMS automatically and it will be interpreted as a Marketing SMS. To send Transactional SMS as Transactional, it is important not to use stop code. +Note: For adding a stop code, client has to add reply STOP to [STOP_CODE] and the [STOP_CODE] will be replaced with the number. +Transactional SMS can be sent at any time without time restrictions. However, if a message is categorized as Marketing, it must adhere to specific time restrictions. Messages sent outside of these restricted hours will experience delays and will be processed during allowable times. Specifically, Marketing SMS cannot be processed between 10pm and 8am, on Sundays, and on French public holidays.
@@ -17228,3 +17434,4 @@ await client.smsTemplates.getSmsTemplates(); + diff --git a/src/BaseClient.ts b/src/BaseClient.ts index 61cff76..f8e7177 100644 --- a/src/BaseClient.ts +++ b/src/BaseClient.ts @@ -51,8 +51,8 @@ export function normalizeClientOptions} A standard Response object. + */ + public async fetch( + input: Request | string | URL, + init?: RequestInit, + requestOptions?: core.PassthroughRequest.RequestOptions, + ): Promise { + return core.makePassthroughRequest( + input, + init, + { + baseUrl: this._options.baseUrl ?? this._options.environment, + headers: this._options.headers, + timeoutInSeconds: this._options.timeoutInSeconds, + maxRetries: this._options.maxRetries, + fetch: this._options.fetch, + logging: this._options.logging, + getAuthHeaders: async () => (await this._options.authProvider.getAuthRequest()).headers, + }, + requestOptions, + ); + } } diff --git a/src/api/resources/account/exports.ts b/src/api/resources/account/exports.ts new file mode 100644 index 0000000..78289e9 --- /dev/null +++ b/src/api/resources/account/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { AccountClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/account/types/GetAccountResponse.ts b/src/api/resources/account/types/GetAccountResponse.ts index a0b751b..4816f3d 100644 --- a/src/api/resources/account/types/GetAccountResponse.ts +++ b/src/api/resources/account/types/GetAccountResponse.ts @@ -121,7 +121,7 @@ export namespace GetAccountResponse { /** Plan end date (Unix timestamp) */ endDate: string; /** User seat information for the plan */ - users: Item.Users; + users: Item.Users | null; /** Credits allocated for this plan category (optional, may not be present for all plan categories) */ credits?: string | undefined; } diff --git a/src/api/resources/balance/client/Client.ts b/src/api/resources/balance/client/Client.ts index 2b3775f..cdca428 100644 --- a/src/api/resources/balance/client/Client.ts +++ b/src/api/resources/balance/client/Client.ts @@ -60,6 +60,7 @@ export class BalanceClient { sort, contact_id: contactId, balance_definition_id: balanceDefinitionId, + includeInternal, } = request; const _queryParams: Record = { limit, @@ -68,6 +69,7 @@ export class BalanceClient { sort, contact_id: contactId, balance_definition_id: balanceDefinitionId, + includeInternal, }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( @@ -990,7 +992,10 @@ export class BalanceClient { request: Brevo.GetContactBalancesRequest, requestOptions?: BalanceClient.RequestOptions, ): Promise> { - const { pid } = request; + const { pid, includeInternal } = request; + const _queryParams: Record = { + includeInternal, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -1006,7 +1011,7 @@ export class BalanceClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1170,7 +1175,10 @@ export class BalanceClient { request: Brevo.GetSubscriptionBalancesRequest, requestOptions?: BalanceClient.RequestOptions, ): Promise> { - const { pid, cid } = request; + const { pid, cid, includeInternal } = request; + const _queryParams: Record = { + includeInternal, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -1186,7 +1194,7 @@ export class BalanceClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1342,8 +1350,8 @@ export class BalanceClient { * @example * await client.balance.getTransactionHistoryApi({ * pid: "pid", - * contact_id: 1, - * balance_definition_id: "balance_definition_id" + * contactId: 1, + * balanceDefinitionId: "balanceDefinitionId" * }) */ public getTransactionHistoryApi( @@ -1361,20 +1369,24 @@ export class BalanceClient { pid, limit, offset, - sort_field: sortField, + sortField, sort, - contact_id: contactId, - balance_definition_id: balanceDefinitionId, + contactId, + balanceDefinitionId, filters, + status, + transactionType, } = request; const _queryParams: Record = { limit, offset, - sort_field: sortField != null ? sortField : undefined, + sortField: sortField != null ? sortField : undefined, sort: sort != null ? sort : undefined, - contact_id: contactId, - balance_definition_id: balanceDefinitionId, + contactId, + balanceDefinitionId, filters, + status: status != null ? status : undefined, + transactionType: transactionType != null ? transactionType : undefined, }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( diff --git a/src/api/resources/balance/client/requests/GetContactBalancesRequest.ts b/src/api/resources/balance/client/requests/GetContactBalancesRequest.ts index 01d4037..676e240 100644 --- a/src/api/resources/balance/client/requests/GetContactBalancesRequest.ts +++ b/src/api/resources/balance/client/requests/GetContactBalancesRequest.ts @@ -9,4 +9,6 @@ export interface GetContactBalancesRequest { /** Loyalty Program Id */ pid: string; + /** Include balances tied to internal definitions. */ + includeInternal?: boolean; } diff --git a/src/api/resources/balance/client/requests/GetLoyaltyBalanceProgramsPidActiveBalanceRequest.ts b/src/api/resources/balance/client/requests/GetLoyaltyBalanceProgramsPidActiveBalanceRequest.ts index 9dea331..cdced4d 100644 --- a/src/api/resources/balance/client/requests/GetLoyaltyBalanceProgramsPidActiveBalanceRequest.ts +++ b/src/api/resources/balance/client/requests/GetLoyaltyBalanceProgramsPidActiveBalanceRequest.ts @@ -23,4 +23,6 @@ export interface GetLoyaltyBalanceProgramsPidActiveBalanceRequest { contact_id: number; /** Balance Definition ID */ balance_definition_id: string; + /** Include balances tied to internal definitions. */ + includeInternal?: boolean; } diff --git a/src/api/resources/balance/client/requests/GetLoyaltyBalanceProgramsPidTransactionHistoryRequest.ts b/src/api/resources/balance/client/requests/GetLoyaltyBalanceProgramsPidTransactionHistoryRequest.ts index 0f78401..915f95e 100644 --- a/src/api/resources/balance/client/requests/GetLoyaltyBalanceProgramsPidTransactionHistoryRequest.ts +++ b/src/api/resources/balance/client/requests/GetLoyaltyBalanceProgramsPidTransactionHistoryRequest.ts @@ -6,8 +6,8 @@ import type * as Brevo from "../../../../index.js"; * @example * { * pid: "pid", - * contact_id: 1, - * balance_definition_id: "balance_definition_id" + * contactId: 1, + * balanceDefinitionId: "balanceDefinitionId" * } */ export interface GetLoyaltyBalanceProgramsPidTransactionHistoryRequest { @@ -15,16 +15,20 @@ export interface GetLoyaltyBalanceProgramsPidTransactionHistoryRequest { pid: string; /** Limit the number of records returned */ limit?: number; - /** Skip a number of records */ + /** Page number to retrieve */ offset?: number; /** Field to sort by */ - sort_field?: Brevo.GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSortField; + sortField?: "createdAt"; /** Sort order, either asc or desc */ sort?: Brevo.GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort; /** Contact ID */ - contact_id: number; + contactId: number; /** Balance Definition ID */ - balance_definition_id: string; + balanceDefinitionId: string; /** Filters to apply */ filters?: string | string[]; + /** Transaction status filter. Allowed values: draft, completed, rejected, cancelled, expired */ + status?: Brevo.GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus; + /** Transaction type filter. Allowed values: credit, debit */ + transactionType?: Brevo.GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType; } diff --git a/src/api/resources/balance/client/requests/GetSubscriptionBalancesRequest.ts b/src/api/resources/balance/client/requests/GetSubscriptionBalancesRequest.ts index b939c3d..1d85750 100644 --- a/src/api/resources/balance/client/requests/GetSubscriptionBalancesRequest.ts +++ b/src/api/resources/balance/client/requests/GetSubscriptionBalancesRequest.ts @@ -12,4 +12,6 @@ export interface GetSubscriptionBalancesRequest { pid: string; /** Contact Id */ cid: string; + /** Include balances tied to internal definitions. */ + includeInternal?: boolean; } diff --git a/src/api/resources/balance/client/requests/PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequest.ts b/src/api/resources/balance/client/requests/PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequest.ts index 705a0a5..6ac373a 100644 --- a/src/api/resources/balance/client/requests/PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequest.ts +++ b/src/api/resources/balance/client/requests/PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequest.ts @@ -36,7 +36,7 @@ export interface PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequest { /** Maximum debit allowed per operation. */ maxDebitAmountLimit?: number; /** Additional metadata for the balance definition. */ - meta?: Record; + meta?: PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequest.Meta; /** Minimum allowable balance amount. */ minAmount?: number; /** Name of the balance definition. */ @@ -86,6 +86,17 @@ export namespace PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequest { } as const; export type BalanceOptionDebitRounding = (typeof BalanceOptionDebitRounding)[keyof typeof BalanceOptionDebitRounding]; + + /** + * Additional metadata for the balance definition. + */ + export interface Meta { + /** Indicates whether the balance definition is internal. */ + isInternal?: boolean | undefined; + /** Accepts any additional properties */ + [key: string]: any; + } + /** Unit of balance measurement. */ export const Unit = { Points: "POINTS", diff --git a/src/api/resources/balance/client/requests/UpdateBalanceDefinitionRequest.ts b/src/api/resources/balance/client/requests/UpdateBalanceDefinitionRequest.ts index 1c1970a..043ad53 100644 --- a/src/api/resources/balance/client/requests/UpdateBalanceDefinitionRequest.ts +++ b/src/api/resources/balance/client/requests/UpdateBalanceDefinitionRequest.ts @@ -39,7 +39,7 @@ export interface UpdateBalanceDefinitionRequest { /** Maximum debit allowed per operation. */ maxDebitAmountLimit?: number; /** Optional metadata for the balance definition. */ - meta?: Record; + meta?: UpdateBalanceDefinitionRequest.Meta; /** Minimum allowable balance amount. */ minAmount?: number; /** Name of the balance definition. */ @@ -89,6 +89,17 @@ export namespace UpdateBalanceDefinitionRequest { } as const; export type BalanceOptionDebitRounding = (typeof BalanceOptionDebitRounding)[keyof typeof BalanceOptionDebitRounding]; + + /** + * Optional metadata for the balance definition. + */ + export interface Meta { + /** Indicates whether the balance definition is internal. */ + isInternal?: boolean | undefined; + /** Accepts any additional properties */ + [key: string]: any; + } + /** Unit of balance measurement. */ export const Unit = { Points: "POINTS", diff --git a/src/api/resources/balance/exports.ts b/src/api/resources/balance/exports.ts new file mode 100644 index 0000000..7d8e9e6 --- /dev/null +++ b/src/api/resources/balance/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { BalanceClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus.ts b/src/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus.ts new file mode 100644 index 0000000..2b5f162 --- /dev/null +++ b/src/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +export const GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus = { + Draft: "draft", + Completed: "completed", + Rejected: "rejected", + Cancelled: "cancelled", + Expired: "expired", +} as const; +export type GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus = + (typeof GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus)[keyof typeof GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus]; diff --git a/src/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSortField.ts b/src/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType.ts similarity index 58% rename from src/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSortField.ts rename to src/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType.ts index 06c550c..8213b10 100644 --- a/src/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSortField.ts +++ b/src/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType.ts @@ -1,9 +1,8 @@ // This file was auto-generated by Fern from our API Definition. -export const GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSortField = { - Name: "name", - CreatedAt: "created_at", - UpdatedAt: "updated_at", +export const GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType = { + Credit: "credit", + Debit: "debit", } as const; -export type GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSortField = - (typeof GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSortField)[keyof typeof GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSortField]; +export type GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType = + (typeof GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType)[keyof typeof GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType]; diff --git a/src/api/resources/balance/types/index.ts b/src/api/resources/balance/types/index.ts index 80b736d..5714e84 100644 --- a/src/api/resources/balance/types/index.ts +++ b/src/api/resources/balance/types/index.ts @@ -7,7 +7,8 @@ export * from "./GetBalanceDefinitionRequestVersion.js"; export * from "./GetBalanceLimitRequestVersion.js"; export * from "./GetContactBalancesResponse.js"; export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort.js"; -export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSortField.js"; +export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus.js"; +export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType.js"; export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryResponse.js"; export * from "./GetSubscriptionBalancesResponse.js"; export * from "./PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse.js"; diff --git a/src/api/resources/companies/client/Client.ts b/src/api/resources/companies/client/Client.ts index e10046a..025cc1c 100644 --- a/src/api/resources/companies/client/Client.ts +++ b/src/api/resources/companies/client/Client.ts @@ -590,6 +590,145 @@ export class CompaniesClient { return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/crm/attributes"); } + /** + * @param {Brevo.DeleteCrmAttributesIdRequest} request + * @param {CompaniesClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Brevo.BadRequestError} + * @throws {@link Brevo.NotFoundError} + * + * @example + * await client.companies.deleteAnAttribute({ + * id: "id" + * }) + */ + public deleteAnAttribute( + request: Brevo.DeleteCrmAttributesIdRequest, + requestOptions?: CompaniesClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deleteAnAttribute(request, requestOptions)); + } + + private async __deleteAnAttribute( + request: Brevo.DeleteCrmAttributesIdRequest, + requestOptions?: CompaniesClient.RequestOptions, + ): Promise> { + const { id } = request; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.BrevoEnvironment.Default, + `crm/attributes/${core.url.encodePathParam(id)}`, + ), + method: "DELETE", + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { data: undefined, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Brevo.BadRequestError(_response.error.body as unknown, _response.rawResponse); + case 404: + throw new Brevo.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.BrevoError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/crm/attributes/{id}"); + } + + /** + * @param {Brevo.PatchCrmAttributesIdRequest} request + * @param {CompaniesClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Brevo.BadRequestError} + * @throws {@link Brevo.NotFoundError} + * + * @example + * await client.companies.updateAnAttribute({ + * id: "id" + * }) + */ + public updateAnAttribute( + request: Brevo.PatchCrmAttributesIdRequest, + requestOptions?: CompaniesClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__updateAnAttribute(request, requestOptions)); + } + + private async __updateAnAttribute( + request: Brevo.PatchCrmAttributesIdRequest, + requestOptions?: CompaniesClient.RequestOptions, + ): Promise> { + const { id, ..._body } = request; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.BrevoEnvironment.Default, + `crm/attributes/${core.url.encodePathParam(id)}`, + ), + method: "PATCH", + headers: _headers, + contentType: "application/json", + queryParameters: requestOptions?.queryParams, + requestType: "json", + body: _body, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { data: undefined, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Brevo.BadRequestError(_response.error.body as unknown, _response.rawResponse); + case 404: + throw new Brevo.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.BrevoError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/crm/attributes/{id}"); + } + /** * @param {CompaniesClient.RequestOptions} requestOptions - Request-specific configuration. * diff --git a/src/api/resources/companies/client/requests/DeleteCrmAttributesIdRequest.ts b/src/api/resources/companies/client/requests/DeleteCrmAttributesIdRequest.ts new file mode 100644 index 0000000..69f8d3e --- /dev/null +++ b/src/api/resources/companies/client/requests/DeleteCrmAttributesIdRequest.ts @@ -0,0 +1,12 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * { + * id: "id" + * } + */ +export interface DeleteCrmAttributesIdRequest { + /** Attribute ID */ + id: string; +} diff --git a/src/api/resources/companies/client/requests/PatchCrmAttributesIdRequest.ts b/src/api/resources/companies/client/requests/PatchCrmAttributesIdRequest.ts new file mode 100644 index 0000000..dce4554 --- /dev/null +++ b/src/api/resources/companies/client/requests/PatchCrmAttributesIdRequest.ts @@ -0,0 +1,38 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * { + * id: "id" + * } + */ +export interface PatchCrmAttributesIdRequest { + /** Attribute ID */ + id: string; + /** Attribute display label */ + label?: string; + /** Updated labels for selectable options */ + optionsLabels?: PatchCrmAttributesIdRequest.OptionsLabels.Item[]; + /** The type of object the attribute belongs to, it cannot be updated after creation */ + objectType?: PatchCrmAttributesIdRequest.ObjectType; +} + +export namespace PatchCrmAttributesIdRequest { + export type OptionsLabels = OptionsLabels.Item[]; + + export namespace OptionsLabels { + export interface Item { + /** Internal option identifier */ + key: string; + /** Display label for the option */ + value: string; + } + } + + /** The type of object the attribute belongs to, it cannot be updated after creation */ + export const ObjectType = { + Companies: "companies", + Deals: "deals", + } as const; + export type ObjectType = (typeof ObjectType)[keyof typeof ObjectType]; +} diff --git a/src/api/resources/companies/client/requests/index.ts b/src/api/resources/companies/client/requests/index.ts index 0d519c9..d3b626f 100644 --- a/src/api/resources/companies/client/requests/index.ts +++ b/src/api/resources/companies/client/requests/index.ts @@ -1,8 +1,10 @@ export type { DeleteCompaniesIdRequest } from "./DeleteCompaniesIdRequest.js"; +export type { DeleteCrmAttributesIdRequest } from "./DeleteCrmAttributesIdRequest.js"; export type { GetCompaniesIdRequest } from "./GetCompaniesIdRequest.js"; export type { GetCompaniesRequest } from "./GetCompaniesRequest.js"; export type { PatchCompaniesIdRequest } from "./PatchCompaniesIdRequest.js"; export type { PatchCompaniesLinkUnlinkIdRequest } from "./PatchCompaniesLinkUnlinkIdRequest.js"; +export { PatchCrmAttributesIdRequest } from "./PatchCrmAttributesIdRequest.js"; export type { PostCompaniesImportRequest } from "./PostCompaniesImportRequest.js"; export type { PostCompaniesRequest } from "./PostCompaniesRequest.js"; export { PostCrmAttributesRequest } from "./PostCrmAttributesRequest.js"; diff --git a/src/api/resources/companies/exports.ts b/src/api/resources/companies/exports.ts new file mode 100644 index 0000000..2ca4d18 --- /dev/null +++ b/src/api/resources/companies/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { CompaniesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/contacts/client/Client.ts b/src/api/resources/contacts/client/Client.ts index 535274e..dca6cf5 100644 --- a/src/api/resources/contacts/client/Client.ts +++ b/src/api/resources/contacts/client/Client.ts @@ -23,14 +23,6 @@ export class ContactsClient { } /** - * - * Accepted Number Formats - * - * 91xxxxxxxxxx - * +91xxxxxxxxxx - * 0091xxxxxxxxxx - * - * * @param {Brevo.GetContactsRequest} request * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * @@ -110,6 +102,8 @@ export class ContactsClient { } /** + * Follow this format when passing a "SMS" phone number as an attribute. + * Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx * Creates new contacts on Brevo. Contacts can be created by passing either -

1. email address of the contact (email_id),
2. phone number of the contact (to be passed as "SMS" field in "attributes" along with proper country code), For example- {"SMS":"+91xxxxxxxxxx"} or {"SMS":"0091xxxxxxxxxx"}
3. ext_id
* * @param {Brevo.CreateContactRequest} request @@ -600,9 +594,7 @@ export class ContactsClient { } /** - * - * attributes param in this endpoint is an object containing key-value pairs where values can be either a string, integer, array, or boolean. You can create key-value pairs with these four datatypes. When a value is an array, it should be an array of strings. - * + * attributes param in this endpoint is an object containing key-value pairs where values can be either a string, integer, array, or boolean. You can create key-value pairs with these four datatypes. When a value is an array, it should be an array of strings. * * @param {Brevo.CreateDoiContactRequest} request * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. @@ -754,17 +746,11 @@ export class ContactsClient { } /** - * - * Ongoing changes for this endpoint - * + * Ongoing changes for this endpoint * We're dropping support for the response attributes totalSubscribers and totalBlacklisted. - * * These are non breaking changes. - * * The default value for the attributes will be 0. - * - * The uniqueSubscribers field is deprecated - * + * The uniqueSubscribers field is deprecated * * @param {Brevo.GetFoldersRequest} request * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. @@ -899,13 +885,9 @@ export class ContactsClient { } /** - * - * Ongoing changes for this endpoint. - * + * Ongoing changes for this endpoint. * We're dropping support for the response attributes totalSubscribers and totalBlacklisted. - * - * These are non breaking changes. The default value for the attributes will be 0. - * + * These are non breaking changes. The default value for the attributes will be 0. * * @param {Brevo.GetFolderRequest} request * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. @@ -1120,13 +1102,9 @@ export class ContactsClient { } /** - * - * Ongoing changes for this endpoint. - * + * Ongoing changes for this endpoint. * We're dropping support for the response attributes totalSubscribers and totalBlacklisted. - * - * These are non breaking changes. The default value for the attributes will be 0. - * + * These are non breaking changes. The default value for the attributes will be 0. * * @param {Brevo.GetFolderListsRequest} request * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. @@ -1273,13 +1251,9 @@ export class ContactsClient { } /** - * - * Ongoing changes for this endpoint. - * + * Ongoing changes for this endpoint. * We're dropping support for the response attributes totalSubscribers and totalBlacklisted. - * - * These are non breaking changes. The default value for the attributes will be 0. - * + * These are non breaking changes. The default value for the attributes will be 0. * * @param {Brevo.GetListsRequest} request * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. @@ -1973,14 +1947,8 @@ export class ContactsClient { } /** - * - * Accepted Number Formats - * - * 91xxxxxxxxxx - * +91xxxxxxxxxx - * 0091xxxxxxxxxx - * - * + * Follow this format when passing a "SMS" phone number as an attribute. + * Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx * There are 2 ways to get a contact

Option 1- https://api.brevo.com/v3/contacts/{identifier}

Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={}

Option 1 only works if identifierType is email_id (for EMAIL), phone_id (for SMS) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL, SMS and ID of the contact.

Option 2 works for all identifierType, use email_id for EMAIL attribute, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute

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. * * @param {Brevo.GetContactInfoRequest} request @@ -2056,6 +2024,8 @@ export class ContactsClient { } /** + * Follow this format when passing a "SMS" phone number as an attribute. + * Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx

If a blocklisted contact's email address is updated, it is going to remove that blocklisting from the contact and they will be resubscribed.
* There are 2 ways to update a contact

Option 1- https://api.brevo.com/v3/contacts/{identifier}

Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={}

Option 1 only works if identifierType is email_id (for EMAIL) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL and ID of the contact.

Option 2 works for all identifierType, use email_id for EMAIL attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute * * @param {Brevo.UpdateContactRequest} request diff --git a/src/api/resources/contacts/client/requests/AddContactToListRequest.ts b/src/api/resources/contacts/client/requests/AddContactToListRequest.ts index 0cfa627..2ce05f9 100644 --- a/src/api/resources/contacts/client/requests/AddContactToListRequest.ts +++ b/src/api/resources/contacts/client/requests/AddContactToListRequest.ts @@ -26,30 +26,6 @@ import type * as Brevo from "../../../../index.js"; * ids: [1, 2] * } * } - * - * @example - * { - * listId: 1000000, - * body: { - * emails: ["jeff32@example.com", "jim56@example.com"] - * } - * } - * - * @example - * { - * listId: 1000000, - * body: { - * emails: ["jeff32@example.com", "jim56@example.com"] - * } - * } - * - * @example - * { - * listId: 1000000, - * body: { - * emails: ["jeff32@example.com", "jim56@example.com"] - * } - * } */ export interface AddContactToListRequest { /** Id of the list */ diff --git a/src/api/resources/contacts/client/requests/RemoveContactFromListRequest.ts b/src/api/resources/contacts/client/requests/RemoveContactFromListRequest.ts index 860544a..edb52db 100644 --- a/src/api/resources/contacts/client/requests/RemoveContactFromListRequest.ts +++ b/src/api/resources/contacts/client/requests/RemoveContactFromListRequest.ts @@ -34,38 +34,6 @@ import type * as Brevo from "../../../../index.js"; * ids: [1, 2] * } * } - * - * @example - * { - * listId: 1000000, - * body: { - * all: true - * } - * } - * - * @example - * { - * listId: 1000000, - * body: { - * all: true - * } - * } - * - * @example - * { - * listId: 1000000, - * body: { - * all: true - * } - * } - * - * @example - * { - * listId: 1000000, - * body: { - * all: true - * } - * } */ export interface RemoveContactFromListRequest { /** Id of the list */ diff --git a/src/api/resources/contacts/exports.ts b/src/api/resources/contacts/exports.ts new file mode 100644 index 0000000..657fdf5 --- /dev/null +++ b/src/api/resources/contacts/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { ContactsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/conversations/exports.ts b/src/api/resources/conversations/exports.ts new file mode 100644 index 0000000..82be4a7 --- /dev/null +++ b/src/api/resources/conversations/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { ConversationsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/coupons/exports.ts b/src/api/resources/coupons/exports.ts new file mode 100644 index 0000000..8bd048a --- /dev/null +++ b/src/api/resources/coupons/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { CouponsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/customObjects/client/Client.ts b/src/api/resources/customObjects/client/Client.ts index 4d8d8ff..012c9ad 100644 --- a/src/api/resources/customObjects/client/Client.ts +++ b/src/api/resources/customObjects/client/Client.ts @@ -23,12 +23,8 @@ export class CustomObjectsClient { } /** - * - * Custom objects are only available to Enterprise plans. - * - * This feature is in beta. These are subject to change. - * - * + * Custom objects are only available to Enterprise plans. + * This feature is in beta. These are subject to change. * This API allows bulk upsert of object records in a single request. Each object record may include * - Attributes * - Identifiers @@ -42,8 +38,8 @@ export class CustomObjectsClient { * - Max 500 attributes defined per object record upsert request * - This is coherent with schema limitation: an object cannot have more than 500 attributes. * - Worth noting: Nothing happens If an attribute is mentioned in the request, but was not previously defined for the object schema (no error, no attribute creation) - * - Max 10 associations defined per object record upsert request - * - This is coherent with schema limitation: an object cannot have more than 10 associations with other objects. and each object record can be linked to max 10 other records. + * - Max 10 associations defined per associated object type, in each record of the request + * - This is not a schema limitation. You can associate an object record to an unlimited number of other object records by running multiple requests. * **Errors:** * - Make sure both object records exist before associating them, else the API will return an error. * - This route does not create objects. The object where the object records are upserted by this API must be created already else the API will return an error "invalid object type". @@ -131,12 +127,8 @@ export class CustomObjectsClient { } /** - * - * Custom objects are only available to Enterprise plans. - * - * This feature is in beta. These are subject to change. - * - * + * Custom objects are only available to Enterprise plans. + * This feature is in beta. These are subject to change. * This API retrieves a list of object records along with their associated records and provides the total count of records for the specified object. **Note**: Contact as object type is not supported in this endpoint. * * @param {Brevo.GetrecordsRequest} request diff --git a/src/api/resources/customObjects/client/requests/UpsertrecordsRequest.ts b/src/api/resources/customObjects/client/requests/UpsertrecordsRequest.ts index faf7fb5..36e0ce2 100644 --- a/src/api/resources/customObjects/client/requests/UpsertrecordsRequest.ts +++ b/src/api/resources/customObjects/client/requests/UpsertrecordsRequest.ts @@ -20,7 +20,7 @@ export namespace UpsertrecordsRequest { export namespace Records { export interface Item { associations?: Item.Associations.Item[] | undefined; - /** Attributes attached with the object record. Only the already created attributes will be used with records. Minimum 1 attribute is required. */ + /** Attributes attached with the object record. Only the already created attributes will be used with records. Pass the value with the attributes key you want to set or update for the object record. Minimum 1 attribute is required. */ attributes?: Record | undefined; /** Identifiers attached with the object record. It can have id or ext_id. ext_id is ID of record in the external system that client want to store in the object system, id is an internal ID of object record generated by Brevo system. NOTE: - Its an optional field, if identifier is not provided, then id of object records will be generated by Brevo. This id can be used for further operation with the object record. - Both ext_id and id cannot be provided in the same request. */ identifiers?: Item.Identifiers | undefined; diff --git a/src/api/resources/customObjects/exports.ts b/src/api/resources/customObjects/exports.ts new file mode 100644 index 0000000..5be143e --- /dev/null +++ b/src/api/resources/customObjects/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { CustomObjectsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/customObjects/types/UpsertrecordsResponse.ts b/src/api/resources/customObjects/types/UpsertrecordsResponse.ts index bc889e6..d7b1c12 100644 --- a/src/api/resources/customObjects/types/UpsertrecordsResponse.ts +++ b/src/api/resources/customObjects/types/UpsertrecordsResponse.ts @@ -2,6 +2,6 @@ export interface UpsertrecordsResponse { message?: string | undefined; - /** Unique Id for the batch process used to track the status of the batch. */ + /** Unique Id for the batch process used to track the status of the batch. **How to use this processId:** Refer to the [Get process status API](https://developers.brevo.com/reference/get-process) to check the execution status of this batch using the returned `processId`. */ processId?: number | undefined; } diff --git a/src/api/resources/deals/client/Client.ts b/src/api/resources/deals/client/Client.ts index ffb26c4..d0e428b 100644 --- a/src/api/resources/deals/client/Client.ts +++ b/src/api/resources/deals/client/Client.ts @@ -584,6 +584,8 @@ export class DealsClient { } /** + * @deprecated + * * This endpoint is deprecated. Prefer /crm/pipeline/details/{pipelineID} instead. * * @param {DealsClient.RequestOptions} requestOptions - Request-specific configuration. diff --git a/src/api/resources/deals/exports.ts b/src/api/resources/deals/exports.ts new file mode 100644 index 0000000..1c1e9ee --- /dev/null +++ b/src/api/resources/deals/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { DealsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/domains/client/requests/AuthenticateDomainRequest.ts b/src/api/resources/domains/client/requests/AuthenticateDomainRequest.ts index 7b80387..b5071d8 100644 --- a/src/api/resources/domains/client/requests/AuthenticateDomainRequest.ts +++ b/src/api/resources/domains/client/requests/AuthenticateDomainRequest.ts @@ -1,11 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * domainName: "domainName" - * } - * * @example * { * domainName: "domainName" diff --git a/src/api/resources/domains/client/requests/CreateDomainRequest.ts b/src/api/resources/domains/client/requests/CreateDomainRequest.ts index acb9725..09e38e9 100644 --- a/src/api/resources/domains/client/requests/CreateDomainRequest.ts +++ b/src/api/resources/domains/client/requests/CreateDomainRequest.ts @@ -15,16 +15,6 @@ * { * name: "test.example.com" * } - * - * @example - * { - * name: "mycompany.com" - * } - * - * @example - * { - * name: "mycompany.com" - * } */ export interface CreateDomainRequest { /** Domain name to be added */ diff --git a/src/api/resources/domains/client/requests/GetDomainConfigurationRequest.ts b/src/api/resources/domains/client/requests/GetDomainConfigurationRequest.ts index 03b367f..a9880eb 100644 --- a/src/api/resources/domains/client/requests/GetDomainConfigurationRequest.ts +++ b/src/api/resources/domains/client/requests/GetDomainConfigurationRequest.ts @@ -1,11 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * domainName: "domainName" - * } - * * @example * { * domainName: "domainName" diff --git a/src/api/resources/domains/exports.ts b/src/api/resources/domains/exports.ts new file mode 100644 index 0000000..7752741 --- /dev/null +++ b/src/api/resources/domains/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { DomainsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/ecommerce/client/Client.ts b/src/api/resources/ecommerce/client/Client.ts index a3b3a4a..b85d222 100644 --- a/src/api/resources/ecommerce/client/Client.ts +++ b/src/api/resources/ecommerce/client/Client.ts @@ -856,8 +856,7 @@ export class EcommerceClient { * id: "14", * products: [{ * price: 99.99, - * productId: "P1", - * quantity: 10 + * productId: "P1" * }], * status: "completed", * updatedAt: "2021-07-30T10:59:23.383Z" @@ -935,8 +934,7 @@ export class EcommerceClient { * id: "14", * products: [{ * price: 99.99, - * productId: "P1", - * quantity: 10 + * productId: "P1" * }], * status: "completed", * updatedAt: "2021-07-30T10:59:23.383Z" diff --git a/src/api/resources/ecommerce/client/requests/CreateBatchOrderRequest.ts b/src/api/resources/ecommerce/client/requests/CreateBatchOrderRequest.ts index fcecd5a..62a9c47 100644 --- a/src/api/resources/ecommerce/client/requests/CreateBatchOrderRequest.ts +++ b/src/api/resources/ecommerce/client/requests/CreateBatchOrderRequest.ts @@ -11,8 +11,7 @@ import type * as Brevo from "../../../../index.js"; * id: "14", * products: [{ * price: 99.99, - * productId: "P1", - * quantity: 10 + * productId: "P1" * }], * status: "completed", * updatedAt: "2021-07-30T10:59:23.383Z" diff --git a/src/api/resources/ecommerce/client/requests/CreateUpdateBatchProductsRequest.ts b/src/api/resources/ecommerce/client/requests/CreateUpdateBatchProductsRequest.ts index 003168d..b34e33b 100644 --- a/src/api/resources/ecommerce/client/requests/CreateUpdateBatchProductsRequest.ts +++ b/src/api/resources/ecommerce/client/requests/CreateUpdateBatchProductsRequest.ts @@ -21,17 +21,21 @@ export namespace CreateUpdateBatchProductsRequest { export namespace Products { export interface Item { + /** Brand of the product */ + brand?: string | undefined; /** Category ID-s of the product */ categories?: string[] | undefined; /** UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the product deleted from the shop's database */ deletedAt?: string | undefined; + /** Description of the product */ + description?: string | undefined; /** Product ID for which you requested the details */ id: string; /** Absolute URL to the cover image of the product */ imageUrl?: string | undefined; /** product deleted from the shop's database */ isDeleted?: boolean | undefined; - /** Meta data of product such as description, vendor, producer, stock level. The size of cumulative metaInfo shall not exceed **1000 KB**. Maximum length of metaInfo object can be 20. */ + /** Meta data of product such as description, vendor, producer, stock level. The total characters of cumulative metaInfo shall not exceed **20000 characters**. */ metaInfo?: Record | undefined; /** Mandatory in case of creation**. Name of the product for which you requested the details */ name: string; diff --git a/src/api/resources/ecommerce/client/requests/CreateUpdateProductRequest.ts b/src/api/resources/ecommerce/client/requests/CreateUpdateProductRequest.ts index 0e471a0..68fe8d9 100644 --- a/src/api/resources/ecommerce/client/requests/CreateUpdateProductRequest.ts +++ b/src/api/resources/ecommerce/client/requests/CreateUpdateProductRequest.ts @@ -8,17 +8,21 @@ * } */ export interface CreateUpdateProductRequest { + /** Brand of the product */ + brand?: string; /** Category ID-s of the product */ categories?: string[]; /** UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the product deleted from the shop's database */ deletedAt?: string; + /** Description of the product */ + description?: string; /** Product ID for which you requested the details */ id: string; /** Absolute URL to the cover image of the product */ imageUrl?: string; /** product deleted from the shop's database */ isDeleted?: boolean; - /** Meta data of product such as description, vendor, producer, stock level. The size of cumulative metaInfo shall not exceed **1000 KB**. Maximum length of metaInfo object can be 20. */ + /** Meta data of product such as description, vendor, producer, stock level. The total characters of cumulative metaInfo shall not exceed **20000 characters**. */ metaInfo?: Record; /** Mandatory in case of creation**. Name of the product for which you requested the details */ name: string; diff --git a/src/api/resources/ecommerce/exports.ts b/src/api/resources/ecommerce/exports.ts new file mode 100644 index 0000000..924f6e2 --- /dev/null +++ b/src/api/resources/ecommerce/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { EcommerceClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/emailCampaigns/client/Client.ts b/src/api/resources/emailCampaigns/client/Client.ts index 29f1aa1..d9758c5 100644 --- a/src/api/resources/emailCampaigns/client/Client.ts +++ b/src/api/resources/emailCampaigns/client/Client.ts @@ -23,11 +23,8 @@ export class EmailCampaignsClient { } /** - * - * The response payload for this endpoint has changed - * - * You now need to specify which type of statistics you would like to retrieve. For more information visit [this page](https://developers.brevo.com/changelog/get-all-marketing-campaigns). - * + * The response payload for this endpoint has changed + * You now need to specify which type of statistics you would like to retrieve. For more information visit [this page](https://developers.brevo.com/changelog/get-all-marketing-campaigns). * * @param {Brevo.GetEmailCampaignsRequest} request * @param {EmailCampaignsClient.RequestOptions} requestOptions - Request-specific configuration. @@ -270,9 +267,10 @@ export class EmailCampaignsClient { request: Brevo.GetEmailCampaignRequest, requestOptions?: EmailCampaignsClient.RequestOptions, ): Promise> { - const { campaignId, statistics } = request; + const { campaignId, statistics, excludeHtmlContent } = request; const _queryParams: Record = { statistics: statistics != null ? statistics : undefined, + excludeHtmlContent, }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( diff --git a/src/api/resources/emailCampaigns/client/requests/GetEmailCampaignRequest.ts b/src/api/resources/emailCampaigns/client/requests/GetEmailCampaignRequest.ts index d77d4ef..d176a52 100644 --- a/src/api/resources/emailCampaigns/client/requests/GetEmailCampaignRequest.ts +++ b/src/api/resources/emailCampaigns/client/requests/GetEmailCampaignRequest.ts @@ -13,4 +13,6 @@ export interface GetEmailCampaignRequest { campaignId: number; /** Filter on type of the statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. */ statistics?: Brevo.GetEmailCampaignRequestStatistics; + /** Use this flag to exclude htmlContent from the response body. If set to **true**, htmlContent field will be returned as empty string in the response body */ + excludeHtmlContent?: boolean; } diff --git a/src/api/resources/emailCampaigns/exports.ts b/src/api/resources/emailCampaigns/exports.ts new file mode 100644 index 0000000..d63193f --- /dev/null +++ b/src/api/resources/emailCampaigns/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { EmailCampaignsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/emailCampaigns/types/GetEmailCampaignResponse.ts b/src/api/resources/emailCampaigns/types/GetEmailCampaignResponse.ts index 990d630..a6642f8 100644 --- a/src/api/resources/emailCampaigns/types/GetEmailCampaignResponse.ts +++ b/src/api/resources/emailCampaigns/types/GetEmailCampaignResponse.ts @@ -3,6 +3,8 @@ import type * as Brevo from "../../../index.js"; export interface GetEmailCampaignResponse { + /** Url of the attachment file. Only available if the campaign has an attachment. */ + attachmentFile?: string | undefined; /** Status of A/B Test for the campaign. abTesting = false means it is disabled, & abTesting = true means it is enabled. */ abTesting?: boolean | undefined; /** ID of the campaign */ @@ -58,6 +60,8 @@ export interface GetEmailCampaignResponse { shareLink?: string | undefined; /** Tag of the campaign */ tag?: string | undefined; + /** List of tags of the campaign */ + tags?: string[] | undefined; /** Retrieved the status of test email sending. (true=Test email has been sent false=Test email has not been sent) */ testSent: boolean; /** Customisation of the "to" field of the campaign */ @@ -82,6 +86,9 @@ export namespace GetEmailCampaignResponse { Queued: "queued", Suspended: "suspended", InProcess: "in_process", + InReview: "in_review", + Cancelling: "cancelling", + Cancelled: "cancelled", } as const; export type Status = (typeof Status)[keyof typeof Status]; /** Type of campaign */ diff --git a/src/api/resources/emailCampaigns/types/GetEmailCampaignsRequestStatus.ts b/src/api/resources/emailCampaigns/types/GetEmailCampaignsRequestStatus.ts index a7f4447..7e4058e 100644 --- a/src/api/resources/emailCampaigns/types/GetEmailCampaignsRequestStatus.ts +++ b/src/api/resources/emailCampaigns/types/GetEmailCampaignsRequestStatus.ts @@ -8,6 +8,8 @@ export const GetEmailCampaignsRequestStatus = { Draft: "draft", InProcess: "inProcess", InReview: "inReview", + Cancelling: "cancelling", + Cancelled: "cancelled", } as const; export type GetEmailCampaignsRequestStatus = (typeof GetEmailCampaignsRequestStatus)[keyof typeof GetEmailCampaignsRequestStatus]; diff --git a/src/api/resources/emailCampaigns/types/GetEmailCampaignsResponse.ts b/src/api/resources/emailCampaigns/types/GetEmailCampaignsResponse.ts index 4811eba..71d563b 100644 --- a/src/api/resources/emailCampaigns/types/GetEmailCampaignsResponse.ts +++ b/src/api/resources/emailCampaigns/types/GetEmailCampaignsResponse.ts @@ -13,6 +13,8 @@ export namespace GetEmailCampaignsResponse { export namespace Campaigns { export interface Item { + /** Url of the attachment file. Only available if the campaign has an attachment. */ + attachmentFile?: string | undefined; /** Status of A/B Test for the campaign. abTesting = false means it is disabled, & abTesting = true means it is enabled. */ abTesting?: boolean | undefined; /** ID of the campaign */ @@ -68,6 +70,8 @@ export namespace GetEmailCampaignsResponse { shareLink?: string | undefined; /** Tag of the campaign */ tag?: string | undefined; + /** List of tags of the campaign */ + tags?: string[] | undefined; /** Retrieved the status of test email sending. (true=Test email has been sent false=Test email has not been sent) */ testSent: boolean; /** Customisation of the "to" field of the campaign */ @@ -92,6 +96,9 @@ export namespace GetEmailCampaignsResponse { Queued: "queued", Suspended: "suspended", InProcess: "in_process", + InReview: "in_review", + Cancelling: "cancelling", + Cancelled: "cancelled", } as const; export type Status = (typeof Status)[keyof typeof Status]; /** Type of campaign */ diff --git a/src/api/resources/event/client/Client.ts b/src/api/resources/event/client/Client.ts index 3d70be3..0025fc4 100644 --- a/src/api/resources/event/client/Client.ts +++ b/src/api/resources/event/client/Client.ts @@ -22,6 +22,98 @@ export class EventClient { this._options = normalizeClientOptionsWithAuth(options); } + /** + * + * This endpoint currently only supports custom events. + * + * + * Retrieve a list of events filtered by various criteria. + * + * @param {Brevo.GetEventsRequest} request + * @param {EventClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Brevo.BadRequestError} + * @throws {@link Brevo.UnauthorizedError} + * @throws {@link Brevo.InternalServerError} + * + * @example + * await client.event.getEvents() + */ + public getEvents( + request: Brevo.GetEventsRequest = {}, + requestOptions?: EventClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getEvents(request, requestOptions)); + } + + private async __getEvents( + request: Brevo.GetEventsRequest = {}, + requestOptions?: EventClient.RequestOptions, + ): Promise> { + const { + contact_id: contactId, + event_name: eventName, + object_type: objectType, + startDate, + endDate, + limit, + offset, + } = request; + const _queryParams: Record = { + contact_id: contactId, + event_name: eventName, + object_type: objectType, + startDate, + endDate, + limit, + offset, + }; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.BrevoEnvironment.Default, + "events", + ), + method: "GET", + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { data: _response.body as Brevo.GetEventsList, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Brevo.BadRequestError(_response.error.body as unknown, _response.rawResponse); + case 401: + throw new Brevo.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); + case 500: + throw new Brevo.InternalServerError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.BrevoError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/events"); + } + /** * Create an event to track a contact's interaction. * @@ -94,4 +186,77 @@ export class EventClient { return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/events"); } + + /** + * Create multiple events to track contacts' interactions in a single request. + * + * @param {Brevo.CreateBatchEventsRequestItem[]} request + * @param {EventClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Brevo.BadRequestError} + * @throws {@link Brevo.UnauthorizedError} + * + * @example + * await client.event.createBatchEvents([{ + * event_name: "order_created", + * identifiers: {} + * }]) + */ + public createBatchEvents( + request: Brevo.CreateBatchEventsRequestItem[], + requestOptions?: EventClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__createBatchEvents(request, requestOptions)); + } + + private async __createBatchEvents( + request: Brevo.CreateBatchEventsRequestItem[], + requestOptions?: EventClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.BrevoEnvironment.Default, + "events/batch", + ), + method: "POST", + headers: _headers, + contentType: "application/json", + queryParameters: requestOptions?.queryParams, + requestType: "json", + body: request, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { data: _response.body as Brevo.BatchAcceptedResponse, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Brevo.BadRequestError(_response.error.body as unknown, _response.rawResponse); + case 401: + throw new Brevo.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.BrevoError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/events/batch"); + } } diff --git a/src/api/resources/event/client/requests/GetEventsRequest.ts b/src/api/resources/event/client/requests/GetEventsRequest.ts new file mode 100644 index 0000000..9ee8015 --- /dev/null +++ b/src/api/resources/event/client/requests/GetEventsRequest.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * {} + */ +export interface GetEventsRequest { + /** Filter by contact ID (repeatable) */ + contact_id?: number | number[]; + /** Filter by event name (repeatable) */ + event_name?: string | string[]; + /** Filter by object type (repeatable) */ + object_type?: string | string[]; + /** Mandatory if endDate is used. Start of date range (YYYY-MM-DD or RFC3339). Defaults to 6 months ago when omitted alongside endDate. Must be ≤ endDate. */ + startDate?: string; + /** Mandatory if startDate is used. End of date range (YYYY-MM-DD or RFC3339). Must be ≥ startDate. */ + endDate?: string; + /** Max events to return. Default 100, min 1, max 10000. */ + limit?: number; + /** Events to skip for pagination. Default 0, min 0. */ + offset?: number; +} diff --git a/src/api/resources/event/client/requests/index.ts b/src/api/resources/event/client/requests/index.ts index dff2344..471011e 100644 --- a/src/api/resources/event/client/requests/index.ts +++ b/src/api/resources/event/client/requests/index.ts @@ -1 +1,2 @@ export type { CreateEventRequest } from "./CreateEventRequest.js"; +export type { GetEventsRequest } from "./GetEventsRequest.js"; diff --git a/src/api/resources/event/exports.ts b/src/api/resources/event/exports.ts new file mode 100644 index 0000000..f341a0f --- /dev/null +++ b/src/api/resources/event/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { EventClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/event/index.ts b/src/api/resources/event/index.ts index 914b8c3..d9adb1a 100644 --- a/src/api/resources/event/index.ts +++ b/src/api/resources/event/index.ts @@ -1 +1,2 @@ export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/event/types/CreateBatchEventsRequestItem.ts b/src/api/resources/event/types/CreateBatchEventsRequestItem.ts new file mode 100644 index 0000000..2ccc0ac --- /dev/null +++ b/src/api/resources/event/types/CreateBatchEventsRequestItem.ts @@ -0,0 +1,66 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface CreateBatchEventsRequestItem { + /** Properties defining the state of the contact associated to this event. Useful to update contact attributes defined in your contacts database while passing the event. For example: **"FIRSTNAME": "Jane" , "AGE": 37** */ + contact_properties?: Record | undefined; + /** Timestamp of when the event occurred (e.g. "2024-01-24T17:39:57+01:00"). If no value is passed, the timestamp of the event creation is used. */ + event_date?: string | undefined; + /** The name of the event that occurred. This is how you will find your event in Brevo. Limited to 255 characters, alphanumerical characters and - _ only. */ + event_name: string; + /** Properties of the event. Top level properties and nested properties can be used to better segment contacts and personalise workflow conditions. The following field type are supported: string, number, boolean (true/false), date (Timestamp e.g. "2024-01-24T17:39:57+01:00"). Keys are limited to 255 characters, alphanumerical characters and - _ only. Size is limited to 50Kb. */ + event_properties?: Record | undefined; + /** Identifies the contact associated with the event. At least one identifier is required. */ + identifiers: CreateBatchEventsRequestItem.Identifiers; + /** Identifiers of the object record associated with this event. Ignored if the object type or identifier for this record does not exist on the account. */ + object?: CreateBatchEventsRequestItem.Object_ | undefined; +} + +export namespace CreateBatchEventsRequestItem { + export namespace ContactProperties { + export type Value = string | number; + } + + export namespace EventProperties { + export type Value = string | number | Record | unknown[]; + } + + /** + * Identifies the contact associated with the event. At least one identifier is required. + */ + export interface Identifiers { + /** Internal unique contact ID. When present, this takes priority over all other identifiers for event attribution and contact resolution. */ + contact_id?: number | undefined; + /** Email Id associated with the event */ + email_id?: string | undefined; + /** ext_id associated with the event */ + ext_id?: string | undefined; + /** landline_number associated with the event */ + landline_number_id?: string | undefined; + /** SMS associated with the event */ + phone_id?: string | undefined; + /** whatsapp associated with the event */ + whatsapp_id?: string | undefined; + } + + /** + * Identifiers of the object record associated with this event. Ignored if the object type or identifier for this record does not exist on the account. + */ + export interface Object_ { + /** Identifiers for the object. */ + identifiers?: Object_.Identifiers | undefined; + /** Type of object (e.g., subscription, vehicle, etc.) */ + type?: string | undefined; + } + + export namespace Object_ { + /** + * Identifiers for the object. + */ + export interface Identifiers { + /** External object ID */ + ext_id?: string | undefined; + /** Internal object ID */ + id?: string | undefined; + } + } +} diff --git a/src/api/resources/event/types/index.ts b/src/api/resources/event/types/index.ts new file mode 100644 index 0000000..b2fea88 --- /dev/null +++ b/src/api/resources/event/types/index.ts @@ -0,0 +1 @@ +export * from "./CreateBatchEventsRequestItem.js"; diff --git a/src/api/resources/externalFeeds/client/requests/GetExternalFeedByUuidRequest.ts b/src/api/resources/externalFeeds/client/requests/GetExternalFeedByUuidRequest.ts index 4f01391..bd3f468 100644 --- a/src/api/resources/externalFeeds/client/requests/GetExternalFeedByUuidRequest.ts +++ b/src/api/resources/externalFeeds/client/requests/GetExternalFeedByUuidRequest.ts @@ -1,16 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * uuid: "b1c2d3e4-f5a6-47b8-89c0-d1e2f3a4b5c6" - * } - * - * @example - * { - * uuid: "b1c2d3e4-f5a6-47b8-89c0-d1e2f3a4b5c6" - * } - * * @example * { * uuid: "b1c2d3e4-f5a6-47b8-89c0-d1e2f3a4b5c6" diff --git a/src/api/resources/externalFeeds/exports.ts b/src/api/resources/externalFeeds/exports.ts new file mode 100644 index 0000000..c87b185 --- /dev/null +++ b/src/api/resources/externalFeeds/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { ExternalFeedsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/files/exports.ts b/src/api/resources/files/exports.ts new file mode 100644 index 0000000..679b539 --- /dev/null +++ b/src/api/resources/files/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { FilesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/inboundParsing/client/Client.ts b/src/api/resources/inboundParsing/client/Client.ts index c33ce9e..1691671 100644 --- a/src/api/resources/inboundParsing/client/Client.ts +++ b/src/api/resources/inboundParsing/client/Client.ts @@ -167,6 +167,7 @@ export class InboundParsingClient { /** * This endpoint will retrieve inbound attachment with download token. + * * @throws {@link Brevo.BadRequestError} * @throws {@link Brevo.NotFoundError} */ diff --git a/src/api/resources/inboundParsing/exports.ts b/src/api/resources/inboundParsing/exports.ts new file mode 100644 index 0000000..e380874 --- /dev/null +++ b/src/api/resources/inboundParsing/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { InboundParsingClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts index b4c41cb..7252a47 100644 --- a/src/api/resources/index.ts +++ b/src/api/resources/index.ts @@ -33,6 +33,7 @@ export * as emailCampaigns from "./emailCampaigns/index.js"; export * from "./emailCampaigns/types/index.js"; export * from "./event/client/requests/index.js"; export * as event from "./event/index.js"; +export * from "./event/types/index.js"; export * from "./externalFeeds/client/requests/index.js"; export * as externalFeeds from "./externalFeeds/index.js"; export * from "./externalFeeds/types/index.js"; diff --git a/src/api/resources/masterAccount/exports.ts b/src/api/resources/masterAccount/exports.ts new file mode 100644 index 0000000..2eeb5e1 --- /dev/null +++ b/src/api/resources/masterAccount/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { MasterAccountClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/notes/exports.ts b/src/api/resources/notes/exports.ts new file mode 100644 index 0000000..13f20ba --- /dev/null +++ b/src/api/resources/notes/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { NotesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/payments/exports.ts b/src/api/resources/payments/exports.ts new file mode 100644 index 0000000..8e9673c --- /dev/null +++ b/src/api/resources/payments/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { PaymentsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/process/client/requests/GetProcessRequest.ts b/src/api/resources/process/client/requests/GetProcessRequest.ts index 8ead15f..3e45723 100644 --- a/src/api/resources/process/client/requests/GetProcessRequest.ts +++ b/src/api/resources/process/client/requests/GetProcessRequest.ts @@ -1,21 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * processId: 1000000 - * } - * - * @example - * { - * processId: 1000000 - * } - * - * @example - * { - * processId: 1000000 - * } - * * @example * { * processId: 1000000 diff --git a/src/api/resources/process/exports.ts b/src/api/resources/process/exports.ts new file mode 100644 index 0000000..0b1e905 --- /dev/null +++ b/src/api/resources/process/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { ProcessClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/program/client/Client.ts b/src/api/resources/program/client/Client.ts index 35e679a..43facb8 100644 --- a/src/api/resources/program/client/Client.ts +++ b/src/api/resources/program/client/Client.ts @@ -584,11 +584,12 @@ export class ProgramClient { request: Brevo.GetParameterSubscriptionInfoRequest, requestOptions?: ProgramClient.RequestOptions, ): Promise> { - const { pid, contactId, params, loyaltySubscriptionId } = request; + const { pid, contactId, params, loyaltySubscriptionId, includeInternal } = request; const _queryParams: Record = { contactId, params, loyaltySubscriptionId, + includeInternal, }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( @@ -651,6 +652,97 @@ export class ProgramClient { ); } + /** + * Delete subscription for a contact + * + * @param {Brevo.DeleteContactSubscriptionRequest} request + * @param {ProgramClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Brevo.BadRequestError} + * @throws {@link Brevo.UnauthorizedError} + * @throws {@link Brevo.ForbiddenError} + * @throws {@link Brevo.NotFoundError} + * @throws {@link Brevo.UnprocessableEntityError} + * @throws {@link Brevo.InternalServerError} + * + * @example + * await client.program.deleteContactSubscription({ + * pid: "pid", + * cid: 1 + * }) + */ + public deleteContactSubscription( + request: Brevo.DeleteContactSubscriptionRequest, + requestOptions?: ProgramClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deleteContactSubscription(request, requestOptions)); + } + + private async __deleteContactSubscription( + request: Brevo.DeleteContactSubscriptionRequest, + requestOptions?: ProgramClient.RequestOptions, + ): Promise> { + const { pid, cid } = request; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.BrevoEnvironment.Default, + `loyalty/config/programs/${core.url.encodePathParam(pid)}/contact/${core.url.encodePathParam(cid)}`, + ), + method: "DELETE", + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { data: undefined, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Brevo.BadRequestError(_response.error.body as unknown, _response.rawResponse); + case 401: + throw new Brevo.UnauthorizedError(_response.error.body as unknown, _response.rawResponse); + case 403: + throw new Brevo.ForbiddenError(_response.error.body as unknown, _response.rawResponse); + case 404: + throw new Brevo.NotFoundError(_response.error.body as unknown, _response.rawResponse); + case 422: + throw new Brevo.UnprocessableEntityError( + _response.error.body as Brevo.ErrorModel, + _response.rawResponse, + ); + case 500: + throw new Brevo.InternalServerError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.BrevoError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "DELETE", + "/loyalty/config/programs/{pid}/contact/{cid}", + ); + } + /** * Publishes loyalty program * diff --git a/src/api/resources/program/client/requests/DeleteContactSubscriptionRequest.ts b/src/api/resources/program/client/requests/DeleteContactSubscriptionRequest.ts new file mode 100644 index 0000000..947fb1a --- /dev/null +++ b/src/api/resources/program/client/requests/DeleteContactSubscriptionRequest.ts @@ -0,0 +1,15 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * { + * pid: "pid", + * cid: 1 + * } + */ +export interface DeleteContactSubscriptionRequest { + /** Loyalty Program ID. A unique identifier for the loyalty program. */ + pid: string; + /** Contact ID. */ + cid: number; +} diff --git a/src/api/resources/program/client/requests/GetParameterSubscriptionInfoRequest.ts b/src/api/resources/program/client/requests/GetParameterSubscriptionInfoRequest.ts index 1ddb913..e45150d 100644 --- a/src/api/resources/program/client/requests/GetParameterSubscriptionInfoRequest.ts +++ b/src/api/resources/program/client/requests/GetParameterSubscriptionInfoRequest.ts @@ -15,4 +15,6 @@ export interface GetParameterSubscriptionInfoRequest { params?: string; /** The loyalty subscription ID to filter by. */ loyaltySubscriptionId?: string; + /** Include balances tied to internal definitions. */ + includeInternal?: boolean; } diff --git a/src/api/resources/program/client/requests/index.ts b/src/api/resources/program/client/requests/index.ts index 1bac46c..277ff1d 100644 --- a/src/api/resources/program/client/requests/index.ts +++ b/src/api/resources/program/client/requests/index.ts @@ -1,5 +1,6 @@ export type { CreateNewLpRequest } from "./CreateNewLpRequest.js"; export type { DeleteContactMembersRequest } from "./DeleteContactMembersRequest.js"; +export type { DeleteContactSubscriptionRequest } from "./DeleteContactSubscriptionRequest.js"; export type { DeleteLoyaltyProgramRequest } from "./DeleteLoyaltyProgramRequest.js"; export type { GetLoyaltyProgramInfoRequest } from "./GetLoyaltyProgramInfoRequest.js"; export type { GetLpListRequest } from "./GetLpListRequest.js"; diff --git a/src/api/resources/program/exports.ts b/src/api/resources/program/exports.ts new file mode 100644 index 0000000..ca64af9 --- /dev/null +++ b/src/api/resources/program/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { ProgramClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/reward/exports.ts b/src/api/resources/reward/exports.ts new file mode 100644 index 0000000..606509a --- /dev/null +++ b/src/api/resources/reward/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { RewardClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/senders/client/requests/CreateSenderRequest.ts b/src/api/resources/senders/client/requests/CreateSenderRequest.ts index 9fc4ae9..d6566d4 100644 --- a/src/api/resources/senders/client/requests/CreateSenderRequest.ts +++ b/src/api/resources/senders/client/requests/CreateSenderRequest.ts @@ -32,18 +32,6 @@ * }], * name: "Newsletter" * } - * - * @example - * { - * email: "support@example.com", - * name: "Support Team" - * } - * - * @example - * { - * email: "support@example.com", - * name: "Support Team" - * } */ export interface CreateSenderRequest { /** diff --git a/src/api/resources/senders/client/requests/GetIpsFromSenderRequest.ts b/src/api/resources/senders/client/requests/GetIpsFromSenderRequest.ts index c90da79..82259b1 100644 --- a/src/api/resources/senders/client/requests/GetIpsFromSenderRequest.ts +++ b/src/api/resources/senders/client/requests/GetIpsFromSenderRequest.ts @@ -1,11 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * senderId: 1000000 - * } - * * @example * { * senderId: 1000000 diff --git a/src/api/resources/senders/client/requests/GetSendersRequest.ts b/src/api/resources/senders/client/requests/GetSendersRequest.ts index 78e6525..2538f7b 100644 --- a/src/api/resources/senders/client/requests/GetSendersRequest.ts +++ b/src/api/resources/senders/client/requests/GetSendersRequest.ts @@ -1,9 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * {} - * * @example * {} */ diff --git a/src/api/resources/senders/exports.ts b/src/api/resources/senders/exports.ts new file mode 100644 index 0000000..5e2aeb8 --- /dev/null +++ b/src/api/resources/senders/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { SendersClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/smsCampaigns/exports.ts b/src/api/resources/smsCampaigns/exports.ts new file mode 100644 index 0000000..470a71e --- /dev/null +++ b/src/api/resources/smsCampaigns/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { SmsCampaignsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/smsTemplates/exports.ts b/src/api/resources/smsTemplates/exports.ts new file mode 100644 index 0000000..0fcb7e5 --- /dev/null +++ b/src/api/resources/smsTemplates/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { SmsTemplatesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/tasks/exports.ts b/src/api/resources/tasks/exports.ts new file mode 100644 index 0000000..f7e668f --- /dev/null +++ b/src/api/resources/tasks/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { TasksClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/tier/client/requests/CreateTierGroupRequest.ts b/src/api/resources/tier/client/requests/CreateTierGroupRequest.ts index 844e4bc..642d878 100644 --- a/src/api/resources/tier/client/requests/CreateTierGroupRequest.ts +++ b/src/api/resources/tier/client/requests/CreateTierGroupRequest.ts @@ -14,6 +14,8 @@ export interface CreateTierGroupRequest { downgradeStrategy?: CreateTierGroupRequest.DowngradeStrategy; /** Name of the tier group */ name: string; + /** Additional metadata for the tier group. */ + meta?: CreateTierGroupRequest.Meta; /** Order of the tiers in the group in ascending order */ tierOrder?: string[]; /** Select real_time to upgrade tier on real time balance updates. Select membership_anniversary to upgrade tier on subscription anniversary. Select tier_anniversary to upgrade tier on tier anniversary. */ @@ -28,6 +30,17 @@ export namespace CreateTierGroupRequest { TierAnniversary: "tier_anniversary", } as const; export type DowngradeStrategy = (typeof DowngradeStrategy)[keyof typeof DowngradeStrategy]; + + /** + * Additional metadata for the tier group. + */ + export interface Meta { + /** Indicates whether the tier group is internal. */ + isInternal?: boolean | undefined; + /** Accepts any additional properties */ + [key: string]: any; + } + /** Select real_time to upgrade tier on real time balance updates. Select membership_anniversary to upgrade tier on subscription anniversary. Select tier_anniversary to upgrade tier on tier anniversary. */ export const UpgradeStrategy = { RealTime: "real_time", diff --git a/src/api/resources/tier/client/requests/UpdateTierGroupRequest.ts b/src/api/resources/tier/client/requests/UpdateTierGroupRequest.ts index db20de7..b989e14 100644 --- a/src/api/resources/tier/client/requests/UpdateTierGroupRequest.ts +++ b/src/api/resources/tier/client/requests/UpdateTierGroupRequest.ts @@ -20,6 +20,8 @@ export interface UpdateTierGroupRequest { downgradeStrategy: UpdateTierGroupRequest.DowngradeStrategy; /** Name of the tier group */ name: string; + /** Additional metadata for the tier group. */ + meta?: UpdateTierGroupRequest.Meta; /** Order of the tiers in the group in ascending order */ tierOrder: string[]; /** Select real_time to upgrade tier on real time balance updates. Select membership_anniversary to upgrade tier on subscription anniversary. Select tier_anniversary to upgrade tier on tier anniversary. */ @@ -34,6 +36,17 @@ export namespace UpdateTierGroupRequest { TierAnniversary: "tier_anniversary", } as const; export type DowngradeStrategy = (typeof DowngradeStrategy)[keyof typeof DowngradeStrategy]; + + /** + * Additional metadata for the tier group. + */ + export interface Meta { + /** Indicates whether the tier group is internal. */ + isInternal?: boolean | undefined; + /** Accepts any additional properties */ + [key: string]: any; + } + /** Select real_time to upgrade tier on real time balance updates. Select membership_anniversary to upgrade tier on subscription anniversary. Select tier_anniversary to upgrade tier on tier anniversary. */ export const UpgradeStrategy = { RealTime: "real_time", diff --git a/src/api/resources/tier/exports.ts b/src/api/resources/tier/exports.ts new file mode 100644 index 0000000..32def3d --- /dev/null +++ b/src/api/resources/tier/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { TierClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/transactionalEmails/client/Client.ts b/src/api/resources/transactionalEmails/client/Client.ts index 45e8cb4..4d7da71 100644 --- a/src/api/resources/transactionalEmails/client/Client.ts +++ b/src/api/resources/transactionalEmails/client/Client.ts @@ -761,13 +761,9 @@ export class TransactionalEmailsClient { } /** - * - * You can get the uuid using either of the following methods: - * + * You can get the uuid using either of the following methods: * Send a GET request to https://api.brevo.com/v3/smtp/emails and pass the message_id in the url. Use your api-key to authenticate the request and you will get your uuid as a response. - * - * The uuid can also be fetched from the transactional logs page in your Brevo account, from the address URL. - * + * The uuid can also be fetched from the transactional logs page in your Brevo account, from the address URL. * * @param {Brevo.GetTransacEmailContentRequest} request * @param {TransactionalEmailsClient.RequestOptions} requestOptions - Request-specific configuration. diff --git a/src/api/resources/transactionalEmails/client/requests/GetScheduledEmailByIdRequest.ts b/src/api/resources/transactionalEmails/client/requests/GetScheduledEmailByIdRequest.ts index 235c13c..1f724df 100644 --- a/src/api/resources/transactionalEmails/client/requests/GetScheduledEmailByIdRequest.ts +++ b/src/api/resources/transactionalEmails/client/requests/GetScheduledEmailByIdRequest.ts @@ -3,13 +3,6 @@ import type * as Brevo from "../../../../index.js"; /** - * @example - * { - * identifier: "4320f270-a4e3-4a2e-b591-edfe30a5e627", - * startDate: "2022-02-02", - * endDate: "2022-03-02" - * } - * * @example * { * identifier: "4320f270-a4e3-4a2e-b591-edfe30a5e627", diff --git a/src/api/resources/transactionalEmails/exports.ts b/src/api/resources/transactionalEmails/exports.ts new file mode 100644 index 0000000..88be674 --- /dev/null +++ b/src/api/resources/transactionalEmails/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { TransactionalEmailsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/transactionalSms/client/Client.ts b/src/api/resources/transactionalSms/client/Client.ts index e945006..3ad1b61 100644 --- a/src/api/resources/transactionalSms/client/Client.ts +++ b/src/api/resources/transactionalSms/client/Client.ts @@ -23,15 +23,9 @@ export class TransactionalSmsClient { } /** - * - * If the user includes stop code in the Transactional SMS, then it will be switched to Marketing SMS automatically and it will be interpreted as a Marketing SMS. To send Transactional SMS as Transactional, it is important not to use stop code. - * - * Note: For adding a stop code, client has to add reply STOP to [STOP_CODE] and the [STOP_CODE] will be replaced with the number. - * - * - * - * Transactional SMS can be sent at any time without time restrictions. However, if a message is categorized as Marketing, it must adhere to specific time restrictions. Messages sent outside of these restricted hours will experience delays and will be processed during allowable times. Specifically, Marketing SMS cannot be processed between 10pm and 8am, on Sundays, and on French public holidays. - * + * If the user includes stop code in the Transactional SMS, then it will be switched to Marketing SMS automatically and it will be interpreted as a Marketing SMS. To send Transactional SMS as Transactional, it is important not to use stop code. + * Note: For adding a stop code, client has to add reply STOP to [STOP_CODE] and the [STOP_CODE] will be replaced with the number. + * Transactional SMS can be sent at any time without time restrictions. However, if a message is categorized as Marketing, it must adhere to specific time restrictions. Messages sent outside of these restricted hours will experience delays and will be processed during allowable times. Specifically, Marketing SMS cannot be processed between 10pm and 8am, on Sundays, and on French public holidays. * * @param {Brevo.SendTransacSms} request * @param {TransactionalSmsClient.RequestOptions} requestOptions - Request-specific configuration. @@ -104,6 +98,8 @@ export class TransactionalSmsClient { } /** + * @deprecated + * * @param {Brevo.SendTransacSms} request * @param {TransactionalSmsClient.RequestOptions} requestOptions - Request-specific configuration. * diff --git a/src/api/resources/transactionalSms/exports.ts b/src/api/resources/transactionalSms/exports.ts new file mode 100644 index 0000000..7605e1e --- /dev/null +++ b/src/api/resources/transactionalSms/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { TransactionalSmsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/transactionalWhatsApp/client/Client.ts b/src/api/resources/transactionalWhatsApp/client/Client.ts index f50da6e..9ef4c07 100644 --- a/src/api/resources/transactionalWhatsApp/client/Client.ts +++ b/src/api/resources/transactionalWhatsApp/client/Client.ts @@ -23,7 +23,8 @@ export class TransactionalWhatsAppClient { } /** - * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account + * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. + * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account * This endpoint is used to send a WhatsApp message.
(**The first message you send using the API must contain a Template ID. You must create a template on WhatsApp on the Brevo platform to fetch the Template ID.**) * * @param {Brevo.SendWhatsappMessageRequest} request diff --git a/src/api/resources/transactionalWhatsApp/exports.ts b/src/api/resources/transactionalWhatsApp/exports.ts new file mode 100644 index 0000000..361c1d0 --- /dev/null +++ b/src/api/resources/transactionalWhatsApp/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { TransactionalWhatsAppClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/user/exports.ts b/src/api/resources/user/exports.ts new file mode 100644 index 0000000..8f9b9cd --- /dev/null +++ b/src/api/resources/user/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { UserClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/webhooks/client/Client.ts b/src/api/resources/webhooks/client/Client.ts index b995b0b..1ce80b5 100644 --- a/src/api/resources/webhooks/client/Client.ts +++ b/src/api/resources/webhooks/client/Client.ts @@ -187,22 +187,16 @@ export class WebhooksClient { } /** - * - * To have it activated please send us a request and we will activate it for your account. + * + * This is an enterprise feature. Contact us to activate it for your account. * * - * Exports webhook event history to CSV format for analysis and reporting. + * Submits a request to export webhook event history as a CSV file. The download link is sent to the `notifyURL` you provide in the request body. * - * Use this to: - * - Generate comprehensive webhook event reports - * - Analyze webhook delivery patterns and success rates - * - Export event data for external analysis tools - * - Create historical reports for compliance and auditing - * - Track webhook performance and reliability metrics - * - * Key information returned: - * - Process ID for tracking export completion - * - CSV file will be delivered to specified webhook URL + * Use this endpoint to: + * - Export webhook event history filtered by date range, event type, or email address + * - Generate reports for compliance, auditing, or performance analysis + * - Track delivery patterns and webhook reliability over time * * @param {Brevo.ExportWebhooksHistoryRequest} request * @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration. diff --git a/src/api/resources/webhooks/client/requests/CreateWebhookRequest.ts b/src/api/resources/webhooks/client/requests/CreateWebhookRequest.ts index cb52650..0c734aa 100644 --- a/src/api/resources/webhooks/client/requests/CreateWebhookRequest.ts +++ b/src/api/resources/webhooks/client/requests/CreateWebhookRequest.ts @@ -37,6 +37,7 @@ export interface CreateWebhookRequest { * type **Marketing** channel **SMS** #### * `sent`,`delivered`,`softBounce`,`hardBounce`,`unsubscribe`,`reply`, * `subscribe`,`skip` + * #### `reply` */ events: CreateWebhookRequest.Events.Item[]; /** Custom headers to be send with webhooks */ @@ -85,6 +86,7 @@ export namespace CreateWebhookRequest { ContactUpdated: "contactUpdated", ContactDeleted: "contactDeleted", InboundEmailProcessed: "inboundEmailProcessed", + Reply: "reply", } as const; export type Item = (typeof Item)[keyof typeof Item]; } diff --git a/src/api/resources/webhooks/client/requests/UpdateWebhookRequest.ts b/src/api/resources/webhooks/client/requests/UpdateWebhookRequest.ts index 49745bb..d736e28 100644 --- a/src/api/resources/webhooks/client/requests/UpdateWebhookRequest.ts +++ b/src/api/resources/webhooks/client/requests/UpdateWebhookRequest.ts @@ -26,6 +26,7 @@ export interface UpdateWebhookRequest { * #### `spam`, `opened`, `click`, `hardBounce`, `softBounce`, * `unsubscribed`, `listAddition` & `delivered` - Possible values * for **Inbound** type webhook: #### `inboundEmailProcessed` + * #### `reply` */ events?: UpdateWebhookRequest.Events.Item[]; /** Custom headers to be send with webhooks */ @@ -66,6 +67,7 @@ export namespace UpdateWebhookRequest { ContactUpdated: "contactUpdated", ContactDeleted: "contactDeleted", InboundEmailProcessed: "inboundEmailProcessed", + Reply: "reply", } as const; export type Item = (typeof Item)[keyof typeof Item]; } diff --git a/src/api/resources/webhooks/exports.ts b/src/api/resources/webhooks/exports.ts new file mode 100644 index 0000000..7773e64 --- /dev/null +++ b/src/api/resources/webhooks/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { WebhooksClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/whatsAppCampaigns/client/Client.ts b/src/api/resources/whatsAppCampaigns/client/Client.ts index b9becb7..aa9e3b8 100644 --- a/src/api/resources/whatsAppCampaigns/client/Client.ts +++ b/src/api/resources/whatsAppCampaigns/client/Client.ts @@ -93,19 +93,11 @@ export class WhatsAppCampaignsClient { } /** - * - * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. - * - * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account - * - * - * - * This API requires the List and Segment ids as recipients in Body params. You can use the below Contact endpoints to get the required information. - * + * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. + * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account + * This API requires the List and Segment ids as recipients in Body params.You can use the below Contact endpoints to get the required information. * [Get all the Lists](https://developers.brevo.com/reference/getlists-1) - * - * [Get all the Segments](https://developers.brevo.com/reference/getsegments) - * + * [Get all the Segments](https://developers.brevo.com/reference/getsegments) * * @param {Brevo.CreateWhatsAppCampaignRequest} request * @param {WhatsAppCampaignsClient.RequestOptions} requestOptions - Request-specific configuration. @@ -177,11 +169,8 @@ export class WhatsAppCampaignsClient { } /** - * - * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. - * - * [Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account - * + * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. + * [Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account * * @param {WhatsAppCampaignsClient.RequestOptions} requestOptions - Request-specific configuration. * @@ -242,11 +231,8 @@ export class WhatsAppCampaignsClient { } /** - * - * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. - * - * [Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account - * + * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. + * [Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account * * @param {Brevo.CreateWhatsAppTemplateRequest} request * @param {WhatsAppCampaignsClient.RequestOptions} requestOptions - Request-specific configuration. @@ -394,11 +380,8 @@ export class WhatsAppCampaignsClient { } /** - * - * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. - * - * [Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account - * + * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. + * [Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account * * @param {Brevo.SendWhatsAppTemplateApprovalRequest} request * @param {WhatsAppCampaignsClient.RequestOptions} requestOptions - Request-specific configuration. @@ -470,11 +453,11 @@ export class WhatsAppCampaignsClient { } /** - * - * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. - * - * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account - * + * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. + * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account + * This API requires the List and Segment ids as recipients in Body params.You can use the below Contact endpoints to get the required information. + * [Get all the Lists](https://developers.brevo.com/reference/getlists-1) + * [Get all the Segments](https://developers.brevo.com/reference/getsegments) * * @param {Brevo.GetWhatsAppCampaignRequest} request * @param {WhatsAppCampaignsClient.RequestOptions} requestOptions - Request-specific configuration. @@ -549,19 +532,11 @@ export class WhatsAppCampaignsClient { } /** - * - * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. - * - * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account - * - * - * - * This API requires the List and Segment ids as recipients in Body params. You can use the below Contact endpoints to get the required information. - * + * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. + * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account + * This API requires the List and Segment ids as recipients in Body params.You can use the below Contact endpoints to get the required information. * [Get all the Lists](https://developers.brevo.com/reference/getlists-1) - * - * [Get all the Segments](https://developers.brevo.com/reference/getsegments) - * + * [Get all the Segments](https://developers.brevo.com/reference/getsegments) * * @param {Brevo.UpdateWhatsAppCampaignRequest} request * @param {WhatsAppCampaignsClient.RequestOptions} requestOptions - Request-specific configuration. diff --git a/src/api/resources/whatsAppCampaigns/exports.ts b/src/api/resources/whatsAppCampaigns/exports.ts new file mode 100644 index 0000000..35b77f8 --- /dev/null +++ b/src/api/resources/whatsAppCampaigns/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { WhatsAppCampaignsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/types/BatchAcceptedResponse.ts b/src/api/types/BatchAcceptedResponse.ts new file mode 100644 index 0000000..6a5bfd6 --- /dev/null +++ b/src/api/types/BatchAcceptedResponse.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * Response returned when all events in the batch are accepted for async processing + */ +export interface BatchAcceptedResponse { + /** Confirmation message indicating the batch was accepted */ + message: string; + /** Number of events queued for processing */ + count: number; +} diff --git a/src/api/types/BatchEventsResponse.ts b/src/api/types/BatchEventsResponse.ts new file mode 100644 index 0000000..0b745e8 --- /dev/null +++ b/src/api/types/BatchEventsResponse.ts @@ -0,0 +1,30 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * Response returned when a batch of events is processed + */ +export interface BatchEventsResponse { + /** Status of the batch request */ + status: string; + /** Total number of events submitted in the batch */ + total_events: number; + /** Number of events that were successfully processed */ + successful_events: number; + /** Number of events that failed to be processed */ + failed_events: number; + /** List of errors for the failed events */ + errors: BatchEventsResponse.Errors.Item[]; +} + +export namespace BatchEventsResponse { + export type Errors = Errors.Item[]; + + export namespace Errors { + export interface Item { + /** Index positions (0-based) of the events that caused the error */ + eventIndex?: number[] | undefined; + /** Description of the error */ + message?: string | undefined; + } + } +} diff --git a/src/api/types/GetCampaignStats.ts b/src/api/types/GetCampaignStats.ts index 618a403..76f44c9 100644 --- a/src/api/types/GetCampaignStats.ts +++ b/src/api/types/GetCampaignStats.ts @@ -2,7 +2,7 @@ export interface GetCampaignStats { /** Numbers of times your email has been opened automatically through Apple MPP. */ - appleMppOpens: number; + appleMppOpens: number | null; /** Number of total clicks for the campaign */ clickers: number; /** Number of complaints (Spam reports) for the campaign */ @@ -18,7 +18,7 @@ export interface GetCampaignStats { /** List Id of email campaign (only in case of get email campaign(s)(not for global stats)) */ listId?: number | undefined; /** Percentage of recipients who open the email out of your total number of recipients. Depending on your Campaign settings, they may include Apple MPP opens. */ - opensRate: number; + opensRate: number | null; /** Total number of non-delivered campaigns for a particular campaign id. */ returnBounce?: number | undefined; /** Number of sent emails for the campaign */ diff --git a/src/api/types/GetEventsList.ts b/src/api/types/GetEventsList.ts new file mode 100644 index 0000000..5388d5d --- /dev/null +++ b/src/api/types/GetEventsList.ts @@ -0,0 +1,36 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * Response containing a list of events and the total count for pagination + */ +export interface GetEventsList { + /** List of matching events ordered by event_date descending */ + events?: GetEventsList.Events.Item[] | undefined; + /** Total count of events matching the filters (use for pagination) */ + count: number; +} + +export namespace GetEventsList { + export type Events = Events.Item[]; + + export namespace Events { + export interface Item { + /** Contact ID associated with the event */ + contact_id?: number | undefined; + /** Date and time of the event */ + event_date?: string | undefined; + /** Name of the event */ + event_name?: string | undefined; + /** Filter ID of the event */ + event_filter_id?: string | undefined; + /** Source of the event */ + source?: string | undefined; + /** Object type associated with the event */ + object_type?: string | undefined; + /** Event-level custom properties */ + event_properties?: Record | undefined; + /** Contact-level properties at time of event */ + contact_properties?: Record | undefined; + } + } +} diff --git a/src/api/types/GetExtendedCampaignOverview.ts b/src/api/types/GetExtendedCampaignOverview.ts index 0b4c7e7..114e7e6 100644 --- a/src/api/types/GetExtendedCampaignOverview.ts +++ b/src/api/types/GetExtendedCampaignOverview.ts @@ -1,6 +1,8 @@ // This file was auto-generated by Fern from our API Definition. export interface GetExtendedCampaignOverview { + /** Url of the attachment file. Only available if the campaign has an attachment. */ + attachmentFile?: string | undefined; /** Status of A/B Test for the campaign. abTesting = false means it is disabled, & abTesting = true means it is enabled. */ abTesting?: boolean | undefined; /** ID of the campaign */ @@ -56,6 +58,8 @@ export interface GetExtendedCampaignOverview { shareLink?: string | undefined; /** Tag of the campaign */ tag?: string | undefined; + /** List of tags of the campaign */ + tags?: string[] | undefined; /** Retrieved the status of test email sending. (true=Test email has been sent false=Test email has not been sent) */ testSent: boolean; /** Customisation of the "to" field of the campaign */ @@ -78,6 +82,9 @@ export namespace GetExtendedCampaignOverview { Queued: "queued", Suspended: "suspended", InProcess: "in_process", + InReview: "in_review", + Cancelling: "cancelling", + Cancelled: "cancelled", } as const; export type Status = (typeof Status)[keyof typeof Status]; /** Type of campaign */ diff --git a/src/api/types/GetProductDetails.ts b/src/api/types/GetProductDetails.ts index 464093b..ae430f8 100644 --- a/src/api/types/GetProductDetails.ts +++ b/src/api/types/GetProductDetails.ts @@ -1,10 +1,14 @@ // This file was auto-generated by Fern from our API Definition. export interface GetProductDetails { + /** Brand of the product */ + brand?: string | undefined; /** Category ID-s of the product */ categories?: string[] | undefined; /** Creation UTC date-time of the product (YYYY-MM-DDTHH:mm:ss.SSSZ) */ createdAt: string; + /** Description of the product */ + description?: string | undefined; /** Product ID for which you requested the details */ id: string; /** Absolute URL to the cover image of the product */ diff --git a/src/api/types/InternalServerErrorBody.ts b/src/api/types/InternalServerErrorBody.ts new file mode 100644 index 0000000..628e74b --- /dev/null +++ b/src/api/types/InternalServerErrorBody.ts @@ -0,0 +1,51 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface InternalServerErrorBody { + /** Error code displayed in case of a failure */ + code: InternalServerErrorBody.Code; + /** Readable message associated to the failure */ + message: string; +} + +export namespace InternalServerErrorBody { + /** Error code displayed in case of a failure */ + export const Code = { + InvalidParameter: "invalid_parameter", + MissingParameter: "missing_parameter", + OutOfRange: "out_of_range", + CampaignProcessing: "campaign_processing", + CampaignSent: "campaign_sent", + DocumentNotFound: "document_not_found", + NotEnoughCredits: "not_enough_credits", + PermissionDenied: "permission_denied", + DuplicateParameter: "duplicate_parameter", + DuplicateRequest: "duplicate_request", + MethodNotAllowed: "method_not_allowed", + Unauthorized: "unauthorized", + AccountUnderValidation: "account_under_validation", + NotAcceptable: "not_acceptable", + BadRequest: "bad_request", + UnprocessableEntity: "unprocessable_entity", + DomainDoesNotExist: "Domain does not exist", + ContactEmailNotFound: "Contact email not found", + AttributeNotFound: "Attribute not found", + CategoryIdNotFound: "Category id not found", + InvalidParametersPassed: "Invalid parameters passed", + RecordSForIdentifierNotFound: "Record(s) for identifier not found", + ReturnedWhenQueryParamsAreInvalid: "Returned when query params are invalid", + ReturnedWhenInvalidDataPosted: "Returned when invalid data posted", + FeedNotFound: "Feed not found", + CampaignIdNotFound: "Campaign ID not found", + ApiKeyNotFound: "api-key not found", + DmarcPolicyRequiresDomainAuthentication: "DMARC policy requires domain authentication", + DnsRecordsNotProperlyConfigured: "DNS records not properly configured", + InvalidOtpCodeProvided: "Invalid OTP code provided", + OtpCodeHasExpired: "OTP code has expired", + DomainAlreadyExistsInYourAccount: "Domain already exists in your account", + TheSumOfAllIpWeightsMustEqual100: "The sum of all IP weights must equal 100", + AuthenticationFailed: "Authentication failed", + InsufficientCredits: "Insufficient credits", + RequestAlreadyProcessed: "Request already processed", + } as const; + export type Code = (typeof Code)[keyof typeof Code]; +} diff --git a/src/api/types/Order.ts b/src/api/types/Order.ts index 1753e35..34a51e7 100644 --- a/src/api/types/Order.ts +++ b/src/api/types/Order.ts @@ -76,10 +76,20 @@ export namespace Order { price: number; /** ID of the product. */ productId: string; - /** How many pieces of the product the visitor has added to the cart. */ - quantity: number; /** Product ID of the red color shirts. */ variantId?: string | undefined; + /** + * **Required if quantityFloat is empty.** + * + * Number of product units added to the cart (whole numbers only, e.g., 10) + */ + quantity?: number | undefined; + /** + * **Required if quantity is empty.** + * + * Number of product units added to the cart(supports decimals, e.g., 20.52) + */ + quantityFloat?: number | undefined; } } } diff --git a/src/api/types/UpdateCampaignStatus.ts b/src/api/types/UpdateCampaignStatus.ts index a978877..f3ef1d3 100644 --- a/src/api/types/UpdateCampaignStatus.ts +++ b/src/api/types/UpdateCampaignStatus.ts @@ -18,6 +18,7 @@ export namespace UpdateCampaignStatus { Queued: "queued", Replicate: "replicate", ReplicateTemplate: "replicateTemplate", + Cancel: "cancel", Draft: "draft", } as const; export type Status = (typeof Status)[keyof typeof Status]; diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 28b4c8d..94dbe93 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -4,6 +4,8 @@ export * from "./AbTestVersionStats.js"; export * from "./BadRequestErrorBody.js"; export * from "./BalanceDefinition.js"; export * from "./BalanceLimit.js"; +export * from "./BatchAcceptedResponse.js"; +export * from "./BatchEventsResponse.js"; export * from "./Cart.js"; export * from "./Company.js"; export * from "./Configuration.js"; @@ -22,6 +24,7 @@ export * from "./GetContactDetails.js"; export * from "./GetContacts.js"; export * from "./GetCouponCollection.js"; export * from "./GetDeviceBrowserStats.js"; +export * from "./GetEventsList.js"; export * from "./GetExtendedCampaignOverview.js"; export * from "./GetExtendedCampaignStats.js"; export * from "./GetFolder.js"; @@ -32,6 +35,7 @@ export * from "./GetSmsCampaignStats.js"; export * from "./GetSmtpTemplateOverview.js"; export * from "./GetSsoToken.js"; export * from "./GetWebhook.js"; +export * from "./InternalServerErrorBody.js"; export * from "./Inviteuser.js"; export * from "./LoyaltyProgram.js"; export * from "./NodeResponse.js"; diff --git a/src/core/fetcher/BinaryResponse.ts b/src/core/fetcher/BinaryResponse.ts index bca7f4c..b9e40fb 100644 --- a/src/core/fetcher/BinaryResponse.ts +++ b/src/core/fetcher/BinaryResponse.ts @@ -14,7 +14,7 @@ export type BinaryResponse = { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) * Some versions of the Fetch API may not support this method. */ - bytes?(): ReturnType; + bytes?(): Promise; }; export function getBinaryResponse(response: Response): BinaryResponse { diff --git a/src/core/fetcher/Fetcher.ts b/src/core/fetcher/Fetcher.ts index 5e5058a..764d2e1 100644 --- a/src/core/fetcher/Fetcher.ts +++ b/src/core/fetcher/Fetcher.ts @@ -282,6 +282,7 @@ export async function fetcherImpl(args: Fetcher.Args): Promise; + /** Abort signal for this request. */ + abortSignal?: AbortSignal; + } + + /** + * SDK client configuration used by the passthrough fetch method. + */ + export interface ClientOptions { + /** The base URL or environment for the client. */ + environment?: Supplier; + /** Override the base URL. */ + baseUrl?: Supplier; + /** Default headers to include in requests. */ + headers?: Record; + /** Default maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** Default number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A custom fetch function. */ + fetch?: typeof fetch; + /** Logging configuration. */ + logging?: LogConfig | Logger; + /** A function that returns auth headers. */ + getAuthHeaders?: () => Promise>; + } +} + +/** + * Makes a passthrough HTTP request using the SDK's configuration (auth, retry, logging, etc.) + * while mimicking the standard `fetch` API. + * + * @param input - The URL, path, or Request object. If a relative path, it will be resolved against the configured base URL. + * @param init - Standard RequestInit options (method, headers, body, signal, etc.) + * @param clientOptions - SDK client options (auth, default headers, logging, etc.) + * @param requestOptions - Per-request overrides (timeout, retries, extra headers, abort signal). + * @returns A standard Response object. + */ +export async function makePassthroughRequest( + input: Request | string | URL, + init: RequestInit | undefined, + clientOptions: PassthroughRequest.ClientOptions, + requestOptions?: PassthroughRequest.RequestOptions, +): Promise { + const logger = createLogger(clientOptions.logging); + + // Extract URL and default init properties from Request object if provided + let url: string; + let effectiveInit: RequestInit | undefined = init; + if (input instanceof Request) { + url = input.url; + // If no explicit init provided, extract properties from the Request object + if (init == null) { + effectiveInit = { + method: input.method, + headers: Object.fromEntries(input.headers.entries()), + body: input.body, + signal: input.signal, + credentials: input.credentials, + cache: input.cache as RequestCache, + redirect: input.redirect, + referrer: input.referrer, + integrity: input.integrity, + mode: input.mode, + }; + } + } else { + url = input instanceof URL ? input.toString() : input; + } + + // Resolve the base URL + const baseUrl = + (clientOptions.baseUrl != null ? await Supplier.get(clientOptions.baseUrl) : undefined) ?? + (clientOptions.environment != null ? await Supplier.get(clientOptions.environment) : undefined); + + // Determine the full URL + let fullUrl: string; + if (url.startsWith("http://") || url.startsWith("https://")) { + fullUrl = url; + } else if (baseUrl != null) { + fullUrl = join(baseUrl, url); + } else { + fullUrl = url; + } + + // Merge headers: SDK default headers -> auth headers -> user-provided headers + const mergedHeaders: Record = {}; + + // Apply SDK default headers (resolve suppliers) + if (clientOptions.headers != null) { + for (const [key, value] of Object.entries(clientOptions.headers)) { + const resolved = await EndpointSupplier.get(value, { endpointMetadata: {} }); + if (resolved != null) { + mergedHeaders[key.toLowerCase()] = `${resolved}`; + } + } + } + + // Apply auth headers + if (clientOptions.getAuthHeaders != null) { + const authHeaders = await clientOptions.getAuthHeaders(); + for (const [key, value] of Object.entries(authHeaders)) { + mergedHeaders[key.toLowerCase()] = value; + } + } + + // Apply user-provided headers from init + if (effectiveInit?.headers != null) { + const initHeaders = + effectiveInit.headers instanceof Headers + ? Object.fromEntries(effectiveInit.headers.entries()) + : Array.isArray(effectiveInit.headers) + ? Object.fromEntries(effectiveInit.headers) + : effectiveInit.headers; + for (const [key, value] of Object.entries(initHeaders)) { + if (value != null) { + mergedHeaders[key.toLowerCase()] = value; + } + } + } + + // Apply per-request option headers (highest priority) + if (requestOptions?.headers != null) { + for (const [key, value] of Object.entries(requestOptions.headers)) { + mergedHeaders[key.toLowerCase()] = value; + } + } + + const method = effectiveInit?.method ?? "GET"; + const body = effectiveInit?.body; + const timeoutInSeconds = requestOptions?.timeoutInSeconds ?? clientOptions.timeoutInSeconds; + const timeoutMs = timeoutInSeconds != null ? timeoutInSeconds * 1000 : undefined; + const maxRetries = requestOptions?.maxRetries ?? clientOptions.maxRetries; + const abortSignal = requestOptions?.abortSignal ?? effectiveInit?.signal ?? undefined; + const fetchFn = clientOptions.fetch ?? (await getFetchFn()); + + if (logger.isDebug()) { + logger.debug("Making passthrough HTTP request", { + method, + url: fullUrl, + hasBody: body != null, + }); + } + + const response = await requestWithRetries( + async () => + makeRequest( + fetchFn, + fullUrl, + method, + mergedHeaders, + body ?? undefined, + timeoutMs, + abortSignal, + effectiveInit?.credentials === "include", + undefined, // duplex + false, // disableCache + ), + maxRetries, + ); + + if (logger.isDebug()) { + logger.debug("Passthrough HTTP request completed", { + method, + url: fullUrl, + statusCode: response.status, + }); + } + + return response; +} diff --git a/src/core/fetcher/makeRequest.ts b/src/core/fetcher/makeRequest.ts index 921565e..360a86d 100644 --- a/src/core/fetcher/makeRequest.ts +++ b/src/core/fetcher/makeRequest.ts @@ -1,5 +1,31 @@ import { anySignal, getTimeoutSignal } from "./signals.js"; +/** + * Cached result of checking whether the current runtime supports + * the `cache` option in `Request`. Some runtimes (e.g. Cloudflare Workers) + * throw a TypeError when this option is used. + */ +let _cacheNoStoreSupported: boolean | undefined; +export function isCacheNoStoreSupported(): boolean { + if (_cacheNoStoreSupported != null) { + return _cacheNoStoreSupported; + } + try { + new Request("http://localhost", { cache: "no-store" }); + _cacheNoStoreSupported = true; + } catch { + _cacheNoStoreSupported = false; + } + return _cacheNoStoreSupported; +} + +/** + * Reset the cached result of `isCacheNoStoreSupported`. Exposed for testing only. + */ +export function resetCacheNoStoreSupported(): void { + _cacheNoStoreSupported = undefined; +} + export const makeRequest = async ( fetchFn: (url: string, init: RequestInit) => Promise, url: string, @@ -10,6 +36,7 @@ export const makeRequest = async ( abortSignal?: AbortSignal, withCredentials?: boolean, duplex?: "half", + disableCache?: boolean, ): Promise => { const signals: AbortSignal[] = []; @@ -32,6 +59,7 @@ export const makeRequest = async ( credentials: withCredentials ? "include" : undefined, // @ts-ignore duplex, + ...(disableCache && isCacheNoStoreSupported() ? { cache: "no-store" as RequestCache } : {}), }); if (timeoutAbortId != null) { diff --git a/src/core/runtime/runtime.ts b/src/core/runtime/runtime.ts index 56ebbb8..e6e66b2 100644 --- a/src/core/runtime/runtime.ts +++ b/src/core/runtime/runtime.ts @@ -113,18 +113,18 @@ function evaluateRuntime(): Runtime { /** * A constant that indicates whether the environment the code is running is Node.JS. + * + * We assign `process` to a local variable first to avoid being flagged by + * bundlers that perform static analysis on `process.versions` (e.g. Next.js + * Edge Runtime warns about Node.js APIs even when they are guarded). */ - const isNode = - typeof process !== "undefined" && - "version" in process && - !!process.version && - "versions" in process && - !!process.versions?.node; + const _process = typeof process !== "undefined" ? process : undefined; + const isNode = typeof _process !== "undefined" && typeof _process.versions?.node === "string"; if (isNode) { return { type: "node", - version: process.versions.node, - parsedVersion: Number(process.versions.node.split(".")[0]), + version: _process.versions.node, + parsedVersion: Number(_process.versions.node.split(".")[0]), }; } diff --git a/src/version.ts b/src/version.ts index 3185aec..689c8fc 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const SDK_VERSION = "5.0.2"; +export const SDK_VERSION = "5.0.3"; diff --git a/tests/mock-server/MockServerPool.ts b/tests/mock-server/MockServerPool.ts index e1a90f7..d7d891a 100644 --- a/tests/mock-server/MockServerPool.ts +++ b/tests/mock-server/MockServerPool.ts @@ -103,4 +103,4 @@ class MockServerPool { } } -export const mockServerPool = new MockServerPool(); +export const mockServerPool: MockServerPool = new MockServerPool(); diff --git a/tests/mock-server/mockEndpointBuilder.ts b/tests/mock-server/mockEndpointBuilder.ts index 78985e7..3e8540a 100644 --- a/tests/mock-server/mockEndpointBuilder.ts +++ b/tests/mock-server/mockEndpointBuilder.ts @@ -2,7 +2,7 @@ import { type DefaultBodyType, type HttpHandler, HttpResponse, type HttpResponse import { url } from "../../src/core"; import { toJson } from "../../src/core/json"; -import { withFormUrlEncoded } from "./withFormUrlEncoded"; +import { type WithFormUrlEncodedOptions, withFormUrlEncoded } from "./withFormUrlEncoded"; import { withHeaders } from "./withHeaders"; import { type WithJsonOptions, withJson } from "./withJson"; @@ -27,7 +27,7 @@ interface RequestHeadersStage extends RequestBodyStage, ResponseStage { interface RequestBodyStage extends ResponseStage { jsonBody(body: unknown, options?: WithJsonOptions): ResponseStage; - formUrlEncodedBody(body: unknown): ResponseStage; + formUrlEncodedBody(body: unknown, options?: WithFormUrlEncodedOptions): ResponseStage; } interface ResponseStage { @@ -44,6 +44,7 @@ interface ResponseHeaderStage extends ResponseBodyStage, BuildStage { interface ResponseBodyStage { jsonBody(body: unknown): BuildStage; + sseBody(body: string): BuildStage; } interface BuildStage { @@ -137,13 +138,13 @@ class RequestBuilder implements MethodStage, RequestHeadersStage, RequestBodySta return this; } - formUrlEncodedBody(body: unknown): ResponseStage { + formUrlEncodedBody(body: unknown, options?: WithFormUrlEncodedOptions): ResponseStage { if (body === undefined) { throw new Error( "Undefined is not valid for form-urlencoded. Do not call formUrlEncodedBody if you want an empty body.", ); } - this.predicates.push((resolver) => withFormUrlEncoded(body, resolver)); + this.predicates.push((resolver) => withFormUrlEncoded(body, resolver, options)); return this; } @@ -201,6 +202,12 @@ class ResponseBuilder implements ResponseStatusStage, ResponseHeaderStage, Respo return this; } + public sseBody(body: string): BuildStage { + this.responseHeaders["Content-Type"] = "text/event-stream"; + this.responseBody = body; + return this; + } + public build(): HttpHandler { const responseResolver: HttpResponseResolver = () => { const response = new HttpResponse(this.responseBody, { diff --git a/tests/mock-server/withFormUrlEncoded.ts b/tests/mock-server/withFormUrlEncoded.ts index e250cb3..2b23448 100644 --- a/tests/mock-server/withFormUrlEncoded.ts +++ b/tests/mock-server/withFormUrlEncoded.ts @@ -2,12 +2,26 @@ import { type HttpResponseResolver, passthrough } from "msw"; import { toJson } from "../../src/core/json"; +export interface WithFormUrlEncodedOptions { + /** + * List of field names to ignore when comparing request bodies. + * This is useful for pagination cursor fields that change between requests. + */ + ignoredFields?: string[]; +} + /** * Creates a request matcher that validates if the request form-urlencoded body exactly matches the expected object * @param expectedBody - The exact body object to match against * @param resolver - Response resolver to execute if body matches + * @param options - Optional configuration including fields to ignore */ -export function withFormUrlEncoded(expectedBody: unknown, resolver: HttpResponseResolver): HttpResponseResolver { +export function withFormUrlEncoded( + expectedBody: unknown, + resolver: HttpResponseResolver, + options?: WithFormUrlEncodedOptions, +): HttpResponseResolver { + const ignoredFields = options?.ignoredFields ?? []; return async (args) => { const { request } = args; @@ -41,7 +55,8 @@ export function withFormUrlEncoded(expectedBody: unknown, resolver: HttpResponse } const mismatches = findMismatches(actualBody, expectedBody); - if (Object.keys(mismatches).length > 0) { + const filteredMismatches = Object.keys(mismatches).filter((key) => !ignoredFields.includes(key)); + if (filteredMismatches.length > 0) { console.error("Form-urlencoded body mismatch:", toJson(mismatches, undefined, 2)); return passthrough(); } diff --git a/tests/tsconfig.json b/tests/tsconfig.json index a477df4..ac39744 100644 --- a/tests/tsconfig.json +++ b/tests/tsconfig.json @@ -3,7 +3,6 @@ "compilerOptions": { "outDir": null, "rootDir": "..", - "baseUrl": "..", "types": ["vitest/globals"] }, "include": ["../src", "../tests"], diff --git a/tests/unit/fetcher/makePassthroughRequest.test.ts b/tests/unit/fetcher/makePassthroughRequest.test.ts new file mode 100644 index 0000000..1850d1f --- /dev/null +++ b/tests/unit/fetcher/makePassthroughRequest.test.ts @@ -0,0 +1,398 @@ +import type { Mock } from "vitest"; +import { makePassthroughRequest } from "../../../src/core/fetcher/makePassthroughRequest"; + +describe("makePassthroughRequest", () => { + let mockFetch: Mock; + + beforeEach(() => { + mockFetch = vi.fn(); + mockFetch.mockResolvedValue(new Response(JSON.stringify({ ok: true }), { status: 200 })); + }); + + describe("URL resolution", () => { + it("should use absolute URL directly", async () => { + await makePassthroughRequest("https://api.example.com/v1/users", undefined, { + fetch: mockFetch, + }); + const [calledUrl] = mockFetch.mock.calls[0]; + expect(calledUrl).toBe("https://api.example.com/v1/users"); + }); + + it("should resolve relative path against baseUrl", async () => { + await makePassthroughRequest("/v1/users", undefined, { + baseUrl: "https://api.example.com", + fetch: mockFetch, + }); + const [calledUrl] = mockFetch.mock.calls[0]; + expect(calledUrl).toBe("https://api.example.com/v1/users"); + }); + + it("should resolve relative path against environment when baseUrl is not set", async () => { + await makePassthroughRequest("/v1/users", undefined, { + environment: "https://env.example.com", + fetch: mockFetch, + }); + const [calledUrl] = mockFetch.mock.calls[0]; + expect(calledUrl).toBe("https://env.example.com/v1/users"); + }); + + it("should prefer baseUrl over environment", async () => { + await makePassthroughRequest("/v1/users", undefined, { + baseUrl: "https://base.example.com", + environment: "https://env.example.com", + fetch: mockFetch, + }); + const [calledUrl] = mockFetch.mock.calls[0]; + expect(calledUrl).toBe("https://base.example.com/v1/users"); + }); + + it("should pass relative URL through as-is when no baseUrl or environment", async () => { + await makePassthroughRequest("/v1/users", undefined, { + fetch: mockFetch, + }); + const [calledUrl] = mockFetch.mock.calls[0]; + expect(calledUrl).toBe("/v1/users"); + }); + + it("should resolve baseUrl supplier", async () => { + await makePassthroughRequest("/v1/users", undefined, { + baseUrl: () => "https://dynamic.example.com", + fetch: mockFetch, + }); + const [calledUrl] = mockFetch.mock.calls[0]; + expect(calledUrl).toBe("https://dynamic.example.com/v1/users"); + }); + + it("should ignore absolute URL even when baseUrl is set", async () => { + await makePassthroughRequest("https://other.example.com/path", undefined, { + baseUrl: "https://base.example.com", + fetch: mockFetch, + }); + const [calledUrl] = mockFetch.mock.calls[0]; + expect(calledUrl).toBe("https://other.example.com/path"); + }); + + it("should accept a URL object", async () => { + await makePassthroughRequest(new URL("https://api.example.com/v1/users"), undefined, { + fetch: mockFetch, + }); + const [calledUrl] = mockFetch.mock.calls[0]; + expect(calledUrl).toBe("https://api.example.com/v1/users"); + }); + }); + + describe("header merge order", () => { + it("should merge headers in correct priority: SDK defaults < auth < init < requestOptions", async () => { + await makePassthroughRequest( + "https://api.example.com", + { + headers: { "X-Custom": "from-init", Authorization: "from-init" }, + }, + { + headers: { + "X-Custom": "from-sdk", + "X-SDK-Only": "sdk-value", + Authorization: "from-sdk", + }, + getAuthHeaders: async () => ({ + Authorization: "Bearer auth-token", + "X-Auth-Only": "auth-value", + }), + fetch: mockFetch, + }, + { + headers: { Authorization: "from-request-options" }, + }, + ); + const [, calledOptions] = mockFetch.mock.calls[0]; + const headers = calledOptions.headers; + + // requestOptions.headers wins for Authorization (highest priority) + expect(headers.authorization).toBe("from-request-options"); + // init.headers wins over SDK defaults for X-Custom + expect(headers["x-custom"]).toBe("from-init"); + // SDK-only header is preserved + expect(headers["x-sdk-only"]).toBe("sdk-value"); + // Auth-only header is preserved + expect(headers["x-auth-only"]).toBe("auth-value"); + }); + + it("should lowercase all header keys", async () => { + await makePassthroughRequest( + "https://api.example.com", + { + headers: { "Content-Type": "application/json" }, + }, + { + headers: { "X-Fern-Language": "JavaScript" }, + fetch: mockFetch, + }, + ); + const [, calledOptions] = mockFetch.mock.calls[0]; + const headers = calledOptions.headers; + expect(headers["content-type"]).toBe("application/json"); + expect(headers["x-fern-language"]).toBe("JavaScript"); + expect(headers["Content-Type"]).toBeUndefined(); + expect(headers["X-Fern-Language"]).toBeUndefined(); + }); + + it("should handle Headers object in init", async () => { + const initHeaders = new Headers(); + initHeaders.set("X-From-Headers-Object", "value"); + await makePassthroughRequest("https://api.example.com", { headers: initHeaders }, { fetch: mockFetch }); + const [, calledOptions] = mockFetch.mock.calls[0]; + expect(calledOptions.headers["x-from-headers-object"]).toBe("value"); + }); + + it("should handle array-style headers in init", async () => { + await makePassthroughRequest( + "https://api.example.com", + { headers: [["X-Array-Header", "array-value"]] }, + { fetch: mockFetch }, + ); + const [, calledOptions] = mockFetch.mock.calls[0]; + expect(calledOptions.headers["x-array-header"]).toBe("array-value"); + }); + + it("should skip null SDK default header values", async () => { + await makePassthroughRequest("https://api.example.com", undefined, { + headers: { "X-Present": "value", "X-Null": null }, + fetch: mockFetch, + }); + const [, calledOptions] = mockFetch.mock.calls[0]; + expect(calledOptions.headers["x-present"]).toBe("value"); + expect(calledOptions.headers["x-null"]).toBeUndefined(); + }); + }); + + describe("auth headers", () => { + it("should include auth headers when getAuthHeaders is provided", async () => { + await makePassthroughRequest("https://api.example.com", undefined, { + getAuthHeaders: async () => ({ Authorization: "Bearer my-token" }), + fetch: mockFetch, + }); + const [, calledOptions] = mockFetch.mock.calls[0]; + expect(calledOptions.headers.authorization).toBe("Bearer my-token"); + }); + + it("should work without auth headers", async () => { + await makePassthroughRequest("https://api.example.com", undefined, { + fetch: mockFetch, + }); + const [, calledOptions] = mockFetch.mock.calls[0]; + expect(calledOptions.headers.authorization).toBeUndefined(); + }); + + it("should allow init headers to override auth headers", async () => { + await makePassthroughRequest( + "https://api.example.com", + { headers: { Authorization: "Bearer override" } }, + { + getAuthHeaders: async () => ({ Authorization: "Bearer sdk-auth" }), + fetch: mockFetch, + }, + ); + const [, calledOptions] = mockFetch.mock.calls[0]; + expect(calledOptions.headers.authorization).toBe("Bearer override"); + }); + }); + + describe("method and body", () => { + it("should default to GET when no method specified", async () => { + await makePassthroughRequest("https://api.example.com", undefined, { + fetch: mockFetch, + }); + const [, calledOptions] = mockFetch.mock.calls[0]; + expect(calledOptions.method).toBe("GET"); + }); + + it("should use the method from init", async () => { + await makePassthroughRequest( + "https://api.example.com", + { method: "POST", body: JSON.stringify({ key: "value" }) }, + { fetch: mockFetch }, + ); + const [, calledOptions] = mockFetch.mock.calls[0]; + expect(calledOptions.method).toBe("POST"); + expect(calledOptions.body).toBe(JSON.stringify({ key: "value" })); + }); + + it("should pass body as undefined when not provided", async () => { + await makePassthroughRequest("https://api.example.com", { method: "GET" }, { fetch: mockFetch }); + const [, calledOptions] = mockFetch.mock.calls[0]; + expect(calledOptions.body).toBeUndefined(); + }); + }); + + describe("timeout and retries", () => { + it("should use requestOptions timeout over client timeout", async () => { + await makePassthroughRequest( + "https://api.example.com", + undefined, + { timeoutInSeconds: 30, fetch: mockFetch }, + { timeoutInSeconds: 10 }, + ); + // The timeout is passed to makeRequest which converts to ms + // We verify via the signal timing behavior (indirectly tested through makeRequest) + expect(mockFetch).toHaveBeenCalledTimes(1); + }); + + it("should use client timeout when requestOptions timeout is not set", async () => { + await makePassthroughRequest("https://api.example.com", undefined, { + timeoutInSeconds: 30, + fetch: mockFetch, + }); + expect(mockFetch).toHaveBeenCalledTimes(1); + }); + + it("should use requestOptions maxRetries over client maxRetries", async () => { + mockFetch.mockResolvedValue(new Response("", { status: 500 })); + vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + process.nextTick(callback); + return null as any; + }); + + await makePassthroughRequest( + "https://api.example.com", + undefined, + { maxRetries: 5, fetch: mockFetch }, + { maxRetries: 1 }, + ); + // 1 initial + 1 retry = 2 calls + expect(mockFetch).toHaveBeenCalledTimes(2); + + vi.restoreAllMocks(); + }); + }); + + describe("abort signal", () => { + it("should use requestOptions.abortSignal over init.signal", async () => { + const initController = new AbortController(); + const requestController = new AbortController(); + + await makePassthroughRequest( + "https://api.example.com", + { signal: initController.signal }, + { fetch: mockFetch }, + { abortSignal: requestController.signal }, + ); + const [, calledOptions] = mockFetch.mock.calls[0]; + // The signal passed to makeRequest is combined with timeout signal via anySignal, + // but the requestOptions.abortSignal should be the one that's used (not init.signal) + expect(calledOptions.signal).toBeDefined(); + }); + + it("should use init.signal when requestOptions.abortSignal is not set", async () => { + const initController = new AbortController(); + + await makePassthroughRequest( + "https://api.example.com", + { signal: initController.signal }, + { fetch: mockFetch }, + ); + const [, calledOptions] = mockFetch.mock.calls[0]; + expect(calledOptions.signal).toBeDefined(); + }); + }); + + describe("credentials", () => { + it("should pass credentials include when set", async () => { + await makePassthroughRequest("https://api.example.com", { credentials: "include" }, { fetch: mockFetch }); + const [, calledOptions] = mockFetch.mock.calls[0]; + expect(calledOptions.credentials).toBe("include"); + }); + + it("should not pass credentials when not set to include", async () => { + await makePassthroughRequest( + "https://api.example.com", + { credentials: "same-origin" }, + { + fetch: mockFetch, + }, + ); + const [, calledOptions] = mockFetch.mock.calls[0]; + expect(calledOptions.credentials).toBeUndefined(); + }); + }); + + describe("response", () => { + it("should return the Response object from fetch", async () => { + const mockResponse = new Response(JSON.stringify({ data: "test" }), { + status: 200, + headers: { "Content-Type": "application/json" }, + }); + mockFetch.mockResolvedValue(mockResponse); + + const response = await makePassthroughRequest("https://api.example.com", undefined, { + fetch: mockFetch, + }); + expect(response).toBe(mockResponse); + expect(response.status).toBe(200); + }); + + it("should return error responses without throwing", async () => { + const errorResponse = new Response("Not Found", { status: 404 }); + mockFetch.mockResolvedValue(errorResponse); + + const response = await makePassthroughRequest("https://api.example.com", undefined, { + fetch: mockFetch, + }); + expect(response.status).toBe(404); + }); + }); + + describe("Request object input", () => { + it("should extract URL from Request object", async () => { + const request = new Request("https://api.example.com/v1/resource", { method: "POST" }); + await makePassthroughRequest(request, undefined, { + fetch: mockFetch, + }); + const [calledUrl, calledOptions] = mockFetch.mock.calls[0]; + expect(calledUrl).toBe("https://api.example.com/v1/resource"); + expect(calledOptions.method).toBe("POST"); + }); + + it("should extract headers from Request object when no init provided", async () => { + const request = new Request("https://api.example.com", { + headers: { "X-From-Request": "request-value" }, + }); + await makePassthroughRequest(request, undefined, { + fetch: mockFetch, + }); + const [, calledOptions] = mockFetch.mock.calls[0]; + expect(calledOptions.headers["x-from-request"]).toBe("request-value"); + }); + + it("should use explicit init over Request object properties", async () => { + const request = new Request("https://api.example.com", { + method: "POST", + headers: { "X-From-Request": "request-value" }, + }); + await makePassthroughRequest( + request, + { method: "PUT", headers: { "X-From-Init": "init-value" } }, + { fetch: mockFetch }, + ); + const [, calledOptions] = mockFetch.mock.calls[0]; + expect(calledOptions.method).toBe("PUT"); + expect(calledOptions.headers["x-from-init"]).toBe("init-value"); + // Request headers should NOT be present since explicit init was provided + expect(calledOptions.headers["x-from-request"]).toBeUndefined(); + }); + }); + + describe("SDK default header suppliers", () => { + it("should resolve supplier functions for SDK default headers", async () => { + await makePassthroughRequest("https://api.example.com", undefined, { + headers: { + "X-Static": "static-value", + "X-Dynamic": () => "dynamic-value", + }, + fetch: mockFetch, + }); + const [, calledOptions] = mockFetch.mock.calls[0]; + expect(calledOptions.headers["x-static"]).toBe("static-value"); + expect(calledOptions.headers["x-dynamic"]).toBe("dynamic-value"); + }); + }); +}); diff --git a/tests/unit/fetcher/makeRequest.test.ts b/tests/unit/fetcher/makeRequest.test.ts index ea49466..bde1945 100644 --- a/tests/unit/fetcher/makeRequest.test.ts +++ b/tests/unit/fetcher/makeRequest.test.ts @@ -1,5 +1,9 @@ import type { Mock } from "vitest"; -import { makeRequest } from "../../../src/core/fetcher/makeRequest"; +import { + isCacheNoStoreSupported, + makeRequest, + resetCacheNoStoreSupported, +} from "../../../src/core/fetcher/makeRequest"; describe("Test makeRequest", () => { const mockPostUrl = "https://httpbin.org/post"; @@ -12,6 +16,7 @@ describe("Test makeRequest", () => { beforeEach(() => { mockFetch = vi.fn(); mockFetch.mockResolvedValue(new Response(JSON.stringify({ test: "successful" }), { status: 200 })); + resetCacheNoStoreSupported(); }); it("should handle POST request correctly", async () => { @@ -51,4 +56,103 @@ describe("Test makeRequest", () => { expect(calledOptions.signal).toBeDefined(); expect(calledOptions.signal).toBeInstanceOf(AbortSignal); }); + + it("should not include cache option when disableCache is not set", async () => { + await makeRequest(mockFetch, mockGetUrl, "GET", mockHeaders, undefined); + const [, calledOptions] = mockFetch.mock.calls[0]; + expect(calledOptions.cache).toBeUndefined(); + }); + + it("should not include cache option when disableCache is false", async () => { + await makeRequest( + mockFetch, + mockGetUrl, + "GET", + mockHeaders, + undefined, + undefined, + undefined, + undefined, + undefined, + false, + ); + const [, calledOptions] = mockFetch.mock.calls[0]; + expect(calledOptions.cache).toBeUndefined(); + }); + + it("should include cache: no-store when disableCache is true and runtime supports it", async () => { + // In Node.js test environment, Request supports the cache option + expect(isCacheNoStoreSupported()).toBe(true); + await makeRequest( + mockFetch, + mockGetUrl, + "GET", + mockHeaders, + undefined, + undefined, + undefined, + undefined, + undefined, + true, + ); + const [, calledOptions] = mockFetch.mock.calls[0]; + expect(calledOptions.cache).toBe("no-store"); + }); + + it("should cache the result of isCacheNoStoreSupported", () => { + const first = isCacheNoStoreSupported(); + const second = isCacheNoStoreSupported(); + expect(first).toBe(second); + }); + + it("should reset cache detection state with resetCacheNoStoreSupported", () => { + // First call caches the result + const first = isCacheNoStoreSupported(); + expect(first).toBe(true); + + // Reset clears the cache + resetCacheNoStoreSupported(); + + // After reset, it should re-detect (and still return true in Node.js) + const second = isCacheNoStoreSupported(); + expect(second).toBe(true); + }); + + it("should not include cache option when runtime does not support it (e.g. Cloudflare Workers)", async () => { + // Mock Request constructor to throw when cache option is passed, + // simulating runtimes like Cloudflare Workers + const OriginalRequest = globalThis.Request; + globalThis.Request = class MockRequest { + constructor(_url: string, init?: RequestInit) { + if (init?.cache != null) { + throw new TypeError("The 'cache' field on 'RequestInitializerDict' is not implemented."); + } + } + } as unknown as typeof Request; + + try { + // Reset so the detection runs fresh with the mocked Request + resetCacheNoStoreSupported(); + expect(isCacheNoStoreSupported()).toBe(false); + + await makeRequest( + mockFetch, + mockGetUrl, + "GET", + mockHeaders, + undefined, + undefined, + undefined, + undefined, + undefined, + true, + ); + const [, calledOptions] = mockFetch.mock.calls[0]; + expect(calledOptions.cache).toBeUndefined(); + } finally { + // Restore original Request + globalThis.Request = OriginalRequest; + resetCacheNoStoreSupported(); + } + }); }); diff --git a/tests/wire/account.test.ts b/tests/wire/account.test.ts index 507359a..6902f7d 100644 --- a/tests/wire/account.test.ts +++ b/tests/wire/account.test.ts @@ -67,6 +67,7 @@ describe("AccountClient", () => { enabled: true, }, }; + server.mockEndpoint().get("/account").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.account.getAccount(); @@ -183,6 +184,7 @@ describe("AccountClient", () => { }, ], }; + server .mockEndpoint() .get("/organization/activities") @@ -217,6 +219,7 @@ describe("AccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/organization/activities") diff --git a/tests/wire/balance.test.ts b/tests/wire/balance.test.ts index 7d005b7..7acf454 100644 --- a/tests/wire/balance.test.ts +++ b/tests/wire/balance.test.ts @@ -21,6 +21,7 @@ describe("BalanceClient", () => { updatedAt: "updatedAt", value: 1, }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/active-balance") @@ -53,6 +54,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/active-balance") @@ -75,6 +77,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/active-balance") @@ -97,6 +100,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/active-balance") @@ -119,6 +123,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/active-balance") @@ -141,6 +146,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/active-balance") @@ -188,6 +194,7 @@ describe("BalanceClient", () => { }, ], }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/balance-definitions") @@ -234,6 +241,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/balance-definitions") @@ -254,6 +262,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/balance-definitions") @@ -274,6 +283,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/balance-definitions") @@ -294,6 +304,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/balance-definitions") @@ -335,6 +346,7 @@ describe("BalanceClient", () => { unit: "unit", updatedAt: "updatedAt", }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/balance-definitions") @@ -380,6 +392,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name", unit: "POINTS" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/balance-definitions") @@ -403,6 +416,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name", unit: "POINTS" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/balance-definitions") @@ -426,6 +440,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name", unit: "POINTS" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/balance-definitions") @@ -449,6 +464,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name", unit: "POINTS" }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/balance-definitions") @@ -472,6 +488,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name", unit: "POINTS" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/balance-definitions") @@ -516,6 +533,7 @@ describe("BalanceClient", () => { unit: "unit", updatedAt: "updatedAt", }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/balance-definitions/bdid") @@ -559,6 +577,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/balance-definitions/bdid") @@ -580,6 +599,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/balance-definitions/bdid") @@ -601,6 +621,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/balance-definitions/bdid") @@ -622,6 +643,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/balance-definitions/bdid") @@ -643,6 +665,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/balance-definitions/bdid") @@ -685,6 +708,7 @@ describe("BalanceClient", () => { unit: "unit", updatedAt: "updatedAt", }; + server .mockEndpoint() .put("/loyalty/balance/programs/pid/balance-definitions/bdid") @@ -731,6 +755,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name", unit: "POINTS" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/balance/programs/pid/balance-definitions/bdid") @@ -755,6 +780,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name", unit: "POINTS" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/balance/programs/pid/balance-definitions/bdid") @@ -779,6 +805,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name", unit: "POINTS" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/balance/programs/pid/balance-definitions/bdid") @@ -803,6 +830,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name", unit: "POINTS" }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .put("/loyalty/balance/programs/pid/balance-definitions/bdid") @@ -827,6 +855,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name", unit: "POINTS" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/balance/programs/pid/balance-definitions/bdid") @@ -851,6 +880,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name", unit: "POINTS" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/balance/programs/pid/balance-definitions/bdid") @@ -893,6 +923,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/balance/programs/pid/balance-definitions/bdid") @@ -914,6 +945,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/balance/programs/pid/balance-definitions/bdid") @@ -935,6 +967,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/balance/programs/pid/balance-definitions/bdid") @@ -956,6 +989,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .delete("/loyalty/balance/programs/pid/balance-definitions/bdid") @@ -977,6 +1011,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/balance/programs/pid/balance-definitions/bdid") @@ -1015,6 +1050,7 @@ describe("BalanceClient", () => { updatedAt: "updatedAt", value: 1, }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/balance-definitions/bdid/limits") @@ -1058,6 +1094,7 @@ describe("BalanceClient", () => { value: 1, }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/balance-definitions/bdid/limits") @@ -1091,6 +1128,7 @@ describe("BalanceClient", () => { value: 1, }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/balance-definitions/bdid/limits") @@ -1124,6 +1162,7 @@ describe("BalanceClient", () => { value: 1, }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/balance-definitions/bdid/limits") @@ -1157,6 +1196,7 @@ describe("BalanceClient", () => { value: 1, }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/balance-definitions/bdid/limits") @@ -1190,6 +1230,7 @@ describe("BalanceClient", () => { value: 1, }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/balance-definitions/bdid/limits") @@ -1228,6 +1269,7 @@ describe("BalanceClient", () => { updatedAt: "updatedAt", value: 1, }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/balance-definitions/bdid/limits/blid") @@ -1260,6 +1302,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/balance-definitions/bdid/limits/blid") @@ -1282,6 +1325,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/balance-definitions/bdid/limits/blid") @@ -1304,6 +1348,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/balance-definitions/bdid/limits/blid") @@ -1326,6 +1371,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/balance-definitions/bdid/limits/blid") @@ -1348,6 +1394,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/balance-definitions/bdid/limits/blid") @@ -1387,6 +1434,7 @@ describe("BalanceClient", () => { updatedAt: "updatedAt", value: 1, }; + server .mockEndpoint() .put("/loyalty/balance/programs/pid/balance-definitions/bdid/limits/blid") @@ -1431,6 +1479,7 @@ describe("BalanceClient", () => { value: 1, }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/balance/programs/pid/balance-definitions/bdid/limits/blid") @@ -1465,6 +1514,7 @@ describe("BalanceClient", () => { value: 1, }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/balance/programs/pid/balance-definitions/bdid/limits/blid") @@ -1499,6 +1549,7 @@ describe("BalanceClient", () => { value: 1, }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/balance/programs/pid/balance-definitions/bdid/limits/blid") @@ -1533,6 +1584,7 @@ describe("BalanceClient", () => { value: 1, }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .put("/loyalty/balance/programs/pid/balance-definitions/bdid/limits/blid") @@ -1567,6 +1619,7 @@ describe("BalanceClient", () => { value: 1, }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/balance/programs/pid/balance-definitions/bdid/limits/blid") @@ -1614,6 +1667,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/balance/programs/pid/balance-definitions/bdid/limits/blid") @@ -1636,6 +1690,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/balance/programs/pid/balance-definitions/bdid/limits/blid") @@ -1658,6 +1713,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/balance/programs/pid/balance-definitions/bdid/limits/blid") @@ -1680,6 +1736,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .delete("/loyalty/balance/programs/pid/balance-definitions/bdid/limits/blid") @@ -1702,6 +1759,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/balance/programs/pid/balance-definitions/bdid/limits/blid") @@ -1731,6 +1789,7 @@ describe("BalanceClient", () => { count: 1, loyaltyProgramId: "loyaltyProgramId", }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/contact-balances") @@ -1762,6 +1821,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/contact-balances") @@ -1782,6 +1842,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/contact-balances") @@ -1802,6 +1863,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/contact-balances") @@ -1822,6 +1884,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/contact-balances") @@ -1842,6 +1905,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/contact-balances") @@ -1881,6 +1945,7 @@ describe("BalanceClient", () => { transactionid: "transactionid", updatedAt: "updatedAt", }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/create-order") @@ -1927,6 +1992,7 @@ describe("BalanceClient", () => { source: "source", }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/create-order") @@ -1959,6 +2025,7 @@ describe("BalanceClient", () => { source: "source", }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/create-order") @@ -1991,6 +2058,7 @@ describe("BalanceClient", () => { source: "source", }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/create-order") @@ -2023,6 +2091,7 @@ describe("BalanceClient", () => { source: "source", }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/create-order") @@ -2049,6 +2118,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { balance: [{ balanceDefinitionId: "balanceDefinitionId", value: 1.1 }] }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/subscriptions/cid/balances") @@ -2076,6 +2146,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/subscriptions/cid/balances") @@ -2097,6 +2168,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/subscriptions/cid/balances") @@ -2118,6 +2190,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/subscriptions/cid/balances") @@ -2139,6 +2212,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/subscriptions/cid/balances") @@ -2160,6 +2234,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/subscriptions/cid/balances") @@ -2191,6 +2266,7 @@ describe("BalanceClient", () => { loyaltyProgramId: "loyaltyProgramId", organizationId: 1, }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/subscriptions/cid/balances") @@ -2223,6 +2299,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { balanceDefinitionId: "balanceDefinitionId" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/subscriptions/cid/balances") @@ -2246,6 +2323,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { balanceDefinitionId: "balanceDefinitionId" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/subscriptions/cid/balances") @@ -2269,6 +2347,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { balanceDefinitionId: "balanceDefinitionId" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/subscriptions/cid/balances") @@ -2292,6 +2371,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { balanceDefinitionId: "balanceDefinitionId" }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/subscriptions/cid/balances") @@ -2315,6 +2395,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { balanceDefinitionId: "balanceDefinitionId" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/subscriptions/cid/balances") @@ -2357,6 +2438,7 @@ describe("BalanceClient", () => { }, ], }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/transaction-history") @@ -2367,8 +2449,8 @@ describe("BalanceClient", () => { const response = await client.balance.getTransactionHistoryApi({ pid: "pid", - contact_id: 1, - balance_definition_id: "balance_definition_id", + contactId: 1, + balanceDefinitionId: "balanceDefinitionId", }); expect(response).toEqual({ balanceDefinitionId: "balanceDefinitionId", @@ -2399,6 +2481,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/transaction-history") @@ -2410,8 +2493,8 @@ describe("BalanceClient", () => { await expect(async () => { return await client.balance.getTransactionHistoryApi({ pid: "pid", - contact_id: 1, - balance_definition_id: "balance_definition_id", + contactId: 1, + balanceDefinitionId: "balanceDefinitionId", }); }).rejects.toThrow(Brevo.UnauthorizedError); }); @@ -2421,6 +2504,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/transaction-history") @@ -2432,8 +2516,8 @@ describe("BalanceClient", () => { await expect(async () => { return await client.balance.getTransactionHistoryApi({ pid: "pid", - contact_id: 1, - balance_definition_id: "balance_definition_id", + contactId: 1, + balanceDefinitionId: "balanceDefinitionId", }); }).rejects.toThrow(Brevo.ForbiddenError); }); @@ -2443,6 +2527,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/transaction-history") @@ -2454,8 +2539,8 @@ describe("BalanceClient", () => { await expect(async () => { return await client.balance.getTransactionHistoryApi({ pid: "pid", - contact_id: 1, - balance_definition_id: "balance_definition_id", + contactId: 1, + balanceDefinitionId: "balanceDefinitionId", }); }).rejects.toThrow(Brevo.NotFoundError); }); @@ -2465,6 +2550,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/transaction-history") @@ -2476,8 +2562,8 @@ describe("BalanceClient", () => { await expect(async () => { return await client.balance.getTransactionHistoryApi({ pid: "pid", - contact_id: 1, - balance_definition_id: "balance_definition_id", + contactId: 1, + balanceDefinitionId: "balanceDefinitionId", }); }).rejects.toThrow(Brevo.UnprocessableEntityError); }); @@ -2487,6 +2573,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/balance/programs/pid/transaction-history") @@ -2498,8 +2585,8 @@ describe("BalanceClient", () => { await expect(async () => { return await client.balance.getTransactionHistoryApi({ pid: "pid", - contact_id: 1, - balance_definition_id: "balance_definition_id", + contactId: 1, + balanceDefinitionId: "balanceDefinitionId", }); }).rejects.toThrow(Brevo.InternalServerError); }); @@ -2525,6 +2612,7 @@ describe("BalanceClient", () => { status: "status", updatedAt: "updatedAt", }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/transactions") @@ -2565,6 +2653,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { amount: 1.1, balanceDefinitionId: "balanceDefinitionId" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/transactions") @@ -2588,6 +2677,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { amount: 1.1, balanceDefinitionId: "balanceDefinitionId" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/transactions") @@ -2611,6 +2701,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { amount: 1.1, balanceDefinitionId: "balanceDefinitionId" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/transactions") @@ -2634,6 +2725,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { amount: 1.1, balanceDefinitionId: "balanceDefinitionId" }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/transactions") @@ -2657,6 +2749,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { amount: 1.1, balanceDefinitionId: "balanceDefinitionId" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/transactions") @@ -2696,6 +2789,7 @@ describe("BalanceClient", () => { status: "status", updatedAt: "updatedAt", }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/transactions/tid/cancel") @@ -2734,6 +2828,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/transactions/tid/cancel") @@ -2755,6 +2850,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/transactions/tid/cancel") @@ -2776,6 +2872,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/transactions/tid/cancel") @@ -2797,6 +2894,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/transactions/tid/cancel") @@ -2818,6 +2916,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/transactions/tid/cancel") @@ -2855,6 +2954,7 @@ describe("BalanceClient", () => { status: "status", updatedAt: "updatedAt", }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/transactions/tid/complete") @@ -2893,6 +2993,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/transactions/tid/complete") @@ -2914,6 +3015,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/transactions/tid/complete") @@ -2935,6 +3037,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/transactions/tid/complete") @@ -2956,6 +3059,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/transactions/tid/complete") @@ -2977,6 +3081,7 @@ describe("BalanceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/balance/programs/pid/transactions/tid/complete") diff --git a/tests/wire/companies.test.ts b/tests/wire/companies.test.ts index 9fcb13f..ee90cfc 100644 --- a/tests/wire/companies.test.ts +++ b/tests/wire/companies.test.ts @@ -33,6 +33,7 @@ describe("CompaniesClient", () => { }, ], }; + server.mockEndpoint().get("/companies").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.companies.getAllCompanies(); @@ -67,6 +68,7 @@ describe("CompaniesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/companies").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -79,6 +81,7 @@ describe("CompaniesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "company" }; const rawResponseBody = { id: "61a5cd07ca1347c82306ad06" }; + server .mockEndpoint() .post("/companies") @@ -101,6 +104,7 @@ describe("CompaniesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/companies") @@ -141,6 +145,7 @@ describe("CompaniesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .patch("/companies/link-unlink/id") @@ -177,6 +182,7 @@ describe("CompaniesClient", () => { linkedContactsIds: [1, 2, 3], linkedDealsIds: ["61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991", "61a5ce58c5d4795761045992"], }; + server.mockEndpoint().get("/companies/id").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.companies.getACompany({ @@ -205,6 +211,7 @@ describe("CompaniesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/companies/id").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -219,6 +226,7 @@ describe("CompaniesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/companies/id").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -245,6 +253,7 @@ describe("CompaniesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/companies/id").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -259,6 +268,7 @@ describe("CompaniesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/companies/id").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -288,6 +298,7 @@ describe("CompaniesClient", () => { linkedContactsIds: [1, 2, 3], linkedDealsIds: ["61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991", "61a5ce58c5d4795761045992"], }; + server .mockEndpoint() .patch("/companies/id") @@ -323,6 +334,7 @@ describe("CompaniesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .patch("/companies/id") @@ -344,6 +356,7 @@ describe("CompaniesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .patch("/companies/id") @@ -365,6 +378,7 @@ describe("CompaniesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { attributeType: "text", label: "Attribute Label", objectType: "companies" }; const rawResponseBody = { id: "61a5cd07ca1347c82306ad07" }; + server .mockEndpoint() .post("/crm/attributes") @@ -389,6 +403,7 @@ describe("CompaniesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { attributeType: "text", label: "label", objectType: "companies" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/crm/attributes") @@ -407,6 +422,123 @@ describe("CompaniesClient", () => { }).rejects.toThrow(Brevo.BadRequestError); }); + test("deleteAnAttribute (1)", async () => { + const server = mockServerPool.createServer(); + const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + server.mockEndpoint().delete("/crm/attributes/id").respondWith().statusCode(200).build(); + + const response = await client.companies.deleteAnAttribute({ + id: "id", + }); + expect(response).toEqual(undefined); + }); + + test("deleteAnAttribute (2)", async () => { + const server = mockServerPool.createServer(); + const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .delete("/crm/attributes/id") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.companies.deleteAnAttribute({ + id: "id", + }); + }).rejects.toThrow(Brevo.BadRequestError); + }); + + test("deleteAnAttribute (3)", async () => { + const server = mockServerPool.createServer(); + const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .delete("/crm/attributes/id") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.companies.deleteAnAttribute({ + id: "id", + }); + }).rejects.toThrow(Brevo.NotFoundError); + }); + + test("updateAnAttribute (1)", async () => { + const server = mockServerPool.createServer(); + const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + + server + .mockEndpoint() + .patch("/crm/attributes/id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .build(); + + const response = await client.companies.updateAnAttribute({ + id: "id", + }); + expect(response).toEqual(undefined); + }); + + test("updateAnAttribute (2)", async () => { + const server = mockServerPool.createServer(); + const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .patch("/crm/attributes/id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.companies.updateAnAttribute({ + id: "id", + }); + }).rejects.toThrow(Brevo.BadRequestError); + }); + + test("updateAnAttribute (3)", async () => { + const server = mockServerPool.createServer(); + const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .patch("/crm/attributes/id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.companies.updateAnAttribute({ + id: "id", + }); + }).rejects.toThrow(Brevo.NotFoundError); + }); + test("getCompanyAttributes", async () => { const server = mockServerPool.createServer(); const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); @@ -420,6 +552,7 @@ describe("CompaniesClient", () => { label: "Company Name", }, ]; + server .mockEndpoint() .get("/crm/attributes/companies") diff --git a/tests/wire/contacts.test.ts b/tests/wire/contacts.test.ts index b5f5d35..3a16f97 100644 --- a/tests/wire/contacts.test.ts +++ b/tests/wire/contacts.test.ts @@ -36,6 +36,7 @@ describe("ContactsClient", () => { ], count: 3, }; + server.mockEndpoint().get("/contacts").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.contacts.getContacts(); @@ -73,6 +74,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/contacts").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -85,6 +87,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server.mockEndpoint().get("/contacts").respondWith().statusCode(429).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -97,6 +100,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { id: 21 }; + server .mockEndpoint() .post("/contacts") @@ -117,6 +121,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/contacts") @@ -136,6 +141,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { code: "invalid_parameter", message: "message" }; + server .mockEndpoint() .post("/contacts") @@ -210,6 +216,7 @@ describe("ContactsClient", () => { }, ], }; + server .mockEndpoint() .get("/contacts/attributes") @@ -336,6 +343,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/contacts/attributes/normal/attributeName") @@ -378,6 +386,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/contacts/attributes/category/attributeName") @@ -400,6 +409,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/contacts/attributes/category/attributeName") @@ -435,6 +445,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/contacts/attributes/normal/attributeName") @@ -456,6 +467,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/contacts/attributes/normal/attributeName") @@ -496,6 +508,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/contacts/attributes/multiple-choice/multipleChoiceAttribute/multipleChoiceAttributeOption") @@ -518,6 +531,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/contacts/attributes/multiple-choice/multipleChoiceAttribute/multipleChoiceAttributeOption") @@ -551,6 +565,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/contacts/batch") @@ -602,6 +617,7 @@ describe("ContactsClient", () => { templateId: 1000000, }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/contacts/doubleOptinConfirmation") @@ -626,6 +642,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { customContactFilter: {} }; const rawResponseBody = { processId: 78 }; + server .mockEndpoint() .post("/contacts/export") @@ -648,6 +665,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { customContactFilter: {} }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/contacts/export") @@ -669,6 +687,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { customContactFilter: {} }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/contacts/export") @@ -696,6 +715,7 @@ describe("ContactsClient", () => { { id: 29, name: "Prestashop", totalBlacklisted: 10, totalSubscribers: 6543, uniqueSubscribers: 6553 }, ], }; + server.mockEndpoint().get("/contacts/folders").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.contacts.getFolders(); @@ -725,6 +745,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/contacts/folders").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -737,6 +758,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { id: 5 }; + server .mockEndpoint() .post("/contacts/folders") @@ -757,6 +779,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/contacts/folders") @@ -782,6 +805,7 @@ describe("ContactsClient", () => { totalSubscribers: 16778, uniqueSubscribers: 17765, }; + server .mockEndpoint() .get("/contacts/folders/1000000") @@ -807,6 +831,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/contacts/folders/1000000") @@ -827,6 +852,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/contacts/folders/1000000") @@ -867,6 +893,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/contacts/folders/1000000") @@ -889,6 +916,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/contacts/folders/1000000") @@ -923,6 +951,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/contacts/folders/1000000") @@ -943,6 +972,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/contacts/folders/1000000") @@ -970,6 +1000,7 @@ describe("ContactsClient", () => { { id: 22, name: "VIP_Customer", totalBlacklisted: 72, totalSubscribers: 8753, uniqueSubscribers: 8826 }, ], }; + server .mockEndpoint() .get("/contacts/folders/1000000/lists") @@ -1014,6 +1045,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/contacts/folders/1000000/lists") @@ -1034,6 +1066,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/contacts/folders/1000000/lists") @@ -1054,6 +1087,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { processId: 78 }; + server .mockEndpoint() .post("/contacts/import") @@ -1074,6 +1108,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/contacts/import") @@ -1113,6 +1148,7 @@ describe("ContactsClient", () => { }, ], }; + server.mockEndpoint().get("/contacts/lists").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.contacts.getLists(); @@ -1144,6 +1180,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/contacts/lists").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -1156,6 +1193,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { folderId: 2, name: "Magento Customer - ES" }; const rawResponseBody = { id: 5 }; + server .mockEndpoint() .post("/contacts/lists") @@ -1179,6 +1217,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { folderId: 1000000, name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/contacts/lists") @@ -1258,6 +1297,7 @@ describe("ContactsClient", () => { dynamicList: false, folderId: 1, }; + server .mockEndpoint() .get("/contacts/lists/1000000") @@ -1334,6 +1374,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/contacts/lists/1000000") @@ -1354,6 +1395,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/contacts/lists/1000000") @@ -1393,6 +1435,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/contacts/lists/1000000") @@ -1414,6 +1457,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/contacts/lists/1000000") @@ -1447,6 +1491,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/contacts/lists/1000000") @@ -1467,6 +1512,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/contacts/lists/1000000") @@ -1524,6 +1570,7 @@ describe("ContactsClient", () => { ], count: 17655, }; + server .mockEndpoint() .get("/contacts/lists/1000000/contacts") @@ -1580,6 +1627,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/contacts/lists/1000000/contacts") @@ -1600,6 +1648,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/contacts/lists/1000000/contacts") @@ -1627,6 +1676,7 @@ describe("ContactsClient", () => { total: 27, }, }; + server .mockEndpoint() .post("/contacts/lists/1000000/contacts/add") @@ -1664,6 +1714,7 @@ describe("ContactsClient", () => { total: 27, }, }; + server .mockEndpoint() .post("/contacts/lists/1000000/contacts/add") @@ -1701,6 +1752,7 @@ describe("ContactsClient", () => { total: 27, }, }; + server .mockEndpoint() .post("/contacts/lists/1000000/contacts/add") @@ -1738,6 +1790,7 @@ describe("ContactsClient", () => { total: 27, }, }; + server .mockEndpoint() .post("/contacts/lists/1000000/contacts/add") @@ -1775,6 +1828,7 @@ describe("ContactsClient", () => { total: 27, }, }; + server .mockEndpoint() .post("/contacts/lists/1000000/contacts/add") @@ -1812,6 +1866,7 @@ describe("ContactsClient", () => { total: 27, }, }; + server .mockEndpoint() .post("/contacts/lists/1000000/contacts/add") @@ -1842,6 +1897,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/contacts/lists/1000000/contacts/add") @@ -1864,6 +1920,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/contacts/lists/1000000/contacts/add") @@ -1893,6 +1950,7 @@ describe("ContactsClient", () => { total: 27, }, }; + server .mockEndpoint() .post("/contacts/lists/1000000/contacts/remove") @@ -1930,6 +1988,7 @@ describe("ContactsClient", () => { total: 27, }, }; + server .mockEndpoint() .post("/contacts/lists/1000000/contacts/remove") @@ -1967,6 +2026,7 @@ describe("ContactsClient", () => { total: 27, }, }; + server .mockEndpoint() .post("/contacts/lists/1000000/contacts/remove") @@ -2004,6 +2064,7 @@ describe("ContactsClient", () => { total: 27, }, }; + server .mockEndpoint() .post("/contacts/lists/1000000/contacts/remove") @@ -2041,6 +2102,7 @@ describe("ContactsClient", () => { total: 27, }, }; + server .mockEndpoint() .post("/contacts/lists/1000000/contacts/remove") @@ -2078,6 +2140,7 @@ describe("ContactsClient", () => { total: 27, }, }; + server .mockEndpoint() .post("/contacts/lists/1000000/contacts/remove") @@ -2115,6 +2178,7 @@ describe("ContactsClient", () => { total: 27, }, }; + server .mockEndpoint() .post("/contacts/lists/1000000/contacts/remove") @@ -2152,6 +2216,7 @@ describe("ContactsClient", () => { total: 27, }, }; + server .mockEndpoint() .post("/contacts/lists/1000000/contacts/remove") @@ -2182,6 +2247,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/contacts/lists/1000000/contacts/remove") @@ -2204,6 +2270,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/contacts/lists/1000000/contacts/remove") @@ -2232,6 +2299,7 @@ describe("ContactsClient", () => { { categoryName: "Name2", id: 50, segmentName: "Segment2", updatedAt: "2017-03-12T12:30:00Z" }, ], }; + server.mockEndpoint().get("/contacts/segments").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.contacts.getSegments(); @@ -2259,6 +2327,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/contacts/segments").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -2313,6 +2382,7 @@ describe("ContactsClient", () => { }, }, }; + server .mockEndpoint() .get("/contacts/identifier") @@ -2421,6 +2491,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/contacts/identifier") @@ -2441,6 +2512,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/contacts/identifier") @@ -2480,6 +2552,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/contacts/identifier") @@ -2501,6 +2574,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/contacts/identifier") @@ -2522,6 +2596,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { code: "invalid_parameter", message: "message" }; + server .mockEndpoint() .put("/contacts/identifier") @@ -2555,6 +2630,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/contacts/identifier") @@ -2575,6 +2651,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/contacts/identifier") @@ -2595,6 +2672,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .delete("/contacts/identifier") @@ -2647,6 +2725,7 @@ describe("ContactsClient", () => { userUnsubscription: [{ campaignId: 3, eventTime: "2017-03-12T20:15:13Z", ip: "165.87.3.15" }], }, }; + server .mockEndpoint() .get("/contacts/identifier/campaignStats") @@ -2754,6 +2833,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/contacts/identifier/campaignStats") @@ -2774,6 +2854,7 @@ describe("ContactsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/contacts/identifier/campaignStats") diff --git a/tests/wire/conversations.test.ts b/tests/wire/conversations.test.ts index 5c7a79e..cba337d 100644 --- a/tests/wire/conversations.test.ts +++ b/tests/wire/conversations.test.ts @@ -54,6 +54,7 @@ describe("ConversationsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/conversations/agentOnlinePing") @@ -125,6 +126,7 @@ describe("ConversationsClient", () => { type: "agent", visitorId: "kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg", }; + server .mockEndpoint() .post("/conversations/messages") @@ -275,6 +277,7 @@ describe("ConversationsClient", () => { type: "agent", visitorId: "kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg", }; + server .mockEndpoint() .post("/conversations/messages") @@ -426,6 +429,7 @@ describe("ConversationsClient", () => { type: "agent", visitorId: "kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg", }; + server .mockEndpoint() .post("/conversations/messages") @@ -523,6 +527,7 @@ describe("ConversationsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { text: { key: "value" }, visitorId: { key: "value" } }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/conversations/messages") @@ -597,6 +602,7 @@ describe("ConversationsClient", () => { type: "agent", visitorId: "kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg", }; + server .mockEndpoint() .get("/conversations/messages/id") @@ -690,6 +696,7 @@ describe("ConversationsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/conversations/messages/id") @@ -710,6 +717,7 @@ describe("ConversationsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/conversations/messages/id") @@ -778,6 +786,7 @@ describe("ConversationsClient", () => { type: "agent", visitorId: "kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg", }; + server .mockEndpoint() .put("/conversations/messages/id") @@ -873,6 +882,7 @@ describe("ConversationsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { text: "text" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/conversations/messages/id") @@ -895,6 +905,7 @@ describe("ConversationsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { text: "text" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/conversations/messages/id") @@ -929,6 +940,7 @@ describe("ConversationsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/conversations/messages/id") @@ -949,6 +961,7 @@ describe("ConversationsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/conversations/messages/id") @@ -1021,6 +1034,7 @@ describe("ConversationsClient", () => { type: "agent", visitorId: "kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg", }; + server .mockEndpoint() .post("/conversations/pushedMessages") @@ -1168,6 +1182,7 @@ describe("ConversationsClient", () => { type: "agent", visitorId: "kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg", }; + server .mockEndpoint() .post("/conversations/pushedMessages") @@ -1315,6 +1330,7 @@ describe("ConversationsClient", () => { type: "agent", visitorId: "kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg", }; + server .mockEndpoint() .post("/conversations/pushedMessages") @@ -1411,6 +1427,7 @@ describe("ConversationsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { text: { key: "value" }, visitorId: { key: "value" } }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/conversations/pushedMessages") @@ -1485,6 +1502,7 @@ describe("ConversationsClient", () => { type: "agent", visitorId: "kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg", }; + server .mockEndpoint() .get("/conversations/pushedMessages/id") @@ -1578,6 +1596,7 @@ describe("ConversationsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/conversations/pushedMessages/id") @@ -1598,6 +1617,7 @@ describe("ConversationsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/conversations/pushedMessages/id") @@ -1668,6 +1688,7 @@ describe("ConversationsClient", () => { type: "agent", visitorId: "kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg", }; + server .mockEndpoint() .put("/conversations/pushedMessages/id") @@ -1763,6 +1784,7 @@ describe("ConversationsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { text: "text" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/conversations/pushedMessages/id") @@ -1785,6 +1807,7 @@ describe("ConversationsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { text: "text" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/conversations/pushedMessages/id") @@ -1819,6 +1842,7 @@ describe("ConversationsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/conversations/pushedMessages/id") @@ -1839,6 +1863,7 @@ describe("ConversationsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/conversations/pushedMessages/id") @@ -1859,6 +1884,7 @@ describe("ConversationsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { groupId: "PjRBMhWGen6aRHjif" }; const rawResponseBody = { groupId: "PjRBMhWGen6aRHjif", visitorId: "AXCR3k9bpSY7bpuh7" }; + server .mockEndpoint() .put("/conversations/visitorGroup") @@ -1882,6 +1908,7 @@ describe("ConversationsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { groupId: { key: "value" } }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/conversations/visitorGroup") @@ -1905,6 +1932,7 @@ describe("ConversationsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { groupId: { key: "value" } }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/conversations/visitorGroup") diff --git a/tests/wire/coupons.test.ts b/tests/wire/coupons.test.ts index 9d5a22b..09de542 100644 --- a/tests/wire/coupons.test.ts +++ b/tests/wire/coupons.test.ts @@ -20,6 +20,7 @@ describe("CouponsClient", () => { remainingDaysAlert: 5, totalCoupons: 10000, }; + server.mockEndpoint().get("/couponCollections").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.coupons.getCouponCollections(); @@ -41,6 +42,7 @@ describe("CouponsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/couponCollections").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -53,6 +55,7 @@ describe("CouponsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/couponCollections").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -65,6 +68,7 @@ describe("CouponsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { defaultCoupon: "Winter", name: "10%OFF" }; const rawResponseBody = { id: "23befbae-1505-47a8-bd27-e30ef739f32c" }; + server .mockEndpoint() .post("/couponCollections") @@ -88,6 +92,7 @@ describe("CouponsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { defaultCoupon: "defaultCoupon", name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/couponCollections") @@ -110,6 +115,7 @@ describe("CouponsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { defaultCoupon: "defaultCoupon", name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/couponCollections") @@ -142,6 +148,7 @@ describe("CouponsClient", () => { remainingDaysAlert: 5, totalCoupons: 10000, }; + server .mockEndpoint() .get("/couponCollections/id") @@ -171,6 +178,7 @@ describe("CouponsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/couponCollections/id") @@ -191,6 +199,7 @@ describe("CouponsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/couponCollections/id") @@ -211,6 +220,7 @@ describe("CouponsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/couponCollections/id") @@ -235,6 +245,7 @@ describe("CouponsClient", () => { id: "23befbae-1505-47a8-bd27-e30ef739f32c", name: "SummerPromotions", }; + server .mockEndpoint() .patch("/couponCollections/id") @@ -259,6 +270,7 @@ describe("CouponsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .patch("/couponCollections/id") @@ -280,6 +292,7 @@ describe("CouponsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .patch("/couponCollections/id") @@ -315,6 +328,7 @@ describe("CouponsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { collectionId: "collectionId", coupons: ["coupons", "coupons"] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/coupons") @@ -337,6 +351,7 @@ describe("CouponsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { collectionId: "collectionId", coupons: ["coupons", "coupons"] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/coupons") @@ -359,6 +374,7 @@ describe("CouponsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { collectionId: "collectionId", coupons: ["coupons", "coupons"] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/coupons") diff --git a/tests/wire/customObjects.test.ts b/tests/wire/customObjects.test.ts index d1a829e..e4342da 100644 --- a/tests/wire/customObjects.test.ts +++ b/tests/wire/customObjects.test.ts @@ -10,6 +10,7 @@ describe("CustomObjectsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { records: [{}] }; const rawResponseBody = { message: "Batch object records are being processed", processId: 21 }; + server .mockEndpoint() .post("/objects/vehicle/batch/upsert") @@ -34,6 +35,7 @@ describe("CustomObjectsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { records: [{}, {}] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/objects/object_type/batch/upsert") @@ -56,6 +58,7 @@ describe("CustomObjectsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { records: [{}, {}] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/objects/object_type/batch/upsert") @@ -78,6 +81,7 @@ describe("CustomObjectsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { records: [{}, {}] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/objects/object_type/batch/upsert") @@ -100,6 +104,7 @@ describe("CustomObjectsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { records: [{}, {}] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/objects/object_type/batch/upsert") @@ -133,6 +138,7 @@ describe("CustomObjectsClient", () => { }, ], }; + server .mockEndpoint() .get("/objects/vehicle/records") @@ -185,6 +191,7 @@ describe("CustomObjectsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/objects/object_type/records") @@ -207,6 +214,7 @@ describe("CustomObjectsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/objects/object_type/records") @@ -229,6 +237,7 @@ describe("CustomObjectsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/objects/object_type/records") @@ -251,6 +260,7 @@ describe("CustomObjectsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/objects/object_type/records") @@ -273,6 +283,7 @@ describe("CustomObjectsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { identifiers: { ext_ids: ["ext-001", "ext-002"] } }; const rawResponseBody = { processId: 21, message: "Batch object records are being processed for deletion." }; + server .mockEndpoint() .post("/objects/vehicle/batch/delete") @@ -299,6 +310,7 @@ describe("CustomObjectsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/objects/object_type/batch/delete") @@ -320,6 +332,7 @@ describe("CustomObjectsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/objects/object_type/batch/delete") @@ -341,6 +354,7 @@ describe("CustomObjectsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/objects/object_type/batch/delete") @@ -362,6 +376,7 @@ describe("CustomObjectsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/objects/object_type/batch/delete") diff --git a/tests/wire/deals.test.ts b/tests/wire/deals.test.ts index 9827fb8..2c98dfc 100644 --- a/tests/wire/deals.test.ts +++ b/tests/wire/deals.test.ts @@ -18,6 +18,7 @@ describe("DealsClient", () => { label: "Deal Name", }, ]; + server .mockEndpoint() .get("/crm/attributes/deals") @@ -73,6 +74,7 @@ describe("DealsClient", () => { }, ], }; + server.mockEndpoint().get("/crm/deals").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.deals.getAllDeals(); @@ -109,6 +111,7 @@ describe("DealsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/crm/deals").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -121,6 +124,7 @@ describe("DealsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "Deal: Connect with company" }; const rawResponseBody = { id: "61a5cd07ca1347c82306ad06" }; + server .mockEndpoint() .post("/crm/deals") @@ -143,6 +147,7 @@ describe("DealsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/crm/deals") @@ -183,6 +188,7 @@ describe("DealsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .patch("/crm/deals/link-unlink/id") @@ -222,6 +228,7 @@ describe("DealsClient", () => { linkedCompaniesIds: ["61a5ce58c5d4795761045990", "61a5ce58c5d4795761045991", "61a5ce58c5d4795761045992"], linkedContactsIds: [1, 2, 3], }; + server.mockEndpoint().get("/crm/deals/id").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.deals.getADeal({ @@ -255,6 +262,7 @@ describe("DealsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/crm/deals/id").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -269,6 +277,7 @@ describe("DealsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/crm/deals/id").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -295,6 +304,7 @@ describe("DealsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/crm/deals/id").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -309,6 +319,7 @@ describe("DealsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/crm/deals/id").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -336,6 +347,7 @@ describe("DealsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .patch("/crm/deals/id") @@ -357,6 +369,7 @@ describe("DealsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .patch("/crm/deals/id") @@ -382,6 +395,7 @@ describe("DealsClient", () => { pipeline_name: "Sales Pipeline", stages: [{ id: "9e577ff7-8e42-4ab3-be26-2b5e01b42518", name: "New" }], }; + server .mockEndpoint() .get("/crm/pipeline/details") @@ -414,6 +428,7 @@ describe("DealsClient", () => { stages: [{ id: "9e577ff7-8e42-4ab3-be26-2b5e01b42518", name: "New" }], }, ]; + server .mockEndpoint() .get("/crm/pipeline/details/all") @@ -442,6 +457,7 @@ describe("DealsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/crm/pipeline/details/all") @@ -466,6 +482,7 @@ describe("DealsClient", () => { stages: [{ id: "9e577ff7-8e42-4ab3-be26-2b5e01b42518", name: "New" }], }, ]; + server .mockEndpoint() .get("/crm/pipeline/details/pipelineID") @@ -496,6 +513,7 @@ describe("DealsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/crm/pipeline/details/pipelineID") diff --git a/tests/wire/domains.test.ts b/tests/wire/domains.test.ts index e0e42c6..fe2911e 100644 --- a/tests/wire/domains.test.ts +++ b/tests/wire/domains.test.ts @@ -53,6 +53,7 @@ describe("DomainsClient", () => { current_page: 1, total_pages: 1, }; + server.mockEndpoint().get("/senders/domains").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.domains.getDomains(); @@ -107,6 +108,7 @@ describe("DomainsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/senders/domains").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -139,6 +141,7 @@ describe("DomainsClient", () => { }, }, }; + server .mockEndpoint() .post("/senders/domains") @@ -204,6 +207,7 @@ describe("DomainsClient", () => { }, }, }; + server .mockEndpoint() .post("/senders/domains") @@ -269,6 +273,7 @@ describe("DomainsClient", () => { }, }, }; + server .mockEndpoint() .post("/senders/domains") @@ -334,6 +339,7 @@ describe("DomainsClient", () => { }, }, }; + server .mockEndpoint() .post("/senders/domains") @@ -399,6 +405,7 @@ describe("DomainsClient", () => { }, }, }; + server .mockEndpoint() .post("/senders/domains") @@ -444,6 +451,7 @@ describe("DomainsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/senders/domains") @@ -484,6 +492,7 @@ describe("DomainsClient", () => { }, }, }; + server .mockEndpoint() .get("/senders/domains/domainName") @@ -546,6 +555,7 @@ describe("DomainsClient", () => { }, }, }; + server .mockEndpoint() .get("/senders/domains/domainName") @@ -589,6 +599,7 @@ describe("DomainsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/senders/domains/domainName") @@ -609,6 +620,7 @@ describe("DomainsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/senders/domains/domainName") @@ -641,6 +653,7 @@ describe("DomainsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/senders/domains/domainName") @@ -661,6 +674,7 @@ describe("DomainsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/senders/domains/domainName") @@ -684,6 +698,7 @@ describe("DomainsClient", () => { domain_name: "mycompany.com", message: "Domain has been authenticated successfully.", }; + server .mockEndpoint() .put("/senders/domains/domainName/authenticate") @@ -709,6 +724,7 @@ describe("DomainsClient", () => { domain_name: "newsletter.example.com", message: "Domain authentication completed. Your domain is now ready for sending.", }; + server .mockEndpoint() .put("/senders/domains/domainName/authenticate") @@ -731,6 +747,7 @@ describe("DomainsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/senders/domains/domainName/authenticate") @@ -751,6 +768,7 @@ describe("DomainsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/senders/domains/domainName/authenticate") diff --git a/tests/wire/ecommerce.test.ts b/tests/wire/ecommerce.test.ts index 24535a9..83a27c3 100644 --- a/tests/wire/ecommerce.test.ts +++ b/tests/wire/ecommerce.test.ts @@ -30,6 +30,7 @@ describe("EcommerceClient", () => { ], count: 2, }; + server.mockEndpoint().get("/categories").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.ecommerce.getCategories(); @@ -61,6 +62,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/categories").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -73,6 +75,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { id: "CAT123" }; const rawResponseBody = { id: 21 }; + server .mockEndpoint() .post("/categories") @@ -95,6 +98,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { id: "id" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/categories") @@ -116,6 +120,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { categories: [{ id: "CAT123" }] }; const rawResponseBody = { createdCount: 2, updatedCount: 7 }; + server .mockEndpoint() .post("/categories/batch") @@ -143,6 +148,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { categories: [{ id: "id" }, { id: "id" }] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/categories/batch") @@ -178,6 +184,7 @@ describe("EcommerceClient", () => { name: "Electronics", url: "http://mydomain.com/category/clothing", }; + server.mockEndpoint().get("/categories/id").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.ecommerce.getCategoryInfo({ @@ -198,6 +205,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/categories/id").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -212,6 +220,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/categories/id").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -236,6 +245,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/ecommerce/activate") @@ -254,6 +264,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/ecommerce/activate") @@ -278,6 +289,7 @@ describe("EcommerceClient", () => { ], totals: { averageBasket: 3.4, ordersCount: 500, revenue: 1700 }, }; + server .mockEndpoint() .get("/ecommerce/attribution/metrics") @@ -320,6 +332,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/ecommerce/attribution/metrics") @@ -345,6 +358,7 @@ describe("EcommerceClient", () => { revenue: 1.1, newCustomersCount: 1.1, }; + server .mockEndpoint() .get("/ecommerce/attribution/metrics/email_campaign/sale") @@ -372,6 +386,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/ecommerce/attribution/metrics/email_campaign/conversionSourceId") @@ -406,6 +421,7 @@ describe("EcommerceClient", () => { }, ], }; + server .mockEndpoint() .get("/ecommerce/attribution/products/email_campaign/sale") @@ -439,6 +455,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/ecommerce/attribution/products/email_campaign/conversionSourceId") @@ -460,6 +477,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { code: "EUR" }; + server .mockEndpoint() .get("/ecommerce/config/displayCurrency") @@ -479,6 +497,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/ecommerce/config/displayCurrency") @@ -497,6 +516,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/ecommerce/config/displayCurrency") @@ -515,6 +535,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/ecommerce/config/displayCurrency") @@ -533,6 +554,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { code: "EUR" }; const rawResponseBody = { code: "EUR" }; + server .mockEndpoint() .post("/ecommerce/config/displayCurrency") @@ -555,6 +577,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { code: "code" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/ecommerce/config/displayCurrency") @@ -576,6 +599,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { code: "code" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/ecommerce/config/displayCurrency") @@ -597,6 +621,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { code: "code" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/ecommerce/config/displayCurrency") @@ -618,6 +643,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { code: "code" }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/ecommerce/config/displayCurrency") @@ -660,8 +686,8 @@ describe("EcommerceClient", () => { id: "order1803", identifiers: { ext_id: "ab12", loyalty_subscription_id: "1234" }, products: [ - { price: 100, productId: 21, quantity: 2, variantId: "P100" }, - { price: 100, productId: 21, quantity: 2, variantId: "P15756" }, + { price: 100, productId: 21, quantity: 2, quantityFloat: 0, variantId: "P100" }, + { price: 100, productId: 21, quantity: 0, quantityFloat: 2.52, variantId: "P15756" }, ], status: "complete", storeId: "123", @@ -669,6 +695,7 @@ describe("EcommerceClient", () => { }, ], }; + server.mockEndpoint().get("/orders").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.ecommerce.getOrders(); @@ -701,12 +728,14 @@ describe("EcommerceClient", () => { price: 100, productId: 21, quantity: 2, + quantityFloat: 0, variantId: "P100", }, { price: 100, productId: 21, - quantity: 2, + quantity: 0, + quantityFloat: 2.52, variantId: "P15756", }, ], @@ -723,6 +752,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/orders").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -737,7 +767,7 @@ describe("EcommerceClient", () => { amount: 308.42, createdAt: "2021-07-29T20:59:23.383Z", id: "14", - products: [{ price: 99.99, productId: "P1", quantity: 10 }], + products: [{ price: 99.99, productId: "P1" }], status: "completed", updatedAt: "2021-07-30T10:59:23.383Z", }; @@ -752,7 +782,6 @@ describe("EcommerceClient", () => { { price: 99.99, productId: "P1", - quantity: 10, }, ], status: "completed", @@ -769,13 +798,14 @@ describe("EcommerceClient", () => { createdAt: "createdAt", id: "id", products: [ - { price: 1.1, productId: "productId", quantity: 1.1 }, - { price: 1.1, productId: "productId", quantity: 1.1 }, + { price: 1.1, productId: "productId" }, + { price: 1.1, productId: "productId" }, ], status: "status", updatedAt: "updatedAt", }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/orders/status") @@ -794,12 +824,10 @@ describe("EcommerceClient", () => { { price: 1.1, productId: "productId", - quantity: 1.1, }, { price: 1.1, productId: "productId", - quantity: 1.1, }, ], status: "status", @@ -817,13 +845,14 @@ describe("EcommerceClient", () => { amount: 308.42, createdAt: "2021-07-29T20:59:23.383Z", id: "14", - products: [{ price: 99.99, productId: "P1", quantity: 10 }], + products: [{ price: 99.99, productId: "P1" }], status: "completed", updatedAt: "2021-07-30T10:59:23.383Z", }, ], }; const rawResponseBody = { batchId: 1.1, count: 17655 }; + server .mockEndpoint() .post("/orders/status/batch") @@ -843,7 +872,6 @@ describe("EcommerceClient", () => { { price: 99.99, productId: "P1", - quantity: 10, }, ], status: "completed", @@ -867,8 +895,8 @@ describe("EcommerceClient", () => { createdAt: "createdAt", id: "id", products: [ - { price: 1.1, productId: "productId", quantity: 1.1 }, - { price: 1.1, productId: "productId", quantity: 1.1 }, + { price: 1.1, productId: "productId" }, + { price: 1.1, productId: "productId" }, ], status: "status", updatedAt: "updatedAt", @@ -878,8 +906,8 @@ describe("EcommerceClient", () => { createdAt: "createdAt", id: "id", products: [ - { price: 1.1, productId: "productId", quantity: 1.1 }, - { price: 1.1, productId: "productId", quantity: 1.1 }, + { price: 1.1, productId: "productId" }, + { price: 1.1, productId: "productId" }, ], status: "status", updatedAt: "updatedAt", @@ -887,6 +915,7 @@ describe("EcommerceClient", () => { ], }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/orders/status/batch") @@ -907,12 +936,10 @@ describe("EcommerceClient", () => { { price: 1.1, productId: "productId", - quantity: 1.1, }, { price: 1.1, productId: "productId", - quantity: 1.1, }, ], status: "status", @@ -926,12 +953,10 @@ describe("EcommerceClient", () => { { price: 1.1, productId: "productId", - quantity: 1.1, }, { price: 1.1, productId: "productId", - quantity: 1.1, }, ], status: "status", @@ -950,8 +975,10 @@ describe("EcommerceClient", () => { count: 2, products: [ { + brand: "Adidas", categories: ["279638835374", "279502848174"], createdAt: "2022-06-30T10:29:16.078Z", + description: "Shoes for sports", id: "P11", imageUrl: "http://mydomain.com/product-absoulte-url/img.jpeg", isDeleted: true, @@ -968,8 +995,10 @@ describe("EcommerceClient", () => { url: "https://mydomain.com/products/alpina-panoma-classic", }, { + brand: "Adidas", categories: ["2d79638835374", "27d9502848174"], createdAt: "2022-06-30T10:29:16.078Z", + description: "Shoes for sports", id: "P11", imageUrl: "http://mydomain.com/product-absoulte-url/img.jpeg", isDeleted: true, @@ -987,6 +1016,7 @@ describe("EcommerceClient", () => { }, ], }; + server.mockEndpoint().get("/products").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.ecommerce.getProducts(); @@ -994,8 +1024,10 @@ describe("EcommerceClient", () => { count: 2, products: [ { + brand: "Adidas", categories: ["279638835374", "279502848174"], createdAt: "2022-06-30T10:29:16.078Z", + description: "Shoes for sports", id: "P11", imageUrl: "http://mydomain.com/product-absoulte-url/img.jpeg", isDeleted: true, @@ -1015,8 +1047,10 @@ describe("EcommerceClient", () => { url: "https://mydomain.com/products/alpina-panoma-classic", }, { + brand: "Adidas", categories: ["2d79638835374", "27d9502848174"], createdAt: "2022-06-30T10:29:16.078Z", + description: "Shoes for sports", id: "P11", imageUrl: "http://mydomain.com/product-absoulte-url/img.jpeg", isDeleted: true, @@ -1044,6 +1078,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/products").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -1056,6 +1091,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { id: "P11", name: "Iphone 11" }; const rawResponseBody = { id: 21 }; + server .mockEndpoint() .post("/products") @@ -1079,6 +1115,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { id: "id", name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/products") @@ -1101,6 +1138,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { products: [{ id: "P11", name: "Iphone 11" }] }; const rawResponseBody = { createdCount: 2, updatedCount: 7 }; + server .mockEndpoint() .post("/products/batch") @@ -1134,6 +1172,7 @@ describe("EcommerceClient", () => { ], }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/products/batch") @@ -1164,8 +1203,10 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { + brand: "Adidas", categories: ["categories"], createdAt: "2017-05-12T12:30:00Z", + description: "Shoes for sports", id: "P11", imageUrl: "http://mydomain.com/product-absoulte-url/img.jpeg", isDeleted: true, @@ -1181,14 +1222,17 @@ describe("EcommerceClient", () => { stock: 100, url: "http://mydomain.com/product/electronics/product1", }; + server.mockEndpoint().get("/products/id").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.ecommerce.getProductInfo({ id: "id", }); expect(response).toEqual({ + brand: "Adidas", categories: ["categories"], createdAt: "2017-05-12T12:30:00Z", + description: "Shoes for sports", id: "P11", imageUrl: "http://mydomain.com/product-absoulte-url/img.jpeg", isDeleted: true, @@ -1214,6 +1258,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/products/id").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -1228,6 +1273,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/products/id").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -1262,6 +1308,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/products/id/alerts/back_in_stock") @@ -1284,6 +1331,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/products/id/alerts/back_in_stock") @@ -1306,6 +1354,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/products/id/alerts/back_in_stock") @@ -1328,6 +1377,7 @@ describe("EcommerceClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/products/id/alerts/back_in_stock") diff --git a/tests/wire/emailCampaigns.test.ts b/tests/wire/emailCampaigns.test.ts index cf7e061..fe1ffa4 100644 --- a/tests/wire/emailCampaigns.test.ts +++ b/tests/wire/emailCampaigns.test.ts @@ -12,6 +12,7 @@ describe("EmailCampaignsClient", () => { const rawResponseBody = { campaigns: [ { + attachmentFile: "http://mydomain.com/campaign/attachment/file.pdf", abTesting: true, id: 12, name: "EN - Sales Summer 2017", @@ -40,6 +41,7 @@ describe("EmailCampaignsClient", () => { sentDate: "2018-12-01T16:30:00Z", shareLink: "http://example.com/fhsgccc.html?t=9865448900", tag: "Newsletter", + tags: ["tag1", "tag2"], testSent: true, toField: "{FNAME} {LNAME}", utmCampaignValue: "myutm", @@ -142,6 +144,7 @@ describe("EmailCampaignsClient", () => { }, }, { + attachmentFile: "http://img.mailinblue.com/{clientID-campaignID}/attachments/{fileName}", abTesting: true, id: 22, name: "Weekly - 1", @@ -170,6 +173,7 @@ describe("EmailCampaignsClient", () => { sentDate: "2018-12-01T16:30:00Z", shareLink: "http://example.com/fhsgccc.html?t=9865448900", tag: "Newsletter", + tags: ["Newsletter", "Weekly"], testSent: false, toField: "{FNAME} {LNAME}", utmCampaignValue: "myutm", @@ -274,12 +278,14 @@ describe("EmailCampaignsClient", () => { ], count: 2, }; + server.mockEndpoint().get("/emailCampaigns").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.emailCampaigns.getEmailCampaigns(); expect(response).toEqual({ campaigns: [ { + attachmentFile: "http://mydomain.com/campaign/attachment/file.pdf", abTesting: true, id: 12, name: "EN - Sales Summer 2017", @@ -312,6 +318,7 @@ describe("EmailCampaignsClient", () => { sentDate: "2018-12-01T16:30:00Z", shareLink: "http://example.com/fhsgccc.html?t=9865448900", tag: "Newsletter", + tags: ["tag1", "tag2"], testSent: true, toField: "{FNAME} {LNAME}", utmCampaignValue: "myutm", @@ -422,6 +429,7 @@ describe("EmailCampaignsClient", () => { }, }, { + attachmentFile: "http://img.mailinblue.com/{clientID-campaignID}/attachments/{fileName}", abTesting: true, id: 22, name: "Weekly - 1", @@ -454,6 +462,7 @@ describe("EmailCampaignsClient", () => { sentDate: "2018-12-01T16:30:00Z", shareLink: "http://example.com/fhsgccc.html?t=9865448900", tag: "Newsletter", + tags: ["Newsletter", "Weekly"], testSent: false, toField: "{FNAME} {LNAME}", utmCampaignValue: "myutm", @@ -573,6 +582,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/emailCampaigns").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -585,6 +595,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "Newsletter - May 2017", sender: {} }; const rawResponseBody = { id: 5 }; + server .mockEndpoint() .post("/emailCampaigns") @@ -608,6 +619,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name", sender: {} }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/emailCampaigns") @@ -632,6 +644,7 @@ describe("EmailCampaignsClient", () => { const rawResponseBody = { url: "https://img.mailinblue.com/100000/images/rnb/original/62casdase8wewq9df1c2f27c.jpeg", }; + server .mockEndpoint() .post("/emailCampaigns/images") @@ -654,6 +667,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { imageUrl: "imageUrl" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/emailCampaigns/images") @@ -675,6 +689,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { + attachmentFile: "http://img.mailinblue.com/{clientID-campaignID}/attachments/{fileName}", abTesting: true, id: 22, name: "Weekly - 1", @@ -703,6 +718,7 @@ describe("EmailCampaignsClient", () => { sentDate: "2018-12-01T16:30:00Z", shareLink: "http://dhh.brevo.com/fhsgccc.html?t=9865448900", tag: "Newsletter", + tags: ["Newsletter", "Weekly"], testSent: false, toField: "{FNAME} {LNAME}", utmCampaignValue: "myutm", @@ -794,6 +810,7 @@ describe("EmailCampaignsClient", () => { }, }, }; + server .mockEndpoint() .get("/emailCampaigns/1000000") @@ -806,6 +823,7 @@ describe("EmailCampaignsClient", () => { campaignId: 1000000, }); expect(response).toEqual({ + attachmentFile: "http://img.mailinblue.com/{clientID-campaignID}/attachments/{fileName}", abTesting: true, id: 22, name: "Weekly - 1", @@ -838,6 +856,7 @@ describe("EmailCampaignsClient", () => { sentDate: "2018-12-01T16:30:00Z", shareLink: "http://dhh.brevo.com/fhsgccc.html?t=9865448900", tag: "Newsletter", + tags: ["Newsletter", "Weekly"], testSent: false, toField: "{FNAME} {LNAME}", utmCampaignValue: "myutm", @@ -985,6 +1004,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/emailCampaigns/1000000") @@ -1005,6 +1025,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/emailCampaigns/1000000") @@ -1044,6 +1065,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/emailCampaigns/1000000") @@ -1065,6 +1087,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/emailCampaigns/1000000") @@ -1098,6 +1121,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/emailCampaigns/1000000") @@ -1118,6 +1142,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/emailCampaigns/1000000") @@ -1163,6 +1188,7 @@ describe("EmailCampaignsClient", () => { winningVersion: "B", winningVersionRate: "0%", }; + server .mockEndpoint() .get("/emailCampaigns/1000000/abTestCampaignResult") @@ -1241,6 +1267,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/emailCampaigns/1000000/abTestCampaignResult") @@ -1261,6 +1288,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/emailCampaigns/1000000/abTestCampaignResult") @@ -1281,6 +1309,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { recipientsType: "all" }; const rawResponseBody = { processId: 78 }; + server .mockEndpoint() .post("/emailCampaigns/1000000/exportRecipients") @@ -1304,6 +1333,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { recipientsType: "all" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/emailCampaigns/1000000/exportRecipients") @@ -1326,6 +1356,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { recipientsType: "all" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/emailCampaigns/1000000/exportRecipients") @@ -1360,6 +1391,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/emailCampaigns/1000000/sendNow") @@ -1380,6 +1412,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/emailCampaigns/1000000/sendNow") @@ -1400,6 +1433,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/emailCampaigns/1000000/sendNow") @@ -1450,6 +1484,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { email: { body: "body", to: ["to", "to"] } }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/emailCampaigns/1000000/sendReport") @@ -1477,6 +1512,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { email: { body: "body", to: ["to", "to"] } }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/emailCampaigns/1000000/sendReport") @@ -1524,6 +1560,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/emailCampaigns/1000000/sendTest") @@ -1546,6 +1583,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/emailCampaigns/1000000/sendTest") @@ -1570,6 +1608,7 @@ describe("EmailCampaignsClient", () => { const rawResponseBody = { sharedUrl: "https://my.brevo.com/pt2YU7R5W_guXlowgumy_VX4pFsKu._zd0Gjj96x1_GMmzc1Qps5ZIpj6nx-", }; + server .mockEndpoint() .get("/emailCampaigns/1000000/sharedUrl") @@ -1591,6 +1630,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/emailCampaigns/1000000/sharedUrl") @@ -1611,6 +1651,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/emailCampaigns/1000000/sharedUrl") @@ -1631,6 +1672,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .get("/emailCampaigns/1000000/sharedUrl") @@ -1671,6 +1713,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/emailCampaigns/1000000/status") @@ -1693,6 +1736,7 @@ describe("EmailCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/emailCampaigns/1000000/status") diff --git a/tests/wire/event.test.ts b/tests/wire/event.test.ts index 80ed7f0..0cc7b84 100644 --- a/tests/wire/event.test.ts +++ b/tests/wire/event.test.ts @@ -5,6 +5,91 @@ import { BrevoClient } from "../../src/Client"; import { mockServerPool } from "../mock-server/MockServerPool"; describe("EventClient", () => { + test("getEvents (1)", async () => { + const server = mockServerPool.createServer(); + const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + events: [ + { + contact_id: 211, + event_date: "2024-02-06T20:59:23Z", + event_name: "order_created", + event_filter_id: "abc123", + source: "api", + object_type: "subscription", + event_properties: { duration: 142, video_title: "Brevo — The most approachable CRM suite" }, + contact_properties: { AGE: 32, GENDER: "FEMALE" }, + }, + ], + count: 2, + }; + + server.mockEndpoint().get("/events").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.event.getEvents(); + expect(response).toEqual({ + events: [ + { + contact_id: 211, + event_date: "2024-02-06T20:59:23Z", + event_name: "order_created", + event_filter_id: "abc123", + source: "api", + object_type: "subscription", + event_properties: { + duration: 142, + video_title: "Brevo \u2014 The most approachable CRM suite", + }, + contact_properties: { + AGE: 32, + GENDER: "FEMALE", + }, + }, + ], + count: 2, + }); + }); + + test("getEvents (2)", async () => { + const server = mockServerPool.createServer(); + const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + + server.mockEndpoint().get("/events").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.event.getEvents(); + }).rejects.toThrow(Brevo.BadRequestError); + }); + + test("getEvents (3)", async () => { + const server = mockServerPool.createServer(); + const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + + server.mockEndpoint().get("/events").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.event.getEvents(); + }).rejects.toThrow(Brevo.UnauthorizedError); + }); + + test("getEvents (4)", async () => { + const server = mockServerPool.createServer(); + const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + + server.mockEndpoint().get("/events").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.event.getEvents(); + }).rejects.toThrow(Brevo.InternalServerError); + }); + test("createEvent (1)", async () => { const server = mockServerPool.createServer(); const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); @@ -24,6 +109,7 @@ describe("EventClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { event_name: "event_name", identifiers: {} }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/events") @@ -46,6 +132,7 @@ describe("EventClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { event_name: "event_name", identifiers: {} }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/events") @@ -62,4 +149,98 @@ describe("EventClient", () => { }); }).rejects.toThrow(Brevo.UnauthorizedError); }); + + test("createBatchEvents (1)", async () => { + const server = mockServerPool.createServer(); + const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = [{ event_name: "order_created", identifiers: {} }]; + const rawResponseBody = { + message: "Batch accepted. Valid events have been added to the processing queue.", + count: 7, + }; + + server + .mockEndpoint() + .post("/events/batch") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.event.createBatchEvents([ + { + event_name: "order_created", + identifiers: {}, + }, + ]); + expect(response).toEqual({ + message: "Batch accepted. Valid events have been added to the processing queue.", + count: 7, + }); + }); + + test("createBatchEvents (2)", async () => { + const server = mockServerPool.createServer(); + const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = [ + { event_name: "event_name", identifiers: {} }, + { event_name: "event_name", identifiers: {} }, + ]; + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .post("/events/batch") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.event.createBatchEvents([ + { + event_name: "event_name", + identifiers: {}, + }, + { + event_name: "event_name", + identifiers: {}, + }, + ]); + }).rejects.toThrow(Brevo.BadRequestError); + }); + + test("createBatchEvents (3)", async () => { + const server = mockServerPool.createServer(); + const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = [ + { event_name: "event_name", identifiers: {} }, + { event_name: "event_name", identifiers: {} }, + ]; + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .post("/events/batch") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.event.createBatchEvents([ + { + event_name: "event_name", + identifiers: {}, + }, + { + event_name: "event_name", + identifiers: {}, + }, + ]); + }).rejects.toThrow(Brevo.UnauthorizedError); + }); }); diff --git a/tests/wire/externalFeeds.test.ts b/tests/wire/externalFeeds.test.ts index 0022c4a..810d814 100644 --- a/tests/wire/externalFeeds.test.ts +++ b/tests/wire/externalFeeds.test.ts @@ -62,6 +62,7 @@ describe("ExternalFeedsClient", () => { }, ], }; + server.mockEndpoint().get("/feeds").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.externalFeeds.getAllExternalFeeds({ @@ -144,6 +145,7 @@ describe("ExternalFeedsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/feeds").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -156,6 +158,7 @@ describe("ExternalFeedsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/feeds").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -174,6 +177,7 @@ describe("ExternalFeedsClient", () => { cache: true, }; const rawResponseBody = { id: "b1c2d3e4-f5a6-47b8-89c0-d1e2f3a4b5c6" }; + server .mockEndpoint() .post("/feeds") @@ -206,6 +210,7 @@ describe("ExternalFeedsClient", () => { cache: true, }; const rawResponseBody = { id: "b1c2d3e4-f5a6-47b8-89c0-d1e2f3a4b5c6" }; + server .mockEndpoint() .post("/feeds") @@ -238,6 +243,7 @@ describe("ExternalFeedsClient", () => { cache: true, }; const rawResponseBody = { id: "b1c2d3e4-f5a6-47b8-89c0-d1e2f3a4b5c6" }; + server .mockEndpoint() .post("/feeds") @@ -264,6 +270,7 @@ describe("ExternalFeedsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name", url: "url" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/feeds") @@ -298,6 +305,7 @@ describe("ExternalFeedsClient", () => { createdAt: "2025-09-18T13:29:27Z", modifiedAt: "2025-09-18T13:29:27Z", }; + server .mockEndpoint() .get("/feeds/b1c2d3e4-f5a6-47b8-89c0-d1e2f3a4b5c6") @@ -341,6 +349,7 @@ describe("ExternalFeedsClient", () => { createdAt: "2025-09-17T16:03:25Z", modifiedAt: "2025-09-17T16:03:25Z", }; + server .mockEndpoint() .get("/feeds/b1c2d3e4-f5a6-47b8-89c0-d1e2f3a4b5c6") @@ -384,6 +393,7 @@ describe("ExternalFeedsClient", () => { createdAt: "2025-09-05T09:06:42Z", modifiedAt: "2025-09-05T09:06:42Z", }; + server .mockEndpoint() .get("/feeds/b1c2d3e4-f5a6-47b8-89c0-d1e2f3a4b5c6") @@ -415,6 +425,7 @@ describe("ExternalFeedsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/feeds/uuid").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -429,6 +440,7 @@ describe("ExternalFeedsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/feeds/uuid").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -586,6 +598,7 @@ describe("ExternalFeedsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/feeds/uuid") @@ -607,6 +620,7 @@ describe("ExternalFeedsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/feeds/uuid") @@ -645,6 +659,7 @@ describe("ExternalFeedsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/feeds/uuid").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -659,6 +674,7 @@ describe("ExternalFeedsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/feeds/uuid").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); await expect(async () => { diff --git a/tests/wire/files.test.ts b/tests/wire/files.test.ts index 98795fa..dff749e 100644 --- a/tests/wire/files.test.ts +++ b/tests/wire/files.test.ts @@ -20,6 +20,7 @@ describe("FilesClient", () => { size: 10, }, ]; + server.mockEndpoint().get("/crm/files").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.files.getAllFiles(); @@ -41,6 +42,7 @@ describe("FilesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/crm/files").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -53,6 +55,7 @@ describe("FilesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { fileUrl: "https://storage.googleapis.com/brevo-app-crm.......-sample.pdf" }; + server.mockEndpoint().get("/crm/files/id").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.files.downloadAFile({ @@ -68,6 +71,7 @@ describe("FilesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/crm/files/id").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -82,6 +86,7 @@ describe("FilesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/crm/files/id").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -108,6 +113,7 @@ describe("FilesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/crm/files/id").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -122,6 +128,7 @@ describe("FilesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/crm/files/id").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -144,6 +151,7 @@ describe("FilesClient", () => { name: "example.png", size: 10, }; + server.mockEndpoint().get("/crm/files/id/data").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.files.getFileDetails({ @@ -165,6 +173,7 @@ describe("FilesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/crm/files/id/data").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -179,6 +188,7 @@ describe("FilesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/crm/files/id/data").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); await expect(async () => { diff --git a/tests/wire/inboundParsing.test.ts b/tests/wire/inboundParsing.test.ts index 4445cc0..aeb985f 100644 --- a/tests/wire/inboundParsing.test.ts +++ b/tests/wire/inboundParsing.test.ts @@ -25,6 +25,7 @@ describe("InboundParsingClient", () => { }, ], }; + server.mockEndpoint().get("/inbound/events").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.inboundParsing.getInboundEmailEvents(); @@ -51,6 +52,7 @@ describe("InboundParsingClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/inbound/events").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -76,6 +78,7 @@ describe("InboundParsingClient", () => { sender: "alice@example.com", subject: "Re: Question about your API", }; + server .mockEndpoint() .get("/inbound/events/uuid") @@ -123,6 +126,7 @@ describe("InboundParsingClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/inbound/events/uuid") diff --git a/tests/wire/masterAccount.test.ts b/tests/wire/masterAccount.test.ts index bf32fb1..770a3c8 100644 --- a/tests/wire/masterAccount.test.ts +++ b/tests/wire/masterAccount.test.ts @@ -10,6 +10,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { groupName: "My group" }; const rawResponseBody = { id: "659xxxxxxxxxxxxxxxx6ef9c8" }; + server .mockEndpoint() .post("/corporate/group") @@ -32,6 +33,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { groupName: "groupName" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/corporate/group") @@ -73,6 +75,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { subAccountIds: [1000000, 1000000] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/corporate/group/unlink/groupId/subAccounts") @@ -105,6 +108,7 @@ describe("MasterAccountClient", () => { { email: "your-user@your-org.com", firstName: "firstName", lastName: "lastName" }, ], }; + server .mockEndpoint() .get("/corporate/group/id") @@ -167,6 +171,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/corporate/group/id") @@ -200,6 +205,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/corporate/group/id") @@ -224,6 +230,7 @@ describe("MasterAccountClient", () => { { groupName: "My group 2", id: "a5b192a709d6ed67ef8fd922" }, { groupName: "My group 3", id: "bbb142c709d6ed67ef1cd910" }, ]; + server.mockEndpoint().get("/corporate/groups").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.masterAccount.getSubAccountGroups(); @@ -283,6 +290,7 @@ describe("MasterAccountClient", () => { }, ], }; + server .mockEndpoint() .get("/corporate/invited/users") @@ -344,6 +352,7 @@ describe("MasterAccountClient", () => { { domain: "example.com", ip: "192.168.1.1", transactional: true }, { domain: "example.com", ip: "192.168.1.2", transactional: false }, ]; + server.mockEndpoint().get("/corporate/ip").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.masterAccount.listOfAllIPs(); @@ -398,6 +407,7 @@ describe("MasterAccountClient", () => { }, timezone: "Europe/Paris", }; + server .mockEndpoint() .get("/corporate/masterAccount") @@ -480,6 +490,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/corporate/masterAccount") @@ -498,6 +509,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { email: "vipin+ent-user@brevo.com" }; const rawResponseBody = { token: "5cadaxxxxxxxxxxxxxxxxxxxx5a179f85a0" }; + server .mockEndpoint() .post("/corporate/ssoToken") @@ -520,6 +532,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { email: "email" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/corporate/ssoToken") @@ -541,6 +554,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { email: "email" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/corporate/ssoToken") @@ -578,6 +592,7 @@ describe("MasterAccountClient", () => { { active: true, companyName: "Company3", createdAt: 1614713641, groups: [{}], id: 3524191 }, ], }; + server .mockEndpoint() .get("/corporate/subAccount") @@ -632,6 +647,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/corporate/subAccount") @@ -659,6 +675,7 @@ describe("MasterAccountClient", () => { timezone: "Europe/Paris", }; const rawResponseBody = { id: 4109344 }; + server .mockEndpoint() .post("/corporate/subAccount") @@ -685,6 +702,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { companyName: "companyName", email: "email" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/corporate/subAccount") @@ -707,6 +725,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { ids: [234322, 325553, 893432], ip: "103.11.32.88" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/corporate/subAccount/ip/associate") @@ -730,6 +749,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { ids: [1000000, 1000000], ip: "ip" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/corporate/subAccount/ip/associate") @@ -772,6 +792,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { ids: [1000000, 1000000], ip: "ip" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/corporate/subAccount/ip/dissociate") @@ -794,6 +815,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { id: 3232323, name: "My Api Key" }; const rawResponseBody = { key: "xkeysib-21881axxxxxcc92e04-mIrexxxx7z", status: "success" }; + server .mockEndpoint() .post("/corporate/subAccount/key") @@ -818,6 +840,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { id: 1000000, name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/corporate/subAccount/key") @@ -840,6 +863,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { id: 3232323 }; const rawResponseBody = { token: "5cadaxxxxxxxxxxxxxxxxxxxx5a179f85a0" }; + server .mockEndpoint() .post("/corporate/subAccount/ssoToken") @@ -862,6 +886,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { id: 1000000 }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/corporate/subAccount/ssoToken") @@ -883,6 +908,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { id: 1000000 }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/corporate/subAccount/ssoToken") @@ -928,6 +954,7 @@ describe("MasterAccountClient", () => { planType: "paid", }, }; + server .mockEndpoint() .get("/corporate/subAccount/1000000") @@ -1004,6 +1031,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/corporate/subAccount/1000000") @@ -1036,6 +1064,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/corporate/subAccount/1000000") @@ -1056,6 +1085,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/corporate/subAccount/1000000") @@ -1106,6 +1136,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/corporate/subAccount/1000000/applications/toggle") @@ -1127,6 +1158,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/corporate/subAccount/1000000/applications/toggle") @@ -1183,6 +1215,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/corporate/subAccount/1000000/plan") @@ -1204,6 +1237,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/corporate/subAccount/1000000/plan") @@ -1260,6 +1294,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/corporate/subAccounts/plan") @@ -1279,6 +1314,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/corporate/subAccounts/plan") @@ -1298,6 +1334,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { all_features_access: true, email: "inviteuser@example.com", privileges: [{}] }; const rawResponseBody = { id: "659xxxxxxxxxxxxxxxx6ef9c8" }; + server .mockEndpoint() .post("/corporate/user/invitation/send") @@ -1322,6 +1359,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { all_features_access: true, email: "email", privileges: [{}, {}] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/corporate/user/invitation/send") @@ -1345,6 +1383,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "Invitation resent successfully" }; + server .mockEndpoint() .put("/corporate/user/invitation/resend/email") @@ -1367,6 +1406,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/corporate/user/invitation/resend/email") @@ -1400,6 +1440,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/corporate/user/revoke/email") @@ -1437,6 +1478,7 @@ describe("MasterAccountClient", () => { ], status: "active", }; + server .mockEndpoint() .get("/corporate/user/email/permissions") @@ -1479,6 +1521,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/corporate/user/email/permissions") @@ -1570,6 +1613,7 @@ describe("MasterAccountClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { all_features_access: true, privileges: [{}, {}] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/corporate/user/email/permissions") diff --git a/tests/wire/notes.test.ts b/tests/wire/notes.test.ts index 545c01c..419d88f 100644 --- a/tests/wire/notes.test.ts +++ b/tests/wire/notes.test.ts @@ -26,6 +26,7 @@ describe("NotesClient", () => { updatedAt: "2017-05-01T17:05:03Z", }, ]; + server.mockEndpoint().get("/crm/notes").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.notes.getAllNotes(); @@ -55,6 +56,7 @@ describe("NotesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/crm/notes").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -67,6 +69,7 @@ describe("NotesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { text: "In communication with client_dev for resolution of queries." }; const rawResponseBody = { id: "61a5cd07ca1347c82306ad09" }; + server .mockEndpoint() .post("/crm/notes") @@ -89,6 +92,7 @@ describe("NotesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { text: "x" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/crm/notes") @@ -110,6 +114,7 @@ describe("NotesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { text: "x" }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/crm/notes") @@ -145,6 +150,7 @@ describe("NotesClient", () => { text: "In communication with client_dev for resolution of queries.", updatedAt: "2017-05-01T17:05:03Z", }; + server.mockEndpoint().get("/crm/notes/id").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.notes.getANote({ @@ -174,6 +180,7 @@ describe("NotesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/crm/notes/id").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -188,6 +195,7 @@ describe("NotesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/crm/notes/id").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -214,6 +222,7 @@ describe("NotesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/crm/notes/id").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -228,6 +237,7 @@ describe("NotesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/crm/notes/id").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -258,6 +268,7 @@ describe("NotesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { text: "x" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .patch("/crm/notes/id") @@ -282,6 +293,7 @@ describe("NotesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { text: "x" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .patch("/crm/notes/id") @@ -306,6 +318,7 @@ describe("NotesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { text: "x" }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .patch("/crm/notes/id") diff --git a/tests/wire/payments.test.ts b/tests/wire/payments.test.ts index 8e9056b..8ca42e3 100644 --- a/tests/wire/payments.test.ts +++ b/tests/wire/payments.test.ts @@ -14,6 +14,7 @@ describe("PaymentsClient", () => { reference: "Invoice #INV0001", }; const rawResponseBody = { id: 122, url: "https://pay.brevo.com/payment/6d4ec0b2b48ef803df4103ve" }; + server .mockEndpoint() .post("/payments/requests") @@ -46,6 +47,7 @@ describe("PaymentsClient", () => { reference: "reference", }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/payments/requests") @@ -76,6 +78,7 @@ describe("PaymentsClient", () => { reference: "reference", }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/payments/requests") @@ -106,6 +109,7 @@ describe("PaymentsClient", () => { reference: "reference", }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/payments/requests") @@ -140,6 +144,7 @@ describe("PaymentsClient", () => { reference: "Invoice #INV0001\n", status: "paid", }; + server .mockEndpoint() .get("/payments/requests/050db7b0-9bb7-4c1e-9c68-5a8dace8c1dc") @@ -175,6 +180,7 @@ describe("PaymentsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/payments/requests/id") @@ -195,6 +201,7 @@ describe("PaymentsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/payments/requests/id") @@ -215,6 +222,7 @@ describe("PaymentsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/payments/requests/id") @@ -235,6 +243,7 @@ describe("PaymentsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/payments/requests/id") @@ -272,6 +281,7 @@ describe("PaymentsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/payments/requests/id") @@ -292,6 +302,7 @@ describe("PaymentsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/payments/requests/id") @@ -312,6 +323,7 @@ describe("PaymentsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/payments/requests/id") diff --git a/tests/wire/process.test.ts b/tests/wire/process.test.ts index fdb41ab..141be90 100644 --- a/tests/wire/process.test.ts +++ b/tests/wire/process.test.ts @@ -41,6 +41,7 @@ describe("ProcessClient", () => { }, ], }; + server.mockEndpoint().get("/processes").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.process.getProcesses(); @@ -83,6 +84,7 @@ describe("ProcessClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/processes").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -115,6 +117,7 @@ describe("ProcessClient", () => { created_at: "2024-01-15T10:30:00Z", completed_at: "2024-01-15T10:32:15Z", }; + server.mockEndpoint().get("/processes/1000000").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.process.getProcess({ @@ -160,6 +163,7 @@ describe("ProcessClient", () => { created_at: "2024-01-15T10:30:00Z", completed_at: "2024-01-15T10:32:15Z", }; + server.mockEndpoint().get("/processes/1000000").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.process.getProcess({ @@ -207,6 +211,7 @@ describe("ProcessClient", () => { created_at: "2024-01-15T10:30:00Z", completed_at: "2024-01-15T10:32:15Z", }; + server.mockEndpoint().get("/processes/1000000").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.process.getProcess({ @@ -263,6 +268,7 @@ describe("ProcessClient", () => { created_at: "2024-01-15T10:30:00Z", completed_at: "2024-01-15T10:32:15Z", }; + server.mockEndpoint().get("/processes/1000000").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.process.getProcess({ @@ -299,6 +305,7 @@ describe("ProcessClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/processes/1000000").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -313,6 +320,7 @@ describe("ProcessClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/processes/1000000").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); await expect(async () => { diff --git a/tests/wire/program.test.ts b/tests/wire/program.test.ts index 44e2bcc..fe78dfd 100644 --- a/tests/wire/program.test.ts +++ b/tests/wire/program.test.ts @@ -27,6 +27,7 @@ describe("ProgramClient", () => { }, ], }; + server .mockEndpoint() .get("/loyalty/config/programs") @@ -63,6 +64,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/config/programs") @@ -81,6 +83,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/config/programs") @@ -99,6 +102,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/config/programs") @@ -117,6 +121,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/config/programs") @@ -135,6 +140,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .get("/loyalty/config/programs") @@ -153,6 +159,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/config/programs") @@ -184,6 +191,7 @@ describe("ProgramClient", () => { subscriptionPoolId: "subscriptionPoolId", updatedAt: "updatedAt", }; + server .mockEndpoint() .post("/loyalty/config/programs") @@ -219,6 +227,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/config/programs") @@ -240,6 +249,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/config/programs") @@ -261,6 +271,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/config/programs") @@ -282,6 +293,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/config/programs") @@ -303,6 +315,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/config/programs") @@ -337,6 +350,7 @@ describe("ProgramClient", () => { subscriptionPoolId: "subscriptionPoolId", updatedAt: "updatedAt", }; + server .mockEndpoint() .get("/loyalty/config/programs/pid") @@ -371,6 +385,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/config/programs/pid") @@ -391,6 +406,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/config/programs/pid") @@ -411,6 +427,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/config/programs/pid") @@ -431,6 +448,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .get("/loyalty/config/programs/pid") @@ -451,6 +469,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/config/programs/pid") @@ -484,6 +503,7 @@ describe("ProgramClient", () => { subscriptionPoolId: "subscriptionPoolId", updatedAt: "updatedAt", }; + server .mockEndpoint() .put("/loyalty/config/programs/pid") @@ -520,6 +540,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/config/programs/pid") @@ -542,6 +563,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/config/programs/pid") @@ -564,6 +586,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/config/programs/pid") @@ -586,6 +609,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .put("/loyalty/config/programs/pid") @@ -608,6 +632,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .put("/loyalty/config/programs/pid") @@ -630,6 +655,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/config/programs/pid") @@ -664,6 +690,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/config/programs/pid") @@ -684,6 +711,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/config/programs/pid") @@ -704,6 +732,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/config/programs/pid") @@ -724,6 +753,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .delete("/loyalty/config/programs/pid") @@ -744,6 +774,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/config/programs/pid") @@ -777,6 +808,7 @@ describe("ProgramClient", () => { subscriptionPoolId: "subscriptionPoolId", updatedAt: "updatedAt", }; + server .mockEndpoint() .patch("/loyalty/config/programs/pid") @@ -812,6 +844,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .patch("/loyalty/config/programs/pid") @@ -833,6 +866,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .patch("/loyalty/config/programs/pid") @@ -854,6 +888,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .patch("/loyalty/config/programs/pid") @@ -875,6 +910,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .patch("/loyalty/config/programs/pid") @@ -896,6 +932,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .patch("/loyalty/config/programs/pid") @@ -917,6 +954,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .patch("/loyalty/config/programs/pid") @@ -965,6 +1003,7 @@ describe("ProgramClient", () => { }, ], }; + server .mockEndpoint() .get("/loyalty/config/programs/pid/account-info") @@ -1025,6 +1064,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/config/programs/pid/account-info") @@ -1045,6 +1085,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/config/programs/pid/account-info") @@ -1065,6 +1106,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/config/programs/pid/account-info") @@ -1085,6 +1127,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .get("/loyalty/config/programs/pid/account-info") @@ -1105,6 +1148,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/config/programs/pid/account-info") @@ -1120,6 +1164,151 @@ describe("ProgramClient", () => { }).rejects.toThrow(Brevo.InternalServerError); }); + test("deleteContactSubscription (1)", async () => { + const server = mockServerPool.createServer(); + const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + server.mockEndpoint().delete("/loyalty/config/programs/pid/contact/1").respondWith().statusCode(200).build(); + + const response = await client.program.deleteContactSubscription({ + pid: "pid", + cid: 1, + }); + expect(response).toEqual(undefined); + }); + + test("deleteContactSubscription (2)", async () => { + const server = mockServerPool.createServer(); + const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .delete("/loyalty/config/programs/pid/contact/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.program.deleteContactSubscription({ + pid: "pid", + cid: 1, + }); + }).rejects.toThrow(Brevo.BadRequestError); + }); + + test("deleteContactSubscription (3)", async () => { + const server = mockServerPool.createServer(); + const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .delete("/loyalty/config/programs/pid/contact/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.program.deleteContactSubscription({ + pid: "pid", + cid: 1, + }); + }).rejects.toThrow(Brevo.UnauthorizedError); + }); + + test("deleteContactSubscription (4)", async () => { + const server = mockServerPool.createServer(); + const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .delete("/loyalty/config/programs/pid/contact/1") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.program.deleteContactSubscription({ + pid: "pid", + cid: 1, + }); + }).rejects.toThrow(Brevo.ForbiddenError); + }); + + test("deleteContactSubscription (5)", async () => { + const server = mockServerPool.createServer(); + const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .delete("/loyalty/config/programs/pid/contact/1") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.program.deleteContactSubscription({ + pid: "pid", + cid: 1, + }); + }).rejects.toThrow(Brevo.NotFoundError); + }); + + test("deleteContactSubscription (6)", async () => { + const server = mockServerPool.createServer(); + const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { message: "message" }; + + server + .mockEndpoint() + .delete("/loyalty/config/programs/pid/contact/1") + .respondWith() + .statusCode(422) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.program.deleteContactSubscription({ + pid: "pid", + cid: 1, + }); + }).rejects.toThrow(Brevo.UnprocessableEntityError); + }); + + test("deleteContactSubscription (7)", async () => { + const server = mockServerPool.createServer(); + const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + + server + .mockEndpoint() + .delete("/loyalty/config/programs/pid/contact/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.program.deleteContactSubscription({ + pid: "pid", + cid: 1, + }); + }).rejects.toThrow(Brevo.InternalServerError); + }); + test("publishLoyaltyProgram (1)", async () => { const server = mockServerPool.createServer(); const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); @@ -1137,6 +1326,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/config/programs/pid/publish") @@ -1157,6 +1347,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/config/programs/pid/publish") @@ -1177,6 +1368,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/config/programs/pid/publish") @@ -1197,6 +1389,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/config/programs/pid/publish") @@ -1217,6 +1410,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/config/programs/pid/publish") @@ -1243,6 +1437,7 @@ describe("ProgramClient", () => { ownerContactId: 1, updatedAt: "updatedAt", }; + server .mockEndpoint() .post("/loyalty/config/programs/pid/subscription-members") @@ -1270,6 +1465,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { memberContactIds: [1, 1] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/config/programs/pid/subscription-members") @@ -1292,6 +1488,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { memberContactIds: [1, 1] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/config/programs/pid/subscription-members") @@ -1314,6 +1511,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { memberContactIds: [1, 1] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/config/programs/pid/subscription-members") @@ -1336,6 +1534,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { memberContactIds: [1, 1] }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/config/programs/pid/subscription-members") @@ -1358,6 +1557,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { memberContactIds: [1, 1] }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/config/programs/pid/subscription-members") @@ -1380,6 +1580,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { memberContactIds: [1, 1] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/config/programs/pid/subscription-members") @@ -1420,6 +1621,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/config/programs/pid/subscription-members") @@ -1441,6 +1643,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/config/programs/pid/subscription-members") @@ -1462,6 +1665,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/config/programs/pid/subscription-members") @@ -1483,6 +1687,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/config/programs/pid/subscription-members") @@ -1504,6 +1709,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .delete("/loyalty/config/programs/pid/subscription-members") @@ -1525,6 +1731,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/config/programs/pid/subscription-members") @@ -1554,6 +1761,7 @@ describe("ProgramClient", () => { updatedAt: "updatedAt", versionId: 1, }; + server .mockEndpoint() .post("/loyalty/config/programs/pid/subscriptions") @@ -1583,6 +1791,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { contactId: 1 }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/config/programs/pid/subscriptions") @@ -1605,6 +1814,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { contactId: 1 }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/config/programs/pid/subscriptions") @@ -1627,6 +1837,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { contactId: 1 }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/config/programs/pid/subscriptions") @@ -1649,6 +1860,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { contactId: 1 }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/config/programs/pid/subscriptions") @@ -1671,6 +1883,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { contactId: 1 }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/config/programs/pid/subscriptions") @@ -1693,6 +1906,7 @@ describe("ProgramClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { contactId: 1 }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/config/programs/pid/subscriptions") diff --git a/tests/wire/reward.test.ts b/tests/wire/reward.test.ts index d3a03e2..476fc18 100644 --- a/tests/wire/reward.test.ts +++ b/tests/wire/reward.test.ts @@ -10,6 +10,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { count: 1000000 }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/code-pools/cpid/codes-count") @@ -32,6 +33,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/code-pools/cpid/codes-count") @@ -53,6 +55,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/code-pools/cpid/codes-count") @@ -74,6 +77,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/code-pools/cpid/codes-count") @@ -95,6 +99,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/code-pools/cpid/codes-count") @@ -116,6 +121,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/code-pools/cpid/codes-count") @@ -152,6 +158,7 @@ describe("RewardClient", () => { ], totalCount: 1, }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/offers") @@ -186,6 +193,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/offers") @@ -206,6 +214,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/offers") @@ -226,6 +235,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/offers") @@ -246,6 +256,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/offers") @@ -266,6 +277,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/offers") @@ -286,6 +298,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/offers") @@ -315,6 +328,7 @@ describe("RewardClient", () => { publicName: "publicName", updatedAt: "updatedAt", }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/offers") @@ -345,6 +359,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/offers") @@ -367,6 +382,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/offers") @@ -389,6 +405,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/offers") @@ -411,6 +428,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/offers") @@ -445,6 +463,7 @@ describe("RewardClient", () => { updatedAt: "2024-01-15T09:30:00Z", value: 1.1, }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/attribute") @@ -480,6 +499,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { rewardId: "rewardId" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/attribute") @@ -502,6 +522,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { rewardId: "rewardId" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/attribute") @@ -524,6 +545,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { rewardId: "rewardId" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/attribute") @@ -546,6 +568,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { rewardId: "rewardId" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/attribute") @@ -568,6 +591,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { rewardId: "rewardId" }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/attribute") @@ -590,6 +614,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { rewardId: "rewardId" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/attribute") @@ -627,6 +652,7 @@ describe("RewardClient", () => { status: "status", updatedAt: "2024-01-15T09:30:00Z", }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/redeem") @@ -664,6 +690,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/redeem") @@ -685,6 +712,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/redeem") @@ -706,6 +734,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/redeem") @@ -727,6 +756,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/redeem") @@ -748,6 +778,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/redeem") @@ -769,6 +800,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/redeem") @@ -790,6 +822,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/redeem") @@ -811,6 +844,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/redeem") @@ -847,6 +881,7 @@ describe("RewardClient", () => { status: "status", updatedAt: "2024-01-15T09:30:00Z", }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/redeem/tid/complete") @@ -884,6 +919,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/redeem/tid/complete") @@ -905,6 +941,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/redeem/tid/complete") @@ -926,6 +963,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/redeem/tid/complete") @@ -947,6 +985,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/redeem/tid/complete") @@ -968,6 +1007,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/redeem/tid/complete") @@ -989,6 +1029,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/redeem/tid/complete") @@ -1010,6 +1051,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/redeem/tid/complete") @@ -1031,6 +1073,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/redeem/tid/complete") @@ -1069,6 +1112,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/offer/programs/pid/rewards/revoke") @@ -1089,6 +1133,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/offer/programs/pid/rewards/revoke") @@ -1109,6 +1154,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { authorize: true }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/validate") @@ -1131,6 +1177,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/validate") @@ -1152,6 +1199,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/validate") @@ -1173,6 +1221,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/validate") @@ -1194,6 +1243,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/validate") @@ -1215,6 +1265,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/validate") @@ -1236,6 +1287,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/offer/programs/pid/rewards/validate") @@ -1330,6 +1382,7 @@ describe("RewardClient", () => { value: 1.1, valueType: "valueType", }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/rewards/rid") @@ -1443,6 +1496,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/rewards/rid") @@ -1464,6 +1518,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/rewards/rid") @@ -1485,6 +1540,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/rewards/rid") @@ -1506,6 +1562,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/rewards/rid") @@ -1527,6 +1584,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/rewards/rid") @@ -1548,6 +1606,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/rewards/rid") @@ -1588,6 +1647,7 @@ describe("RewardClient", () => { loyaltyProgramId: "loyaltyProgramId", loyaltySubscriptionId: "loyaltySubscriptionId", }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/vouchers") @@ -1629,6 +1689,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/vouchers") @@ -1650,6 +1711,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/vouchers") @@ -1671,6 +1733,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/vouchers") @@ -1692,6 +1755,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/vouchers") @@ -1713,6 +1777,7 @@ describe("RewardClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/offer/programs/pid/vouchers") diff --git a/tests/wire/senders.test.ts b/tests/wire/senders.test.ts index 183fc00..f463646 100644 --- a/tests/wire/senders.test.ts +++ b/tests/wire/senders.test.ts @@ -34,6 +34,7 @@ describe("SendersClient", () => { }, ], }; + server.mockEndpoint().get("/senders").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.senders.getSenders(); @@ -107,6 +108,7 @@ describe("SendersClient", () => { }, ], }; + server.mockEndpoint().get("/senders").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.senders.getSenders(); @@ -152,6 +154,7 @@ describe("SendersClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/senders").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -164,6 +167,7 @@ describe("SendersClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { email: "support@example.com", name: "Support Team" }; const rawResponseBody = { dkimError: false, id: 15, spfError: false }; + server .mockEndpoint() .post("/senders") @@ -193,6 +197,7 @@ describe("SendersClient", () => { name: "Marketing Team", }; const rawResponseBody = { dkimError: false, id: 15, spfError: false }; + server .mockEndpoint() .post("/senders") @@ -232,6 +237,7 @@ describe("SendersClient", () => { name: "Newsletter", }; const rawResponseBody = { dkimError: false, id: 15, spfError: false }; + server .mockEndpoint() .post("/senders") @@ -269,6 +275,7 @@ describe("SendersClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { email: "support@example.com", name: "Support Team" }; const rawResponseBody = { dkimError: false, id: 15, spfError: false }; + server .mockEndpoint() .post("/senders") @@ -294,6 +301,7 @@ describe("SendersClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { email: "support@example.com", name: "Support Team" }; const rawResponseBody = { dkimError: true, id: 16, spfError: false }; + server .mockEndpoint() .post("/senders") @@ -319,6 +327,7 @@ describe("SendersClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { email: "email", name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/senders") @@ -343,6 +352,7 @@ describe("SendersClient", () => { const rawResponseBody = { ips: [{ active: true, domain: "mailing.enterprise.com", id: 3, ip: "192.168.1.100" }], }; + server.mockEndpoint().get("/senders/ips").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.senders.getIps(); @@ -369,6 +379,7 @@ describe("SendersClient", () => { { active: false, domain: "notifications.enterprise.com", id: 6, ip: "192.168.1.102" }, ], }; + server.mockEndpoint().get("/senders/ips").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.senders.getIps(); @@ -401,6 +412,7 @@ describe("SendersClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/senders/ips").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -516,6 +528,7 @@ describe("SendersClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/senders/1000000") @@ -537,6 +550,7 @@ describe("SendersClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/senders/1000000") @@ -570,6 +584,7 @@ describe("SendersClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/senders/1000000") @@ -590,6 +605,7 @@ describe("SendersClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/senders/1000000") @@ -610,6 +626,7 @@ describe("SendersClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { ips: [{ domain: "mailing.enterprise.com", id: 3, ip: "192.168.1.100", weight: 75 }] }; + server .mockEndpoint() .get("/senders/1000000/ips") @@ -643,6 +660,7 @@ describe("SendersClient", () => { { domain: "newsletter.enterprise.com", id: 5, ip: "192.168.1.101", weight: 60 }, ], }; + server .mockEndpoint() .get("/senders/1000000/ips") @@ -677,6 +695,7 @@ describe("SendersClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/senders/1000000/ips") @@ -697,6 +716,7 @@ describe("SendersClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/senders/1000000/ips") @@ -757,6 +777,7 @@ describe("SendersClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { otp: 999999 }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/senders/1000000/validate") @@ -779,6 +800,7 @@ describe("SendersClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { otp: 999999 }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/senders/1000000/validate") diff --git a/tests/wire/smsCampaigns.test.ts b/tests/wire/smsCampaigns.test.ts index 8892932..6298783 100644 --- a/tests/wire/smsCampaigns.test.ts +++ b/tests/wire/smsCampaigns.test.ts @@ -54,6 +54,7 @@ describe("SmsCampaignsClient", () => { ], count: 12, }; + server.mockEndpoint().get("/smsCampaigns").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.smsCampaigns.getSmsCampaigns(); @@ -115,6 +116,7 @@ describe("SmsCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/smsCampaigns").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -131,6 +133,7 @@ describe("SmsCampaignsClient", () => { sender: "MyShop", }; const rawResponseBody = { id: 5 }; + server .mockEndpoint() .post("/smsCampaigns") @@ -155,6 +158,7 @@ describe("SmsCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { content: "content", name: "name", sender: "sender" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/smsCampaigns") @@ -197,6 +201,7 @@ describe("SmsCampaignsClient", () => { unsubscriptions: 3, }, }; + server .mockEndpoint() .get("/smsCampaigns/1000000") @@ -238,6 +243,7 @@ describe("SmsCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/smsCampaigns/1000000") @@ -258,6 +264,7 @@ describe("SmsCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/smsCampaigns/1000000") @@ -297,6 +304,7 @@ describe("SmsCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/smsCampaigns/1000000") @@ -318,6 +326,7 @@ describe("SmsCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/smsCampaigns/1000000") @@ -351,6 +360,7 @@ describe("SmsCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/smsCampaigns/1000000") @@ -371,6 +381,7 @@ describe("SmsCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/smsCampaigns/1000000") @@ -391,6 +402,7 @@ describe("SmsCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { recipientsType: "all" }; const rawResponseBody = { processId: 78 }; + server .mockEndpoint() .post("/smsCampaigns/1000000/exportRecipients") @@ -414,6 +426,7 @@ describe("SmsCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { recipientsType: "all" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/smsCampaigns/1000000/exportRecipients") @@ -436,6 +449,7 @@ describe("SmsCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { recipientsType: "all" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/smsCampaigns/1000000/exportRecipients") @@ -470,6 +484,7 @@ describe("SmsCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/smsCampaigns/1000000/sendNow") @@ -490,6 +505,7 @@ describe("SmsCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/smsCampaigns/1000000/sendNow") @@ -510,6 +526,7 @@ describe("SmsCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/smsCampaigns/1000000/sendNow") @@ -560,6 +577,7 @@ describe("SmsCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { email: { body: "body", to: ["to", "to"] } }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/smsCampaigns/1000000/sendReport") @@ -587,6 +605,7 @@ describe("SmsCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { email: { body: "body", to: ["to", "to"] } }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/smsCampaigns/1000000/sendReport") @@ -633,6 +652,7 @@ describe("SmsCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/smsCampaigns/1000000/sendTest") @@ -654,6 +674,7 @@ describe("SmsCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/smsCampaigns/1000000/sendTest") @@ -695,6 +716,7 @@ describe("SmsCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/smsCampaigns/1000000/status") @@ -717,6 +739,7 @@ describe("SmsCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/smsCampaigns/1000000/status") diff --git a/tests/wire/smsTemplates.test.ts b/tests/wire/smsTemplates.test.ts index 00e6d68..7338e8b 100644 --- a/tests/wire/smsTemplates.test.ts +++ b/tests/wire/smsTemplates.test.ts @@ -29,6 +29,7 @@ describe("SmsTemplatesClient", () => { }, ], }; + server .mockEndpoint() .get("/transactionalSMS/templates") @@ -69,6 +70,7 @@ describe("SmsTemplatesClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/transactionalSMS/templates") diff --git a/tests/wire/tasks.test.ts b/tests/wire/tasks.test.ts index 3803039..1f74b0b 100644 --- a/tests/wire/tasks.test.ts +++ b/tests/wire/tasks.test.ts @@ -21,6 +21,7 @@ describe("TasksClient", () => { }, ], }; + server.mockEndpoint().get("/crm/tasks").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.tasks.getAllTasks({ @@ -45,6 +46,7 @@ describe("TasksClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/crm/tasks").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -61,6 +63,7 @@ describe("TasksClient", () => { taskTypeId: "61a5cd07ca1347c82306ad09", }; const rawResponseBody = { id: "61a5cd07ca1347c82306ad06" }; + server .mockEndpoint() .post("/crm/tasks") @@ -85,6 +88,7 @@ describe("TasksClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { date: "2024-01-15T09:30:00Z", name: "name", taskTypeId: "taskTypeId" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/crm/tasks") @@ -115,6 +119,7 @@ describe("TasksClient", () => { name: "Task: Connect with client_dev", taskTypeId: "61a5cd07ca1347c82306ad09", }; + server.mockEndpoint().get("/crm/tasks/id").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.tasks.getATask({ @@ -135,6 +140,7 @@ describe("TasksClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/crm/tasks/id").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -149,6 +155,7 @@ describe("TasksClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/crm/tasks/id").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -175,6 +182,7 @@ describe("TasksClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/crm/tasks/id").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -189,6 +197,7 @@ describe("TasksClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/crm/tasks/id").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -216,6 +225,7 @@ describe("TasksClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .patch("/crm/tasks/id") @@ -237,6 +247,7 @@ describe("TasksClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .patch("/crm/tasks/id") @@ -258,6 +269,7 @@ describe("TasksClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { id: "61a88a2eb7a574180261234", title: "Email" }; + server.mockEndpoint().get("/crm/tasktypes").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.tasks.getAllTaskTypes(); diff --git a/tests/wire/tier.test.ts b/tests/wire/tier.test.ts index a182bcd..e14d4ff 100644 --- a/tests/wire/tier.test.ts +++ b/tests/wire/tier.test.ts @@ -18,6 +18,7 @@ describe("TierClient", () => { meta: { key: "value" }, updatedAt: "2024-01-15T09:30:00Z", }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/contacts/cid/tiers/tid") @@ -49,6 +50,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/contacts/cid/tiers/tid") @@ -71,6 +73,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/contacts/cid/tiers/tid") @@ -93,6 +96,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/contacts/cid/tiers/tid") @@ -115,6 +119,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/contacts/cid/tiers/tid") @@ -137,6 +142,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/contacts/cid/tiers/tid") @@ -159,6 +165,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/contacts/cid/tiers/tid") @@ -181,6 +188,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/contacts/cid/tiers/tid") @@ -216,6 +224,7 @@ describe("TierClient", () => { }, ], }; + server .mockEndpoint() .get("/loyalty/tier/programs/pid/tier-groups") @@ -248,6 +257,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/tier/programs/pid/tier-groups") @@ -268,6 +278,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/tier/programs/pid/tier-groups") @@ -288,6 +299,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/tier/programs/pid/tier-groups") @@ -308,6 +320,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .get("/loyalty/tier/programs/pid/tier-groups") @@ -328,6 +341,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/tier/programs/pid/tier-groups") @@ -357,6 +371,7 @@ describe("TierClient", () => { updatedAt: "2024-01-15T09:30:00Z", upgradeStrategy: "real_time", }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/tier-groups") @@ -387,6 +402,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/tier-groups") @@ -409,6 +425,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/tier-groups") @@ -431,6 +448,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/tier-groups") @@ -453,6 +471,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/tier-groups") @@ -475,6 +494,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/tier-groups") @@ -497,6 +517,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name" }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/tier-groups") @@ -528,6 +549,7 @@ describe("TierClient", () => { updatedAt: "2024-01-15T09:30:00Z", upgradeStrategy: "real_time", }; + server .mockEndpoint() .get("/loyalty/tier/programs/pid/tier-groups/gid") @@ -557,6 +579,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/tier/programs/pid/tier-groups/gid") @@ -578,6 +601,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/tier/programs/pid/tier-groups/gid") @@ -599,6 +623,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/tier/programs/pid/tier-groups/gid") @@ -620,6 +645,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .get("/loyalty/tier/programs/pid/tier-groups/gid") @@ -641,6 +667,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/tier/programs/pid/tier-groups/gid") @@ -676,6 +703,7 @@ describe("TierClient", () => { updatedAt: "2024-01-15T09:30:00Z", upgradeStrategy: "real_time", }; + server .mockEndpoint() .put("/loyalty/tier/programs/pid/tier-groups/gid") @@ -715,6 +743,7 @@ describe("TierClient", () => { upgradeStrategy: "real_time", }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/tier/programs/pid/tier-groups/gid") @@ -746,6 +775,7 @@ describe("TierClient", () => { upgradeStrategy: "real_time", }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/tier/programs/pid/tier-groups/gid") @@ -777,6 +807,7 @@ describe("TierClient", () => { upgradeStrategy: "real_time", }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/tier/programs/pid/tier-groups/gid") @@ -808,6 +839,7 @@ describe("TierClient", () => { upgradeStrategy: "real_time", }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .put("/loyalty/tier/programs/pid/tier-groups/gid") @@ -839,6 +871,7 @@ describe("TierClient", () => { upgradeStrategy: "real_time", }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/tier/programs/pid/tier-groups/gid") @@ -883,6 +916,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/tier/programs/pid/tier-groups/gid") @@ -904,6 +938,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/tier/programs/pid/tier-groups/gid") @@ -925,6 +960,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/tier/programs/pid/tier-groups/gid") @@ -946,6 +982,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .delete("/loyalty/tier/programs/pid/tier-groups/gid") @@ -967,6 +1004,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .delete("/loyalty/tier/programs/pid/tier-groups/gid") @@ -988,6 +1026,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/tier/programs/pid/tier-groups/gid") @@ -1028,6 +1067,7 @@ describe("TierClient", () => { ], updatedAt: "2024-01-15T09:30:00Z", }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/tier-groups/gid/tiers") @@ -1074,6 +1114,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { accessConditions: [{}, {}], name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/tier-groups/gid/tiers") @@ -1098,6 +1139,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { accessConditions: [{}, {}], name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/tier-groups/gid/tiers") @@ -1122,6 +1164,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { accessConditions: [{}, {}], name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/tier-groups/gid/tiers") @@ -1146,6 +1189,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { accessConditions: [{}, {}], name: "name" }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/tier-groups/gid/tiers") @@ -1170,6 +1214,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { accessConditions: [{}, {}], name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/loyalty/tier/programs/pid/tier-groups/gid/tiers") @@ -1208,6 +1253,7 @@ describe("TierClient", () => { }, ], }; + server .mockEndpoint() .get("/loyalty/tier/programs/pid/tiers") @@ -1241,6 +1287,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/tier/programs/pid/tiers") @@ -1261,6 +1308,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/tier/programs/pid/tiers") @@ -1281,6 +1329,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/tier/programs/pid/tiers") @@ -1301,6 +1350,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .get("/loyalty/tier/programs/pid/tiers") @@ -1321,6 +1371,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/loyalty/tier/programs/pid/tiers") @@ -1360,6 +1411,7 @@ describe("TierClient", () => { ], updatedAt: "2024-01-15T09:30:00Z", }; + server .mockEndpoint() .put("/loyalty/tier/programs/pid/tiers/tid") @@ -1407,6 +1459,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { accessConditions: [{}, {}], name: "name", tierRewards: [{}, {}] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/tier/programs/pid/tiers/tid") @@ -1432,6 +1485,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { accessConditions: [{}, {}], name: "name", tierRewards: [{}, {}] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/tier/programs/pid/tiers/tid") @@ -1457,6 +1511,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { accessConditions: [{}, {}], name: "name", tierRewards: [{}, {}] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/tier/programs/pid/tiers/tid") @@ -1482,6 +1537,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { accessConditions: [{}, {}], name: "name", tierRewards: [{}, {}] }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .put("/loyalty/tier/programs/pid/tiers/tid") @@ -1507,6 +1563,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { accessConditions: [{}, {}], name: "name", tierRewards: [{}, {}] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/loyalty/tier/programs/pid/tiers/tid") @@ -1545,6 +1602,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/tier/programs/pid/tiers/tid") @@ -1566,6 +1624,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/tier/programs/pid/tiers/tid") @@ -1587,6 +1646,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/tier/programs/pid/tiers/tid") @@ -1608,6 +1668,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { message: "message" }; + server .mockEndpoint() .delete("/loyalty/tier/programs/pid/tiers/tid") @@ -1629,6 +1690,7 @@ describe("TierClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/loyalty/tier/programs/pid/tiers/tid") diff --git a/tests/wire/transactionalEmails.test.ts b/tests/wire/transactionalEmails.test.ts index f09df6f..fa2f407 100644 --- a/tests/wire/transactionalEmails.test.ts +++ b/tests/wire/transactionalEmails.test.ts @@ -20,6 +20,7 @@ describe("TransactionalEmailsClient", () => { ], count: 1, }; + server .mockEndpoint() .get("/smtp/blockedContacts") @@ -50,6 +51,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/smtp/blockedContacts") @@ -80,6 +82,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/smtp/blockedContacts/email") @@ -100,6 +103,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/smtp/blockedContacts/email") @@ -120,6 +124,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { domains: ["example.com", "testdomain.com"] }; + server .mockEndpoint() .get("/smtp/blockedDomains") @@ -158,6 +163,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { domain: "domain" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/smtp/blockedDomains") @@ -191,6 +197,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/smtp/blockedDomains/domain") @@ -211,6 +218,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/smtp/blockedDomains/domain") @@ -248,6 +256,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/smtp/deleteHardbounces") @@ -273,6 +282,7 @@ describe("TransactionalEmailsClient", () => { to: [{ email: "johndoe@example.com", name: "John Doe" }], }; const rawResponseBody = { messageId: "<201798300811.5787683@relay.domain.com>", messageIds: ["messageIds"] }; + server .mockEndpoint() .post("/smtp/email") @@ -315,6 +325,7 @@ describe("TransactionalEmailsClient", () => { to: [{ email: "johndoe@example.com", name: "John Doe" }], }; const rawResponseBody = { messageId: "<201798300811.5787683@relay.domain.com>", messageIds: ["messageIds"] }; + server .mockEndpoint() .post("/smtp/email") @@ -354,6 +365,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/smtp/email") @@ -390,6 +402,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/smtp/email/identifier") @@ -410,6 +423,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/smtp/email/identifier") @@ -437,6 +451,7 @@ describe("TransactionalEmailsClient", () => { ], count: 3, }; + server .mockEndpoint() .get("/smtp/emailStatus/4320f270-a4e3-4a2e-b591-edfe30a5e627") @@ -481,6 +496,7 @@ describe("TransactionalEmailsClient", () => { scheduledAt: "2022-02-28T11:36:43Z", status: "queued", }; + server .mockEndpoint() .get("/smtp/emailStatus/4320f270-a4e3-4a2e-b591-edfe30a5e627") @@ -506,6 +522,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/smtp/emailStatus/identifier") @@ -526,6 +543,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/smtp/emailStatus/identifier") @@ -570,6 +588,7 @@ describe("TransactionalEmailsClient", () => { }, ], }; + server.mockEndpoint().get("/smtp/emails").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.transactionalEmails.getTransacEmailsList(); @@ -605,6 +624,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/smtp/emails").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -629,6 +649,7 @@ describe("TransactionalEmailsClient", () => { subject: "Summer Camps", templateId: 12, }; + server.mockEndpoint().get("/smtp/emails/uuid").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.transactionalEmails.getTransacEmailContent({ @@ -675,6 +696,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/smtp/log/identifier") @@ -695,6 +717,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/smtp/log/identifier") @@ -729,6 +752,7 @@ describe("TransactionalEmailsClient", () => { uniqueOpens: 13688, unsubscribed: 2, }; + server .mockEndpoint() .get("/smtp/statistics/aggregatedReport") @@ -760,6 +784,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/smtp/statistics/aggregatedReport") @@ -807,6 +832,7 @@ describe("TransactionalEmailsClient", () => { }, ], }; + server .mockEndpoint() .get("/smtp/statistics/events") @@ -853,6 +879,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/smtp/statistics/events") @@ -904,6 +931,7 @@ describe("TransactionalEmailsClient", () => { }, ], }; + server .mockEndpoint() .get("/smtp/statistics/reports") @@ -954,6 +982,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/smtp/statistics/reports") @@ -979,6 +1008,7 @@ describe("TransactionalEmailsClient", () => { subject: "subject", usedFeedNames: ["usedFeedNames", "usedFeedNames"], }; + server .mockEndpoint() .post("/smtp/template/preview") @@ -1006,6 +1036,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { key: "value" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/smtp/template/preview") @@ -1061,6 +1092,7 @@ describe("TransactionalEmailsClient", () => { }, ], }; + server.mockEndpoint().get("/smtp/templates").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.transactionalEmails.getSmtpTemplates(); @@ -1114,6 +1146,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/smtp/templates").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -1130,6 +1163,7 @@ describe("TransactionalEmailsClient", () => { templateName: "Order Confirmation - EN", }; const rawResponseBody = { id: 5 }; + server .mockEndpoint() .post("/smtp/templates") @@ -1154,6 +1188,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { sender: {}, subject: "subject", templateName: "templateName" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/smtp/templates") @@ -1191,6 +1226,7 @@ describe("TransactionalEmailsClient", () => { testSent: false, toField: "", }; + server .mockEndpoint() .get("/smtp/templates/1000000") @@ -1228,6 +1264,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/smtp/templates/1000000") @@ -1248,6 +1285,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/smtp/templates/1000000") @@ -1287,6 +1325,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/smtp/templates/1000000") @@ -1308,6 +1347,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/smtp/templates/1000000") @@ -1341,6 +1381,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/smtp/templates/1000000") @@ -1361,6 +1402,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/smtp/templates/1000000") @@ -1401,6 +1443,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/smtp/templates/1000000/sendTest") @@ -1423,6 +1466,7 @@ describe("TransactionalEmailsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/smtp/templates/1000000/sendTest") diff --git a/tests/wire/transactionalSms.test.ts b/tests/wire/transactionalSms.test.ts index 2e36cb9..d0c301b 100644 --- a/tests/wire/transactionalSms.test.ts +++ b/tests/wire/transactionalSms.test.ts @@ -10,6 +10,7 @@ describe("TransactionalSmsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { recipient: "33689965433", sender: "MyShop" }; const rawResponseBody = { messageId: 1511882900176220 }; + server .mockEndpoint() .post("/transactionalSMS/send") @@ -33,6 +34,7 @@ describe("TransactionalSmsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { recipient: "recipient", sender: "sender" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/transactionalSMS/send") @@ -61,6 +63,7 @@ describe("TransactionalSmsClient", () => { smsCount: 2, usedCredits: 0.7, }; + server .mockEndpoint() .post("/transactionalSMS/sms") @@ -88,6 +91,7 @@ describe("TransactionalSmsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { recipient: "recipient", sender: "sender" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/transactionalSMS/sms") @@ -110,6 +114,7 @@ describe("TransactionalSmsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { recipient: "recipient", sender: "sender" }; const rawResponseBody = { message: "message" }; + server .mockEndpoint() .post("/transactionalSMS/sms") @@ -144,6 +149,7 @@ describe("TransactionalSmsClient", () => { softBounces: 26, unsubscribed: 10, }; + server .mockEndpoint() .get("/transactionalSMS/statistics/aggregatedReport") @@ -173,6 +179,7 @@ describe("TransactionalSmsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/transactionalSMS/statistics/aggregatedReport") @@ -212,6 +219,7 @@ describe("TransactionalSmsClient", () => { }, ], }; + server .mockEndpoint() .get("/transactionalSMS/statistics/events") @@ -250,6 +258,7 @@ describe("TransactionalSmsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/transactionalSMS/statistics/events") @@ -310,6 +319,7 @@ describe("TransactionalSmsClient", () => { }, ], }; + server .mockEndpoint() .get("/transactionalSMS/statistics/reports") @@ -369,6 +379,7 @@ describe("TransactionalSmsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/transactionalSMS/statistics/reports") diff --git a/tests/wire/transactionalWhatsApp.test.ts b/tests/wire/transactionalWhatsApp.test.ts index 8c193c4..f286603 100644 --- a/tests/wire/transactionalWhatsApp.test.ts +++ b/tests/wire/transactionalWhatsApp.test.ts @@ -10,6 +10,7 @@ describe("TransactionalWhatsAppClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { contactNumbers: ["contactNumbers"], senderNumber: "senderNumber", templateId: 123 }; const rawResponseBody = { messageId: "23befbae-1505-47a8-bd27-e30ef739f32c" }; + server .mockEndpoint() .post("/whatsapp/sendMessage") @@ -38,6 +39,7 @@ describe("TransactionalWhatsAppClient", () => { templateId: 1, }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/whatsapp/sendMessage") @@ -104,6 +106,7 @@ describe("TransactionalWhatsAppClient", () => { }, ], }; + server .mockEndpoint() .get("/whatsapp/statistics/events") @@ -164,6 +167,7 @@ describe("TransactionalWhatsAppClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/whatsapp/statistics/events") diff --git a/tests/wire/user.test.ts b/tests/wire/user.test.ts index 5e4812d..32928ab 100644 --- a/tests/wire/user.test.ts +++ b/tests/wire/user.test.ts @@ -31,6 +31,7 @@ describe("UserClient", () => { }, ], }; + server .mockEndpoint() .get("/organization/invited/users") @@ -81,6 +82,7 @@ describe("UserClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/organization/invited/users") @@ -99,6 +101,7 @@ describe("UserClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { credit_notes: ["TEST-123"], status: "OK" }; + server .mockEndpoint() .put("/organization/user/invitation/revoke/email") @@ -121,6 +124,7 @@ describe("UserClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/organization/user/invitation/revoke/email") @@ -141,6 +145,7 @@ describe("UserClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { all_features_access: true, email: "inviteuser@example.com", privileges: [{}] }; const rawResponseBody = { invoice_id: "invoice_id", status: "OK" }; + server .mockEndpoint() .post("/organization/user/invitation/send") @@ -166,6 +171,7 @@ describe("UserClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { all_features_access: true, email: "email", privileges: [{}, {}] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/organization/user/invitation/send") @@ -189,6 +195,7 @@ describe("UserClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { credit_notes: ["TEST-123"], status: "OK" }; + server .mockEndpoint() .put("/organization/user/invitation/resend/email") @@ -212,6 +219,7 @@ describe("UserClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/organization/user/invitation/resend/email") @@ -233,6 +241,7 @@ describe("UserClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { all_features_access: true, email: "inviteuser@example.com", privileges: [{}] }; const rawResponseBody = { credit_notes: ["TEST-123"], invoice_id: "invoice_id", status: "OK" }; + server .mockEndpoint() .post("/organization/user/update/permissions") @@ -259,6 +268,7 @@ describe("UserClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { all_features_access: true, email: "email", privileges: [{}, {}] }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/organization/user/update/permissions") @@ -319,6 +329,7 @@ describe("UserClient", () => { ], status: "active", }; + server .mockEndpoint() .get("/organization/user/email/permissions") @@ -408,6 +419,7 @@ describe("UserClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/organization/user/email/permissions") diff --git a/tests/wire/webhooks.test.ts b/tests/wire/webhooks.test.ts index f9ad007..207ac1a 100644 --- a/tests/wire/webhooks.test.ts +++ b/tests/wire/webhooks.test.ts @@ -39,6 +39,7 @@ describe("WebhooksClient", () => { }, ], }; + server.mockEndpoint().get("/webhooks").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.webhooks.getWebhooks(); @@ -95,6 +96,7 @@ describe("WebhooksClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/webhooks").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -107,6 +109,7 @@ describe("WebhooksClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { events: ["sent"], url: "http://requestb.in/173lyyx1" }; const rawResponseBody = { id: 5 }; + server .mockEndpoint() .post("/webhooks") @@ -130,6 +133,7 @@ describe("WebhooksClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { events: ["sent", "sent"], url: "url" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/webhooks") @@ -152,6 +156,7 @@ describe("WebhooksClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { event: "invalid_parameter", notifyURL: "https://brevo.com", type: "transactional" }; const rawResponseBody = { processId: 78 }; + server .mockEndpoint() .post("/webhooks/export") @@ -176,6 +181,7 @@ describe("WebhooksClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { event: "invalid_parameter", notifyURL: "notifyURL", type: "transactional" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/webhooks/export") @@ -211,6 +217,7 @@ describe("WebhooksClient", () => { type: "marketing", url: "http://example.domain.com/1brxxxxxx5p1", }; + server.mockEndpoint().get("/webhooks/1000000").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.webhooks.getWebhook({ @@ -244,6 +251,7 @@ describe("WebhooksClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/webhooks/1000000").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -258,6 +266,7 @@ describe("WebhooksClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/webhooks/1000000").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -285,6 +294,7 @@ describe("WebhooksClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/webhooks/1000000") @@ -306,6 +316,7 @@ describe("WebhooksClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/webhooks/1000000") @@ -339,6 +350,7 @@ describe("WebhooksClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/webhooks/1000000") @@ -359,6 +371,7 @@ describe("WebhooksClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/webhooks/1000000") diff --git a/tests/wire/whatsAppCampaigns.test.ts b/tests/wire/whatsAppCampaigns.test.ts index ede5fac..0e9a43a 100644 --- a/tests/wire/whatsAppCampaigns.test.ts +++ b/tests/wire/whatsAppCampaigns.test.ts @@ -27,6 +27,7 @@ describe("WhatsAppCampaignsClient", () => { ], count: 23, }; + server.mockEndpoint().get("/whatsappCampaigns").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.whatsAppCampaigns.getWhatsAppCampaigns(); @@ -61,6 +62,7 @@ describe("WhatsAppCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/whatsappCampaigns").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); await expect(async () => { @@ -78,6 +80,7 @@ describe("WhatsAppCampaignsClient", () => { templateId: 19, }; const rawResponseBody = { id: 5 }; + server .mockEndpoint() .post("/whatsappCampaigns") @@ -103,6 +106,7 @@ describe("WhatsAppCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name: "name", recipients: {}, scheduledAt: "scheduledAt", templateId: 1 }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/whatsappCampaigns") @@ -134,6 +138,7 @@ describe("WhatsAppCampaignsClient", () => { whatsappBusinessAccountId: "whatsappBusinessAccountId", whatsappBusinessAccountStatus: "APPROVED", }; + server .mockEndpoint() .get("/whatsappCampaigns/config") @@ -158,6 +163,7 @@ describe("WhatsAppCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/whatsappCampaigns/config") @@ -181,6 +187,7 @@ describe("WhatsAppCampaignsClient", () => { name: "Test template", }; const rawResponseBody = { id: 5 }; + server .mockEndpoint() .post("/whatsappCampaigns/template") @@ -206,6 +213,7 @@ describe("WhatsAppCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { bodyText: "bodyText", category: "MARKETING", language: "language", name: "name" }; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/whatsappCampaigns/template") @@ -254,6 +262,7 @@ describe("WhatsAppCampaignsClient", () => { }, ], }; + server .mockEndpoint() .get("/whatsappCampaigns/template-list") @@ -295,6 +304,7 @@ describe("WhatsAppCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/whatsappCampaigns/template-list") @@ -330,6 +340,7 @@ describe("WhatsAppCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .post("/whatsappCampaigns/template/approval/1000000") @@ -375,6 +386,7 @@ describe("WhatsAppCampaignsClient", () => { name: "official_campaign8", }, }; + server .mockEndpoint() .get("/whatsappCampaigns/1000000") @@ -443,6 +455,7 @@ describe("WhatsAppCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/whatsappCampaigns/1000000") @@ -463,6 +476,7 @@ describe("WhatsAppCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .get("/whatsappCampaigns/1000000") @@ -502,6 +516,7 @@ describe("WhatsAppCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { key: "value" }; + server .mockEndpoint() .put("/whatsappCampaigns/1000000") @@ -535,6 +550,7 @@ describe("WhatsAppCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/whatsappCampaigns/1000000") @@ -555,6 +571,7 @@ describe("WhatsAppCampaignsClient", () => { const client = new BrevoClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; + server .mockEndpoint() .delete("/whatsappCampaigns/1000000") diff --git a/tsconfig.base.json b/tsconfig.base.json index d762767..93a92c0 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -9,7 +9,6 @@ "declaration": true, "outDir": "dist", "rootDir": "src", - "baseUrl": "src", "isolatedModules": true, "isolatedDeclarations": true }, diff --git a/vitest.config.mts b/vitest.config.mts index ba2ec4f..0dee5a7 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -1,6 +1,10 @@ import { defineConfig } from "vitest/config"; export default defineConfig({ test: { + typecheck: { + enabled: true, + tsconfig: "./tests/tsconfig.json", + }, projects: [ { test: {