@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
@@ -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,8 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export const GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus = {
3
+ Draft: "draft",
4
+ Completed: "completed",
5
+ Rejected: "rejected",
6
+ Cancelled: "cancelled",
7
+ Expired: "expired",
8
+ };
@@ -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,5 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export const GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType = {
3
+ Credit: "credit",
4
+ Debit: "debit",
5
+ };
@@ -7,6 +7,8 @@ export * from "./GetBalanceDefinitionRequestVersion.mjs";
7
7
  export * from "./GetBalanceLimitRequestVersion.mjs";
8
8
  export * from "./GetContactBalancesResponse.mjs";
9
9
  export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort.mjs";
10
+ export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus.mjs";
11
+ export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType.mjs";
10
12
  export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryResponse.mjs";
11
13
  export * from "./GetSubscriptionBalancesResponse.mjs";
12
14
  export * from "./PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse.mjs";
@@ -7,6 +7,8 @@ export * from "./GetBalanceDefinitionRequestVersion.mjs";
7
7
  export * from "./GetBalanceLimitRequestVersion.mjs";
8
8
  export * from "./GetContactBalancesResponse.mjs";
9
9
  export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort.mjs";
10
+ export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus.mjs";
11
+ export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType.mjs";
10
12
  export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryResponse.mjs";
11
13
  export * from "./GetSubscriptionBalancesResponse.mjs";
12
14
  export * from "./PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse.mjs";
@@ -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
@@ -1544,7 +1544,7 @@ export class ContactsClient {
1544
1544
  }
1545
1545
  /**
1546
1546
  * <Note>Follow this format when passing a "SMS" phone number as an attribute.
1547
- * Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx</Note>
1547
+ * 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>
1548
1548
  * 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
1549
1549
  *
1550
1550
  * @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
  }
@@ -19,6 +19,74 @@ export class EventClient {
19
19
  constructor(options) {
20
20
  this._options = normalizeClientOptionsWithAuth(options);
21
21
  }
22
+ /**
23
+ * <Note>
24
+ * This endpoint currently only supports custom events.
25
+ * </Note>
26
+ *
27
+ * Retrieve a list of events filtered by various criteria.
28
+ *
29
+ * @param {Brevo.GetEventsRequest} request
30
+ * @param {EventClient.RequestOptions} requestOptions - Request-specific configuration.
31
+ *
32
+ * @throws {@link Brevo.BadRequestError}
33
+ * @throws {@link Brevo.UnauthorizedError}
34
+ * @throws {@link Brevo.InternalServerError}
35
+ *
36
+ * @example
37
+ * await client.event.getEvents()
38
+ */
39
+ getEvents(request = {}, requestOptions) {
40
+ return core.HttpResponsePromise.fromPromise(this.__getEvents(request, requestOptions));
41
+ }
42
+ __getEvents() {
43
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
44
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
45
+ const { contact_id: contactId, event_name: eventName, object_type: objectType, startDate, endDate, limit, offset, } = request;
46
+ const _queryParams = {
47
+ contact_id: contactId,
48
+ event_name: eventName,
49
+ object_type: objectType,
50
+ startDate,
51
+ endDate,
52
+ limit,
53
+ offset,
54
+ };
55
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
56
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
57
+ const _response = yield core.fetcher({
58
+ 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"),
59
+ method: "GET",
60
+ headers: _headers,
61
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
62
+ 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,
63
+ 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,
64
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
65
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
66
+ logging: this._options.logging,
67
+ });
68
+ if (_response.ok) {
69
+ return { data: _response.body, rawResponse: _response.rawResponse };
70
+ }
71
+ if (_response.error.reason === "status-code") {
72
+ switch (_response.error.statusCode) {
73
+ case 400:
74
+ throw new Brevo.BadRequestError(_response.error.body, _response.rawResponse);
75
+ case 401:
76
+ throw new Brevo.UnauthorizedError(_response.error.body, _response.rawResponse);
77
+ case 500:
78
+ throw new Brevo.InternalServerError(_response.error.body, _response.rawResponse);
79
+ default:
80
+ throw new errors.BrevoError({
81
+ statusCode: _response.error.statusCode,
82
+ body: _response.error.body,
83
+ rawResponse: _response.rawResponse,
84
+ });
85
+ }
86
+ }
87
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/events");
88
+ });
89
+ }
22
90
  /**
23
91
  * Create an event to track a contact's interaction.
24
92
  *
@@ -114,7 +182,7 @@ export class EventClient {
114
182
  logging: this._options.logging,
115
183
  });
116
184
  if (_response.ok) {
117
- return { data: undefined, rawResponse: _response.rawResponse };
185
+ return { data: _response.body, rawResponse: _response.rawResponse };
118
186
  }
119
187
  if (_response.error.reason === "status-code") {
120
188
  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,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1 +1,2 @@
1
1
  export type { CreateEventRequest } from "./CreateEventRequest.mjs";
2
+ export type { GetEventsRequest } from "./GetEventsRequest.mjs";
@@ -453,11 +453,12 @@ export class ProgramClient {
453
453
  __getParameterSubscriptionInfo(request, requestOptions) {
454
454
  return __awaiter(this, void 0, void 0, function* () {
455
455
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
456
- const { pid, contactId, params, loyaltySubscriptionId } = request;
456
+ const { pid, contactId, params, loyaltySubscriptionId, includeInternal } = request;
457
457
  const _queryParams = {
458
458
  contactId,
459
459
  params,
460
460
  loyaltySubscriptionId,
461
+ includeInternal,
461
462
  };
462
463
  const _authRequest = yield this._options.authProvider.getAuthRequest();
463
464
  const _headers = 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";
@@ -18,6 +18,8 @@ export interface UpdateTierGroupRequest {
18
18
  downgradeStrategy: UpdateTierGroupRequest.DowngradeStrategy;
19
19
  /** Name of the tier group */
