@getbrevo/brevo 5.0.1 → 5.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.d.ts +12 -0
  3. package/dist/cjs/Client.js +67 -0
  4. package/dist/cjs/api/resources/balance/client/Client.js +15 -6
  5. package/dist/cjs/api/resources/balance/client/requests/GetContactBalancesRequest.d.ts +2 -0
  6. package/dist/cjs/api/resources/balance/client/requests/GetLoyaltyBalanceProgramsPidActiveBalanceRequest.d.ts +2 -0
  7. package/dist/cjs/api/resources/balance/client/requests/GetLoyaltyBalanceProgramsPidTransactionHistoryRequest.d.ts +5 -1
  8. package/dist/cjs/api/resources/balance/client/requests/GetSubscriptionBalancesRequest.d.ts +2 -0
  9. package/dist/cjs/api/resources/balance/client/requests/PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequest.d.ts +10 -1
  10. package/dist/cjs/api/resources/balance/client/requests/UpdateBalanceDefinitionRequest.d.ts +10 -1
  11. package/dist/cjs/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus.d.ts +8 -0
  12. package/dist/cjs/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus.js +11 -0
  13. package/dist/cjs/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType.d.ts +5 -0
  14. package/dist/cjs/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType.js +8 -0
  15. package/dist/cjs/api/resources/balance/types/index.d.ts +2 -0
  16. package/dist/cjs/api/resources/balance/types/index.js +2 -0
  17. package/dist/cjs/api/resources/contacts/client/Client.d.ts +1 -1
  18. package/dist/cjs/api/resources/contacts/client/Client.js +1 -1
  19. package/dist/cjs/api/resources/ecommerce/client/requests/CreateUpdateBatchProductsRequest.d.ts +5 -1
  20. package/dist/cjs/api/resources/ecommerce/client/requests/CreateUpdateProductRequest.d.ts +5 -1
  21. package/dist/cjs/api/resources/event/client/Client.d.ts +20 -1
  22. package/dist/cjs/api/resources/event/client/Client.js +69 -1
  23. package/dist/cjs/api/resources/event/client/requests/GetEventsRequest.d.ts +20 -0
  24. package/dist/cjs/api/resources/event/client/requests/GetEventsRequest.js +3 -0
  25. package/dist/cjs/api/resources/event/client/requests/index.d.ts +1 -0
  26. package/dist/cjs/api/resources/program/client/Client.js +2 -1
  27. package/dist/cjs/api/resources/program/client/requests/GetParameterSubscriptionInfoRequest.d.ts +2 -0
  28. package/dist/cjs/api/resources/tier/client/requests/CreateTierGroupRequest.d.ts +11 -0
  29. package/dist/cjs/api/resources/tier/client/requests/UpdateTierGroupRequest.d.ts +11 -0
  30. package/dist/cjs/api/types/BatchAcceptedResponse.d.ts +9 -0
  31. package/dist/cjs/api/types/BatchAcceptedResponse.js +3 -0
  32. package/dist/cjs/api/types/GetEventsList.d.ts +32 -0
  33. package/dist/cjs/api/types/GetEventsList.js +3 -0
  34. package/dist/cjs/api/types/GetProductDetails.d.ts +4 -0
  35. package/dist/cjs/api/types/InternalServerErrorBody.d.ts +48 -0
  36. package/dist/cjs/api/types/InternalServerErrorBody.js +46 -0
  37. package/dist/cjs/api/types/index.d.ts +3 -0
  38. package/dist/cjs/api/types/index.js +3 -0
  39. package/dist/cjs/core/fetcher/BinaryResponse.d.ts +1 -1
  40. package/dist/cjs/core/fetcher/index.d.ts +2 -0
  41. package/dist/cjs/core/fetcher/index.js +3 -1
  42. package/dist/cjs/core/fetcher/makePassthroughRequest.d.ts +49 -0
  43. package/dist/cjs/core/fetcher/makePassthroughRequest.js +135 -0
  44. package/dist/cjs/version.d.ts +1 -1
  45. package/dist/cjs/version.js +1 -1
  46. package/dist/esm/BaseClient.mjs +2 -2
  47. package/dist/esm/Client.d.mts +12 -0
  48. package/dist/esm/Client.mjs +34 -0
  49. package/dist/esm/api/resources/balance/client/Client.mjs +15 -6
  50. package/dist/esm/api/resources/balance/client/requests/GetContactBalancesRequest.d.mts +2 -0
  51. package/dist/esm/api/resources/balance/client/requests/GetLoyaltyBalanceProgramsPidActiveBalanceRequest.d.mts +2 -0
  52. package/dist/esm/api/resources/balance/client/requests/GetLoyaltyBalanceProgramsPidTransactionHistoryRequest.d.mts +5 -1
  53. package/dist/esm/api/resources/balance/client/requests/GetSubscriptionBalancesRequest.d.mts +2 -0
  54. package/dist/esm/api/resources/balance/client/requests/PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequest.d.mts +10 -1
  55. package/dist/esm/api/resources/balance/client/requests/UpdateBalanceDefinitionRequest.d.mts +10 -1
  56. package/dist/esm/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus.d.mts +8 -0
  57. package/dist/esm/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus.mjs +8 -0
  58. package/dist/esm/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType.d.mts +5 -0
  59. package/dist/esm/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType.mjs +5 -0
  60. package/dist/esm/api/resources/balance/types/index.d.mts +2 -0
  61. package/dist/esm/api/resources/balance/types/index.mjs +2 -0
  62. package/dist/esm/api/resources/contacts/client/Client.d.mts +1 -1
  63. package/dist/esm/api/resources/contacts/client/Client.mjs +1 -1
  64. package/dist/esm/api/resources/ecommerce/client/requests/CreateUpdateBatchProductsRequest.d.mts +5 -1
  65. package/dist/esm/api/resources/ecommerce/client/requests/CreateUpdateProductRequest.d.mts +5 -1
  66. package/dist/esm/api/resources/event/client/Client.d.mts +20 -1
  67. package/dist/esm/api/resources/event/client/Client.mjs +69 -1
  68. package/dist/esm/api/resources/event/client/requests/GetEventsRequest.d.mts +20 -0
  69. package/dist/esm/api/resources/event/client/requests/GetEventsRequest.mjs +2 -0
  70. package/dist/esm/api/resources/event/client/requests/index.d.mts +1 -0
  71. package/dist/esm/api/resources/program/client/Client.mjs +2 -1
  72. package/dist/esm/api/resources/program/client/requests/GetParameterSubscriptionInfoRequest.d.mts +2 -0
  73. package/dist/esm/api/resources/tier/client/requests/CreateTierGroupRequest.d.mts +11 -0
  74. package/dist/esm/api/resources/tier/client/requests/UpdateTierGroupRequest.d.mts +11 -0
  75. package/dist/esm/api/types/BatchAcceptedResponse.d.mts +9 -0
  76. package/dist/esm/api/types/BatchAcceptedResponse.mjs +2 -0
  77. package/dist/esm/api/types/GetEventsList.d.mts +32 -0
  78. package/dist/esm/api/types/GetEventsList.mjs +2 -0
  79. package/dist/esm/api/types/GetProductDetails.d.mts +4 -0
  80. package/dist/esm/api/types/InternalServerErrorBody.d.mts +48 -0
  81. package/dist/esm/api/types/InternalServerErrorBody.mjs +43 -0
  82. package/dist/esm/api/types/index.d.mts +3 -0
  83. package/dist/esm/api/types/index.mjs +3 -0
  84. package/dist/esm/core/fetcher/BinaryResponse.d.mts +1 -1
  85. package/dist/esm/core/fetcher/index.d.mts +2 -0
  86. package/dist/esm/core/fetcher/index.mjs +1 -0
  87. package/dist/esm/core/fetcher/makePassthroughRequest.d.mts +49 -0
  88. package/dist/esm/core/fetcher/makePassthroughRequest.mjs +132 -0
  89. package/dist/esm/version.d.mts +1 -1
  90. package/dist/esm/version.mjs +1 -1
  91. package/package.json +1 -1
  92. package/reference.md +69 -2
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "@getbrevo/brevo",
46
- "X-Fern-SDK-Version": "5.0.1",
47
- "User-Agent": "@getbrevo/brevo/5.0.1",
46
+ "X-Fern-SDK-Version": "5.0.3",
47
+ "User-Agent": "@getbrevo/brevo/5.0.3",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -32,6 +32,7 @@ import { WebhooksClient } from "./api/resources/webhooks/client/Client.js";
32
32
  import { WhatsAppCampaignsClient } from "./api/resources/whatsAppCampaigns/client/Client.js";
33
33
  import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
34
34
  import { type NormalizedClientOptionsWithAuth } from "./BaseClient.js";
35
+ import * as core from "./core/index.js";
35
36
  export declare namespace BrevoClient {
36
37
  type Options = BaseClientOptions;
37
38
  interface RequestOptions extends BaseRequestOptions {
@@ -104,4 +105,15 @@ export declare class BrevoClient {
104
105
  get transactionalEmails(): TransactionalEmailsClient;
105
106
  get transactionalSms(): TransactionalSmsClient;
106
107
  get smsTemplates(): SmsTemplatesClient;
108
+ /**
109
+ * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
110
+ * This is useful for making requests to endpoints not yet supported in the SDK.
111
+ * The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
112
+ *
113
+ * @param {Request | string | URL} input - The URL, path, or Request object.
114
+ * @param {RequestInit} init - Standard fetch RequestInit options.
115
+ * @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
116
+ * @returns {Promise<Response>} A standard Response object.
117
+ */
118
+ fetch(input: Request | string | URL, init?: RequestInit, requestOptions?: core.PassthroughRequest.RequestOptions): Promise<Response>;
107
119
  }
@@ -1,5 +1,47 @@
1
1
  "use strict";
2
2
  // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
3
45
  Object.defineProperty(exports, "__esModule", { value: true });
4
46
  exports.BrevoClient = void 0;
5
47
  const Client_js_1 = require("./api/resources/account/client/Client.js");
@@ -35,6 +77,7 @@ const Client_js_30 = require("./api/resources/user/client/Client.js");
35
77
  const Client_js_31 = require("./api/resources/webhooks/client/Client.js");
36
78
  const Client_js_32 = require("./api/resources/whatsAppCampaigns/client/Client.js");
37
79
  const BaseClient_js_1 = require("./BaseClient.js");
80
+ const core = __importStar(require("./core/index.js"));
38
81
  class BrevoClient {
39
82
  constructor(options) {
40
83
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
@@ -167,5 +210,29 @@ class BrevoClient {
167
210
  var _a;
168
211
  return ((_a = this._smsTemplates) !== null && _a !== void 0 ? _a : (this._smsTemplates = new Client_js_24.SmsTemplatesClient(this._options)));
169
212
  }
213
+ /**
214
+ * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
215
+ * This is useful for making requests to endpoints not yet supported in the SDK.
216
+ * The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
217
+ *
218
+ * @param {Request | string | URL} input - The URL, path, or Request object.
219
+ * @param {RequestInit} init - Standard fetch RequestInit options.
220
+ * @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
221
+ * @returns {Promise<Response>} A standard Response object.
222
+ */
223
+ fetch(input, init, requestOptions) {
224
+ return __awaiter(this, void 0, void 0, function* () {
225
+ var _a;
226
+ return core.makePassthroughRequest(input, init, {
227
+ baseUrl: (_a = this._options.baseUrl) !== null && _a !== void 0 ? _a : this._options.environment,
228
+ headers: this._options.headers,
229
+ timeoutInSeconds: this._options.timeoutInSeconds,
230
+ maxRetries: this._options.maxRetries,
231
+ fetch: this._options.fetch,
232
+ logging: this._options.logging,
233
+ getAuthHeaders: () => __awaiter(this, void 0, void 0, function* () { return (yield this._options.authProvider.getAuthRequest()).headers; }),
234
+ }, requestOptions);
235
+ });
236
+ }
170
237
  }
171
238
  exports.BrevoClient = BrevoClient;
@@ -91,7 +91,7 @@ class BalanceClient {
91
91
  __getActiveBalancesApi(request, requestOptions) {
92
92
  return __awaiter(this, void 0, void 0, function* () {
93
93
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
94
- const { pid, limit, offset, sort_field: sortField, sort, contact_id: contactId, balance_definition_id: balanceDefinitionId, } = request;
94
+ const { pid, limit, offset, sort_field: sortField, sort, contact_id: contactId, balance_definition_id: balanceDefinitionId, includeInternal, } = request;
95
95
  const _queryParams = {
96
96
  limit,
97
97
  offset,
@@ -99,6 +99,7 @@ class BalanceClient {
99
99
  sort,
100
100
  contact_id: contactId,
101
101
  balance_definition_id: balanceDefinitionId,
102
+ includeInternal,
102
103
  };
103
104
  const _authRequest = yield this._options.authProvider.getAuthRequest();
104
105
  const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
@@ -781,14 +782,17 @@ class BalanceClient {
781
782
  __getContactBalances(request, requestOptions) {
782
783
  return __awaiter(this, void 0, void 0, function* () {
783
784
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
784
- const { pid } = request;
785
+ const { pid, includeInternal } = request;
786
+ const _queryParams = {
787
+ includeInternal,
788
+ };
785
789
  const _authRequest = yield this._options.authProvider.getAuthRequest();
786
790
  const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
787
791
  const _response = yield core.fetcher({
788
792
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.BrevoEnvironment.Default, `loyalty/balance/programs/${core.url.encodePathParam(pid)}/contact-balances`),
789
793
  method: "GET",
790
794
  headers: _headers,
791
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
795
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
792
796
  timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
793
797
  maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
794
798
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -913,14 +917,17 @@ class BalanceClient {
913
917
  __getSubscriptionBalances(request, requestOptions) {
914
918
  return __awaiter(this, void 0, void 0, function* () {
915
919
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
916
- const { pid, cid } = request;
920
+ const { pid, cid, includeInternal } = request;
921
+ const _queryParams = {
922
+ includeInternal,
923
+ };
917
924
  const _authRequest = yield this._options.authProvider.getAuthRequest();
918
925
  const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
919
926
  const _response = yield core.fetcher({
920
927
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.BrevoEnvironment.Default, `loyalty/balance/programs/${core.url.encodePathParam(pid)}/subscriptions/${core.url.encodePathParam(cid)}/balances`),
921
928
  method: "GET",
922
929
  headers: _headers,
923
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
930
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
924
931
  timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
925
932
  maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
926
933
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -1052,7 +1059,7 @@ class BalanceClient {
1052
1059
  __getTransactionHistoryApi(request, requestOptions) {
1053
1060
  return __awaiter(this, void 0, void 0, function* () {
1054
1061
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1055
- const { pid, limit, offset, sortField, sort, contactId, balanceDefinitionId, filters } = request;
1062
+ const { pid, limit, offset, sortField, sort, contactId, balanceDefinitionId, filters, status, transactionType, } = request;
1056
1063
  const _queryParams = {
1057
1064
  limit,
1058
1065
  offset,
@@ -1061,6 +1068,8 @@ class BalanceClient {
1061
1068
  contactId,
1062
1069
  balanceDefinitionId,
1063
1070
  filters,
1071
+ status: status != null ? status : undefined,
1072
+ transactionType: transactionType != null ? transactionType : undefined,
1064
1073
  };
1065
1074
  const _authRequest = yield this._options.authProvider.getAuthRequest();
1066
1075
  const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
@@ -7,4 +7,6 @@
7
7
  export interface GetContactBalancesRequest {
8
8
  /** Loyalty Program Id */
9
9
  pid: string;
10
+ /** Include balances tied to internal definitions. */
11
+ includeInternal?: boolean;
10
12
  }
@@ -21,4 +21,6 @@ export interface GetLoyaltyBalanceProgramsPidActiveBalanceRequest {
21
21
  contact_id: number;
22
22
  /** Balance Definition ID */
23
23
  balance_definition_id: string;
24
+ /** Include balances tied to internal definitions. */
25
+ includeInternal?: boolean;
24
26
  }
@@ -12,7 +12,7 @@ export interface GetLoyaltyBalanceProgramsPidTransactionHistoryRequest {
12
12
  pid: string;
13
13
  /** Limit the number of records returned */
14
14
  limit?: number;
15
- /** Skip a number of records */
15
+ /** Page number to retrieve */
16
16
  offset?: number;
17
17
  /** Field to sort by */
18
18
  sortField?: "createdAt";
@@ -24,4 +24,8 @@ export interface GetLoyaltyBalanceProgramsPidTransactionHistoryRequest {
24
24
  balanceDefinitionId: string;
25
25
  /** Filters to apply */
26
26
  filters?: string | string[];
27
+ /** Transaction status filter. Allowed values: draft, completed, rejected, cancelled, expired */
28
+ status?: Brevo.GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus;
29
+ /** Transaction type filter. Allowed values: credit, debit */
30
+ transactionType?: Brevo.GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType;
27
31
  }
@@ -10,4 +10,6 @@ export interface GetSubscriptionBalancesRequest {
10
10
  pid: string;
11
11
  /** Contact Id */
12
12
  cid: string;
13
+ /** Include balances tied to internal definitions. */
14
+ includeInternal?: boolean;
13
15
  }
@@ -34,7 +34,7 @@ export interface PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequest {
34
34
  /** Maximum debit allowed per operation. */
35
35
  maxDebitAmountLimit?: number;
36
36
  /** Additional metadata for the balance definition. */
37
- meta?: Record<string, unknown>;
37
+ meta?: PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequest.Meta;
38
38
  /** Minimum allowable balance amount. */
39
39
  minAmount?: number;
40
40
  /** Name of the balance definition. */
@@ -78,6 +78,15 @@ export declare namespace PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequest
78
78
  readonly Natural: "natural";
79
79
  };
80
80
  type BalanceOptionDebitRounding = (typeof BalanceOptionDebitRounding)[keyof typeof BalanceOptionDebitRounding];
81
+ /**
82
+ * Additional metadata for the balance definition.
83
+ */
84
+ interface Meta {
85
+ /** Indicates whether the balance definition is internal. */
86
+ isInternal?: boolean | undefined;
87
+ /** Accepts any additional properties */
88
+ [key: string]: any;
89
+ }
81
90
  /** Unit of balance measurement. */
82
91
  const Unit: {
83
92
  readonly Points: "POINTS";
@@ -37,7 +37,7 @@ export interface UpdateBalanceDefinitionRequest {
37
37
  /** Maximum debit allowed per operation. */
38
38
  maxDebitAmountLimit?: number;
39
39
  /** Optional metadata for the balance definition. */
40
- meta?: Record<string, unknown>;
40
+ meta?: UpdateBalanceDefinitionRequest.Meta;
41
41
  /** Minimum allowable balance amount. */
42
42
  minAmount?: number;
43
43
  /** Name of the balance definition. */
@@ -81,6 +81,15 @@ export declare namespace UpdateBalanceDefinitionRequest {
81
81
  readonly Natural: "natural";
82
82
  };
83
83
  type BalanceOptionDebitRounding = (typeof BalanceOptionDebitRounding)[keyof typeof BalanceOptionDebitRounding];
84
+ /**
85
+ * Optional metadata for the balance definition.
86
+ */
87
+ interface Meta {
88
+ /** Indicates whether the balance definition is internal. */
89
+ isInternal?: boolean | undefined;
90
+ /** Accepts any additional properties */
91
+ [key: string]: any;
92
+ }
84
93
  /** Unit of balance measurement. */
85
94
  const Unit: {
86
95
  readonly Points: "POINTS";
@@ -0,0 +1,8 @@
1
+ export declare const GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus: {
2
+ readonly Draft: "draft";
3
+ readonly Completed: "completed";
4
+ readonly Rejected: "rejected";
5
+ readonly Cancelled: "cancelled";
6
+ readonly Expired: "expired";
7
+ };
8
+ export type GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus = (typeof GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus)[keyof typeof GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus];
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus = void 0;
5
+ exports.GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus = {
6
+ Draft: "draft",
7
+ Completed: "completed",
8
+ Rejected: "rejected",
9
+ Cancelled: "cancelled",
10
+ Expired: "expired",
11
+ };
@@ -0,0 +1,5 @@
1
+ export declare const GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType: {
2
+ readonly Credit: "credit";
3
+ readonly Debit: "debit";
4
+ };
5
+ export type GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType = (typeof GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType)[keyof typeof GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType];
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType = void 0;
5
+ exports.GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType = {
6
+ Credit: "credit",
7
+ Debit: "debit",
8
+ };
@@ -7,6 +7,8 @@ export * from "./GetBalanceDefinitionRequestVersion.js";
7
7
  export * from "./GetBalanceLimitRequestVersion.js";
8
8
  export * from "./GetContactBalancesResponse.js";
9
9
  export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort.js";
10
+ export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus.js";
11
+ export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType.js";
10
12
  export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryResponse.js";
11
13
  export * from "./GetSubscriptionBalancesResponse.js";
12
14
  export * from "./PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse.js";
@@ -23,6 +23,8 @@ __exportStar(require("./GetBalanceDefinitionRequestVersion.js"), exports);
23
23
  __exportStar(require("./GetBalanceLimitRequestVersion.js"), exports);
24
24
  __exportStar(require("./GetContactBalancesResponse.js"), exports);
25
25
  __exportStar(require("./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort.js"), exports);
26
+ __exportStar(require("./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus.js"), exports);
27
+ __exportStar(require("./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType.js"), exports);
26
28
  __exportStar(require("./GetLoyaltyBalanceProgramsPidTransactionHistoryResponse.js"), exports);
27
29
  __exportStar(require("./GetSubscriptionBalancesResponse.js"), exports);
28
30
  __exportStar(require("./PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse.js"), exports);
@@ -447,7 +447,7 @@ export declare class ContactsClient {
447
447
  private __getContactInfo;
448
448
  /**
449
449
  * <Note>Follow this format when passing a "SMS" phone number as an attribute.
450
- * Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx</Note>
450
+ * Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx <br><br> If a blocklisted contact's email address is updated, it is going to remove that blocklisting from the contact and they will be resubscribed.</Note>
451
451
  * There are 2 ways to update a contact <br><br> Option 1- https://api.brevo.com/v3/contacts/{identifier} <br><br> Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={} <br> <br> 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. <br><br> 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
452
452
  *
453
453
  * @param {Brevo.UpdateContactRequest} request
@@ -1580,7 +1580,7 @@ class ContactsClient {
1580
1580
  }
1581
1581
  /**
1582
1582
  * <Note>Follow this format when passing a "SMS" phone number as an attribute.
1583
- * Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx</Note>
1583
+ * Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx <br><br> If a blocklisted contact's email address is updated, it is going to remove that blocklisting from the contact and they will be resubscribed.</Note>
1584
1584
  * There are 2 ways to update a contact <br><br> Option 1- https://api.brevo.com/v3/contacts/{identifier} <br><br> Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={} <br> <br> 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. <br><br> 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
1585
1585
  *
1586
1586
  * @param {Brevo.UpdateContactRequest} request
@@ -17,17 +17,21 @@ export declare namespace CreateUpdateBatchProductsRequest {
17
17
  type Products = Products.Item[];
18
18
  namespace Products {
19
19
  interface Item {
20
+ /** Brand of the product */
21
+ brand?: string | undefined;
20
22
  /** Category ID-s of the product */
21
23
  categories?: string[] | undefined;
22
24
  /** UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the product deleted from the shop's database */
23
25
  deletedAt?: string | undefined;
26
+ /** Description of the product */
27
+ description?: string | undefined;
24
28
  /** Product ID for which you requested the details */
25
29
  id: string;
26
30
  /** Absolute URL to the cover image of the product */
27
31
  imageUrl?: string | undefined;
28
32
  /** product deleted from the shop's database */
29
33
  isDeleted?: boolean | undefined;
30
- /** 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. */
34
+ /** Meta data of product such as description, vendor, producer, stock level. The total characters of cumulative metaInfo shall not exceed **20000 characters**. */
31
35
  metaInfo?: Record<string, Item.MetaInfo.Value> | undefined;
32
36
  /** Mandatory in case of creation**. Name of the product for which you requested the details */
33
37
  name: string;
@@ -6,17 +6,21 @@
6
6
  * }
7
7
  */
8
8
  export interface CreateUpdateProductRequest {
9
+ /** Brand of the product */
10
+ brand?: string;
9
11
  /** Category ID-s of the product */
10
12
  categories?: string[];
11
13
  /** UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) of the product deleted from the shop's database */
12
14
  deletedAt?: string;
15
+ /** Description of the product */
16
+ description?: string;
13
17
  /** Product ID for which you requested the details */
14
18
  id: string;
15
19
  /** Absolute URL to the cover image of the product */
16
20
  imageUrl?: string;
17
21
  /** product deleted from the shop's database */
18
22
  isDeleted?: boolean;
19
- /** 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. */
23
+ /** Meta data of product such as description, vendor, producer, stock level. The total characters of cumulative metaInfo shall not exceed **20000 characters**. */
20
24
  metaInfo?: Record<string, CreateUpdateProductRequest.MetaInfo.Value>;
21
25
  /** Mandatory in case of creation**. Name of the product for which you requested the details */
22
26
  name: string;
@@ -10,6 +10,25 @@ export declare namespace EventClient {
10
10
  export declare class EventClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<EventClient.Options>;
12
12
  constructor(options: EventClient.Options);
13
+ /**
14
+ * <Note>
15
+ * This endpoint currently only supports custom events.
16
+ * </Note>
17
+ *
18
+ * Retrieve a list of events filtered by various criteria.
19
+ *
20
+ * @param {Brevo.GetEventsRequest} request
21
+ * @param {EventClient.RequestOptions} requestOptions - Request-specific configuration.
22
+ *
23
+ * @throws {@link Brevo.BadRequestError}
24
+ * @throws {@link Brevo.UnauthorizedError}
25
+ * @throws {@link Brevo.InternalServerError}
26
+ *
27
+ * @example
28
+ * await client.event.getEvents()
29
+ */
30
+ getEvents(request?: Brevo.GetEventsRequest, requestOptions?: EventClient.RequestOptions): core.HttpResponsePromise<Brevo.GetEventsList>;
31
+ private __getEvents;
13
32
  /**
14
33
  * Create an event to track a contact's interaction.
15
34
  *
@@ -42,6 +61,6 @@ export declare class EventClient {
42
61
  * identifiers: {}
43
62
  * }])
44
63
  */
45
- createBatchEvents(request: Brevo.CreateBatchEventsRequestItem[], requestOptions?: EventClient.RequestOptions): core.HttpResponsePromise<void>;
64
+ createBatchEvents(request: Brevo.CreateBatchEventsRequestItem[], requestOptions?: EventClient.RequestOptions): core.HttpResponsePromise<Brevo.BatchAcceptedResponse>;
46
65
  private __createBatchEvents;
47
66
  }
@@ -55,6 +55,74 @@ class EventClient {
55
55
  constructor(options) {
56
56
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
57
  }
58
+ /**
59
+ * <Note>
60
+ * This endpoint currently only supports custom events.
61
+ * </Note>
62
+ *
63
+ * Retrieve a list of events filtered by various criteria.
64
+ *
65
+ * @param {Brevo.GetEventsRequest} request
66
+ * @param {EventClient.RequestOptions} requestOptions - Request-specific configuration.
67
+ *
68
+ * @throws {@link Brevo.BadRequestError}
69
+ * @throws {@link Brevo.UnauthorizedError}
70
+ * @throws {@link Brevo.InternalServerError}
71
+ *
72
+ * @example
73
+ * await client.event.getEvents()
74
+ */
75
+ getEvents(request = {}, requestOptions) {
76
+ return core.HttpResponsePromise.fromPromise(this.__getEvents(request, requestOptions));
77
+ }
78
+ __getEvents() {
79
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
80
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
81
+ const { contact_id: contactId, event_name: eventName, object_type: objectType, startDate, endDate, limit, offset, } = request;
82
+ const _queryParams = {
83
+ contact_id: contactId,
84
+ event_name: eventName,
85
+ object_type: objectType,
86
+ startDate,
87
+ endDate,
88
+ limit,
89
+ offset,
90
+ };
91
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
92
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
93
+ const _response = yield core.fetcher({
94
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.BrevoEnvironment.Default, "events"),
95
+ method: "GET",
96
+ headers: _headers,
97
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
98
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
99
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
100
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
101
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
102
+ logging: this._options.logging,
103
+ });
104
+ if (_response.ok) {
105
+ return { data: _response.body, rawResponse: _response.rawResponse };
106
+ }
107
+ if (_response.error.reason === "status-code") {
108
+ switch (_response.error.statusCode) {
109
+ case 400:
110
+ throw new Brevo.BadRequestError(_response.error.body, _response.rawResponse);
111
+ case 401:
112
+ throw new Brevo.UnauthorizedError(_response.error.body, _response.rawResponse);
113
+ case 500:
114
+ throw new Brevo.InternalServerError(_response.error.body, _response.rawResponse);
115
+ default:
116
+ throw new errors.BrevoError({
117
+ statusCode: _response.error.statusCode,
118
+ body: _response.error.body,
119
+ rawResponse: _response.rawResponse,
120
+ });
121
+ }
122
+ }
123
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/events");
124
+ });
125
+ }
58
126
  /**
59
127
  * Create an event to track a contact's interaction.
60
128
  *
@@ -150,7 +218,7 @@ class EventClient {
150
218
  logging: this._options.logging,
151
219
  });
152
220
  if (_response.ok) {
153
- return { data: undefined, rawResponse: _response.rawResponse };
221
+ return { data: _response.body, rawResponse: _response.rawResponse };
154
222
  }
155
223
  if (_response.error.reason === "status-code") {
156
224
  switch (_response.error.statusCode) {
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @example
3
+ * {}
4
+ */
5
+ export interface GetEventsRequest {
6
+ /** Filter by contact ID (repeatable) */
7
+ contact_id?: number | number[];
8
+ /** Filter by event name (repeatable) */
9
+ event_name?: string | string[];
10
+ /** Filter by object type (repeatable) */
11
+ object_type?: string | string[];
12
+ /** 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. */
13
+ startDate?: string;
14
+ /** Mandatory if startDate is used. End of date range (YYYY-MM-DD or RFC3339). Must be ≥ startDate. */
15
+ endDate?: string;
16
+ /** Max events to return. Default 100, min 1, max 10000. */
17
+ limit?: number;
18
+ /** Events to skip for pagination. Default 0, min 0. */
19
+ offset?: number;
20
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +1,2 @@
1
1
  export type { CreateEventRequest } from "./CreateEventRequest.js";
2
+ export type { GetEventsRequest } from "./GetEventsRequest.js";
@@ -489,11 +489,12 @@ class ProgramClient {
489
489
  __getParameterSubscriptionInfo(request, requestOptions) {
490
490
  return __awaiter(this, void 0, void 0, function* () {
491
491
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
492
- const { pid, contactId, params, loyaltySubscriptionId } = request;
492
+ const { pid, contactId, params, loyaltySubscriptionId, includeInternal } = request;
493
493
  const _queryParams = {
494
494
  contactId,
495
495
  params,
496
496
  loyaltySubscriptionId,
497
+ includeInternal,
497
498
  };
498
499
  const _authRequest = yield this._options.authProvider.getAuthRequest();
499
500
  const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
@@ -13,4 +13,6 @@ export interface GetParameterSubscriptionInfoRequest {
13
13
  params?: string;
14
14
  /** The loyalty subscription ID to filter by. */
15
15
  loyaltySubscriptionId?: string;
16
+ /** Include balances tied to internal definitions. */
17
+ includeInternal?: boolean;
16
18
  }
@@ -12,6 +12,8 @@ export interface CreateTierGroupRequest {
12
12
  downgradeStrategy?: CreateTierGroupRequest.DowngradeStrategy;
13
13
  /** Name of the tier group */
14
14
  name: string;
15
+ /** Additional metadata for the tier group. */
16
+ meta?: CreateTierGroupRequest.Meta;
15
17
  /** Order of the tiers in the group in ascending order */
16
18
  tierOrder?: string[];
17
19
  /** 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. */
@@ -25,6 +27,15 @@ export declare namespace CreateTierGroupRequest {
25
27
  readonly TierAnniversary: "tier_anniversary";
26
28
  };
27
29
  type DowngradeStrategy = (typeof DowngradeStrategy)[keyof typeof DowngradeStrategy];
30
+ /**
31
+ * Additional metadata for the tier group.
32
+ */
33
+ interface Meta {
34
+ /** Indicates whether the tier group is internal. */
35
+ isInternal?: boolean | undefined;
36
+ /** Accepts any additional properties */
37
+ [key: string]: any;
38
+ }
28
39
  /** 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. */
29
40
  const UpgradeStrategy: {
30
41
  readonly RealTime: "real_time";