20
20
  name: string;
21
+ /** Additional metadata for the tier group. */
22
+ meta?: UpdateTierGroupRequest.Meta;
21
23
  /** Order of the tiers in the group in ascending order */
22
24
  tierOrder: string[];
23
25
  /** 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. */
@@ -31,6 +33,15 @@ export declare namespace UpdateTierGroupRequest {
31
33
  readonly TierAnniversary: "tier_anniversary";
32
34
  };
33
35
  type DowngradeStrategy = (typeof DowngradeStrategy)[keyof typeof DowngradeStrategy];
36
+ /**
37
+ * Additional metadata for the tier group.
38
+ */
39
+ interface Meta {
40
+ /** Indicates whether the tier group is internal. */
41
+ isInternal?: boolean | undefined;
42
+ /** Accepts any additional properties */
43
+ [key: string]: any;
44
+ }
34
45
  /** 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. */
35
46
  const UpgradeStrategy: {
36
47
  readonly RealTime: "real_time";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Response returned when all events in the batch are accepted for async processing
3
+ */
4
+ export interface BatchAcceptedResponse {
5
+ /** Confirmation message indicating the batch was accepted */
6
+ message: string;
7
+ /** Number of events queued for processing */
8
+ count: number;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Response containing a list of events and the total count for pagination
3
+ */
4
+ export interface GetEventsList {
5
+ /** List of matching events ordered by event_date descending */
6
+ events?: GetEventsList.Events.Item[] | undefined;
7
+ /** Total count of events matching the filters (use for pagination) */
8
+ count: number;
9
+ }
10
+ export declare namespace GetEventsList {
11
+ type Events = Events.Item[];
12
+ namespace Events {
13
+ interface Item {
14
+ /** Contact ID associated with the event */
15
+ contact_id?: number | undefined;
16
+ /** Date and time of the event */
17
+ event_date?: string | undefined;
18
+ /** Name of the event */
19
+ event_name?: string | undefined;
20
+ /** Filter ID of the event */
21
+ event_filter_id?: string | undefined;
22
+ /** Source of the event */
23
+ source?: string | undefined;
24
+ /** Object type associated with the event */
25
+ object_type?: string | undefined;
26
+ /** Event-level custom properties */
27
+ event_properties?: Record<string, unknown> | undefined;
28
+ /** Contact-level properties at time of event */
29
+ contact_properties?: Record<string, unknown> | undefined;
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,8 +1,12 @@
1
1
  export interface GetProductDetails {
2
+ /** Brand of the product */
3
+ brand?: string | undefined;
2
4
  /** Category ID-s of the product */
3
5
  categories?: string[] | undefined;
4
6
  /** Creation UTC date-time of the product (YYYY-MM-DDTHH:mm:ss.SSSZ) */
5
7
  createdAt: string;
8
+ /** Description of the product */
9
+ description?: string | undefined;
6
10
  /** Product ID for which you requested the details */
7
11
  id: string;
8
12
  /** Absolute URL to the cover image of the product */
@@ -0,0 +1,48 @@
1
+ export interface InternalServerErrorBody {
2
+ /** Error code displayed in case of a failure */
3
+ code: InternalServerErrorBody.Code;
4
+ /** Readable message associated to the failure */
5
+ message: string;
6
+ }
7
+ export declare namespace InternalServerErrorBody {
8
+ /** Error code displayed in case of a failure */
9
+ const Code: {
10
+ readonly InvalidParameter: "invalid_parameter";
11
+ readonly MissingParameter: "missing_parameter";
12
+ readonly OutOfRange: "out_of_range";
13
+ readonly CampaignProcessing: "campaign_processing";
14
+ readonly CampaignSent: "campaign_sent";
15
+ readonly DocumentNotFound: "document_not_found";
16
+ readonly NotEnoughCredits: "not_enough_credits";
17
+ readonly PermissionDenied: "permission_denied";
18
+ readonly DuplicateParameter: "duplicate_parameter";
19
+ readonly DuplicateRequest: "duplicate_request";
20
+ readonly MethodNotAllowed: "method_not_allowed";
21
+ readonly Unauthorized: "unauthorized";
22
+ readonly AccountUnderValidation: "account_under_validation";
23
+ readonly NotAcceptable: "not_acceptable";
24
+ readonly BadRequest: "bad_request";
25
+ readonly UnprocessableEntity: "unprocessable_entity";
26
+ readonly DomainDoesNotExist: "Domain does not exist";
27
+ readonly ContactEmailNotFound: "Contact email not found";
28
+ readonly AttributeNotFound: "Attribute not found";
29
+ readonly CategoryIdNotFound: "Category id not found";
30
+ readonly InvalidParametersPassed: "Invalid parameters passed";
31
+ readonly RecordSForIdentifierNotFound: "Record(s) for identifier not found";
32
+ readonly ReturnedWhenQueryParamsAreInvalid: "Returned when query params are invalid";
33
+ readonly ReturnedWhenInvalidDataPosted: "Returned when invalid data posted";
34
+ readonly FeedNotFound: "Feed not found";
35
+ readonly CampaignIdNotFound: "Campaign ID not found";
36
+ readonly ApiKeyNotFound: "api-key not found";
37
+ readonly DmarcPolicyRequiresDomainAuthentication: "DMARC policy requires domain authentication";
38
+ readonly DnsRecordsNotProperlyConfigured: "DNS records not properly configured";
39
+ readonly InvalidOtpCodeProvided: "Invalid OTP code provided";
40
+ readonly OtpCodeHasExpired: "OTP code has expired";
41
+ readonly DomainAlreadyExistsInYourAccount: "Domain already exists in your account";
42
+ readonly TheSumOfAllIpWeightsMustEqual100: "The sum of all IP weights must equal 100";
43
+ readonly AuthenticationFailed: "Authentication failed";
44
+ readonly InsufficientCredits: "Insufficient credits";
45
+ readonly RequestAlreadyProcessed: "Request already processed";
46
+ };
47
+ type Code = (typeof Code)[keyof typeof Code];
48
+ }
@@ -0,0 +1,43 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export var InternalServerErrorBody;
3
+ (function (InternalServerErrorBody) {
4
+ /** Error code displayed in case of a failure */
5
+ InternalServerErrorBody.Code = {
6
+ InvalidParameter: "invalid_parameter",
7
+ MissingParameter: "missing_parameter",
8
+ OutOfRange: "out_of_range",
9
+ CampaignProcessing: "campaign_processing",
10
+ CampaignSent: "campaign_sent",
11
+ DocumentNotFound: "document_not_found",
12
+ NotEnoughCredits: "not_enough_credits",
13
+ PermissionDenied: "permission_denied",
14
+ DuplicateParameter: "duplicate_parameter",
15
+ DuplicateRequest: "duplicate_request",
16
+ MethodNotAllowed: "method_not_allowed",
17
+ Unauthorized: "unauthorized",
18
+ AccountUnderValidation: "account_under_validation",
19
+ NotAcceptable: "not_acceptable",
20
+ BadRequest: "bad_request",
21
+ UnprocessableEntity: "unprocessable_entity",
22
+ DomainDoesNotExist: "Domain does not exist",
23
+ ContactEmailNotFound: "Contact email not found",
24
+ AttributeNotFound: "Attribute not found",
25
+ CategoryIdNotFound: "Category id not found",
26
+ InvalidParametersPassed: "Invalid parameters passed",
27
+ RecordSForIdentifierNotFound: "Record(s) for identifier not found",
28
+ ReturnedWhenQueryParamsAreInvalid: "Returned when query params are invalid",
29
+ ReturnedWhenInvalidDataPosted: "Returned when invalid data posted",
30
+ FeedNotFound: "Feed not found",
31
+ CampaignIdNotFound: "Campaign ID not found",
32
+ ApiKeyNotFound: "api-key not found",
33
+ DmarcPolicyRequiresDomainAuthentication: "DMARC policy requires domain authentication",
34
+ DnsRecordsNotProperlyConfigured: "DNS records not properly configured",
35
+ InvalidOtpCodeProvided: "Invalid OTP code provided",
36
+ OtpCodeHasExpired: "OTP code has expired",
37
+ DomainAlreadyExistsInYourAccount: "Domain already exists in your account",
38
+ TheSumOfAllIpWeightsMustEqual100: "The sum of all IP weights must equal 100",
39
+ AuthenticationFailed: "Authentication failed",
40
+ InsufficientCredits: "Insufficient credits",
41
+ RequestAlreadyProcessed: "Request already processed",
42
+ };
43
+ })(InternalServerErrorBody || (InternalServerErrorBody = {}));
@@ -4,6 +4,7 @@ export * from "./AbTestVersionStats.mjs";
4
4
  export * from "./BadRequestErrorBody.mjs";
5
5
  export * from "./BalanceDefinition.mjs";
6
6
  export * from "./BalanceLimit.mjs";
7
+ export * from "./BatchAcceptedResponse.mjs";
7
8
  export * from "./BatchEventsResponse.mjs";
8
9
  export * from "./Cart.mjs";
9
10
  export * from "./Company.mjs";
@@ -23,6 +24,7 @@ export * from "./GetContactDetails.mjs";
23
24
  export * from "./GetContacts.mjs";
24
25
  export * from "./GetCouponCollection.mjs";
25
26
  export * from "./GetDeviceBrowserStats.mjs";
27
+ export * from "./GetEventsList.mjs";
26
28
  export * from "./GetExtendedCampaignOverview.mjs";
27
29
  export * from "./GetExtendedCampaignStats.mjs";
28
30
  export * from "./GetFolder.mjs";
@@ -33,6 +35,7 @@ export * from "./GetSmsCampaignStats.mjs";
33
35
  export * from "./GetSmtpTemplateOverview.mjs";
34
36
  export * from "./GetSsoToken.mjs";
35
37
  export * from "./GetWebhook.mjs";
38
+ export * from "./InternalServerErrorBody.mjs";
36
39
  export * from "./Inviteuser.mjs";
37
40
  export * from "./LoyaltyProgram.mjs";
38
41
  export * from "./NodeResponse.mjs";