@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
@@ -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,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,46 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.InternalServerErrorBody = void 0;
5
+ var InternalServerErrorBody;
6
+ (function (InternalServerErrorBody) {
7
+ /** Error code displayed in case of a failure */
8
+ InternalServerErrorBody.Code = {
9
+ InvalidParameter: "invalid_parameter",
10
+ MissingParameter: "missing_parameter",
11
+ OutOfRange: "out_of_range",
12
+ CampaignProcessing: "campaign_processing",
13
+ CampaignSent: "campaign_sent",
14
+ DocumentNotFound: "document_not_found",
15
+ NotEnoughCredits: "not_enough_credits",
16
+ PermissionDenied: "permission_denied",
17
+ DuplicateParameter: "duplicate_parameter",
18
+ DuplicateRequest: "duplicate_request",
19
+ MethodNotAllowed: "method_not_allowed",
20
+ Unauthorized: "unauthorized",
21
+ AccountUnderValidation: "account_under_validation",
22
+ NotAcceptable: "not_acceptable",
23
+ BadRequest: "bad_request",
24
+ UnprocessableEntity: "unprocessable_entity",
25
+ DomainDoesNotExist: "Domain does not exist",
26
+ ContactEmailNotFound: "Contact email not found",
27
+ AttributeNotFound: "Attribute not found",
28
+ CategoryIdNotFound: "Category id not found",
29
+ InvalidParametersPassed: "Invalid parameters passed",
30
+ RecordSForIdentifierNotFound: "Record(s) for identifier not found",
31
+ ReturnedWhenQueryParamsAreInvalid: "Returned when query params are invalid",
32
+ ReturnedWhenInvalidDataPosted: "Returned when invalid data posted",
33
+ FeedNotFound: "Feed not found",
34
+ CampaignIdNotFound: "Campaign ID not found",
35
+ ApiKeyNotFound: "api-key not found",
36
+ DmarcPolicyRequiresDomainAuthentication: "DMARC policy requires domain authentication",
37
+ DnsRecordsNotProperlyConfigured: "DNS records not properly configured",
38
+ InvalidOtpCodeProvided: "Invalid OTP code provided",
39
+ OtpCodeHasExpired: "OTP code has expired",
40
+ DomainAlreadyExistsInYourAccount: "Domain already exists in your account",
41
+ TheSumOfAllIpWeightsMustEqual100: "The sum of all IP weights must equal 100",
42
+ AuthenticationFailed: "Authentication failed",
43
+ InsufficientCredits: "Insufficient credits",
44
+ RequestAlreadyProcessed: "Request already processed",
45
+ };
46
+ })(InternalServerErrorBody || (exports.InternalServerErrorBody = InternalServerErrorBody = {}));
@@ -4,6 +4,7 @@ export * from "./AbTestVersionStats.js";
4
4
  export * from "./BadRequestErrorBody.js";
5
5
  export * from "./BalanceDefinition.js";
6
6
  export * from "./BalanceLimit.js";
7
+ export * from "./BatchAcceptedResponse.js";
7
8
  export * from "./BatchEventsResponse.js";
8
9
  export * from "./Cart.js";
9
10
  export * from "./Company.js";
@@ -23,6 +24,7 @@ export * from "./GetContactDetails.js";
23
24
  export * from "./GetContacts.js";
24
25
  export * from "./GetCouponCollection.js";
25
26
  export * from "./GetDeviceBrowserStats.js";
27
+ export * from "./GetEventsList.js";
26
28
  export * from "./GetExtendedCampaignOverview.js";
27
29
  export * from "./GetExtendedCampaignStats.js";
28
30
  export * from "./GetFolder.js";
@@ -33,6 +35,7 @@ export * from "./GetSmsCampaignStats.js";
33
35
  export * from "./GetSmtpTemplateOverview.js";
34
36
  export * from "./GetSsoToken.js";
35
37
  export * from "./GetWebhook.js";
38
+ export * from "./InternalServerErrorBody.js";
36
39
  export * from "./Inviteuser.js";
37
40
  export * from "./LoyaltyProgram.js";
38
41
  export * from "./NodeResponse.js";
@@ -20,6 +20,7 @@ __exportStar(require("./AbTestVersionStats.js"), exports);
20
20
  __exportStar(require("./BadRequestErrorBody.js"), exports);
21
21
  __exportStar(require("./BalanceDefinition.js"), exports);
22
22
  __exportStar(require("./BalanceLimit.js"), exports);
23
+ __exportStar(require("./BatchAcceptedResponse.js"), exports);
23
24
  __exportStar(require("./BatchEventsResponse.js"), exports);
24
25
  __exportStar(require("./Cart.js"), exports);
25
26
  __exportStar(require("./Company.js"), exports);
@@ -39,6 +40,7 @@ __exportStar(require("./GetContactDetails.js"), exports);
39
40
  __exportStar(require("./GetContacts.js"), exports);
40
41
  __exportStar(require("./GetCouponCollection.js"), exports);
41
42
  __exportStar(require("./GetDeviceBrowserStats.js"), exports);
43
+ __exportStar(require("./GetEventsList.js"), exports);
42
44
  __exportStar(require("./GetExtendedCampaignOverview.js"), exports);
43
45
  __exportStar(require("./GetExtendedCampaignStats.js"), exports);
44
46
  __exportStar(require("./GetFolder.js"), exports);
@@ -49,6 +51,7 @@ __exportStar(require("./GetSmsCampaignStats.js"), exports);
49
51
  __exportStar(require("./GetSmtpTemplateOverview.js"), exports);
50
52
  __exportStar(require("./GetSsoToken.js"), exports);
51
53
  __exportStar(require("./GetWebhook.js"), exports);
54
+ __exportStar(require("./InternalServerErrorBody.js"), exports);
52
55
  __exportStar(require("./Inviteuser.js"), exports);
53
56
  __exportStar(require("./LoyaltyProgram.js"), exports);
54
57
  __exportStar(require("./NodeResponse.js"), exports);
@@ -14,6 +14,6 @@ export type BinaryResponse = {
14
14
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes)
15
15
  * Some versions of the Fetch API may not support this method.
16
16
  */
17
- bytes?(): ReturnType<Response["bytes"]>;
17
+ bytes?(): Promise<Uint8Array>;
18
18
  };
19
19
  export declare function getBinaryResponse(response: Response): BinaryResponse;
@@ -6,6 +6,8 @@ export type { Fetcher, FetchFunction } from "./Fetcher.js";
6
6
  export { fetcher } from "./Fetcher.js";
7
7
  export { getHeader } from "./getHeader.js";
8
8
  export { HttpResponsePromise } from "./HttpResponsePromise.js";
9
+ export type { PassthroughRequest } from "./makePassthroughRequest.js";
10
+ export { makePassthroughRequest } from "./makePassthroughRequest.js";
9
11
  export type { RawResponse, WithRawResponse } from "./RawResponse.js";
10
12
  export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js";
11
13
  export { Supplier } from "./Supplier.js";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Supplier = exports.unknownRawResponse = exports.toRawResponse = exports.abortRawResponse = exports.HttpResponsePromise = exports.getHeader = exports.fetcher = exports.EndpointSupplier = void 0;
3
+ exports.Supplier = exports.unknownRawResponse = exports.toRawResponse = exports.abortRawResponse = exports.makePassthroughRequest = exports.HttpResponsePromise = exports.getHeader = exports.fetcher = exports.EndpointSupplier = void 0;
4
4
  var EndpointSupplier_js_1 = require("./EndpointSupplier.js");
5
5
  Object.defineProperty(exports, "EndpointSupplier", { enumerable: true, get: function () { return EndpointSupplier_js_1.EndpointSupplier; } });
6
6
  var Fetcher_js_1 = require("./Fetcher.js");
@@ -9,6 +9,8 @@ var getHeader_js_1 = require("./getHeader.js");
9
9
  Object.defineProperty(exports, "getHeader", { enumerable: true, get: function () { return getHeader_js_1.getHeader; } });
10
10
  var HttpResponsePromise_js_1 = require("./HttpResponsePromise.js");
11
11
  Object.defineProperty(exports, "HttpResponsePromise", { enumerable: true, get: function () { return HttpResponsePromise_js_1.HttpResponsePromise; } });
12
+ var makePassthroughRequest_js_1 = require("./makePassthroughRequest.js");
13
+ Object.defineProperty(exports, "makePassthroughRequest", { enumerable: true, get: function () { return makePassthroughRequest_js_1.makePassthroughRequest; } });
12
14
  var RawResponse_js_1 = require("./RawResponse.js");
13
15
  Object.defineProperty(exports, "abortRawResponse", { enumerable: true, get: function () { return RawResponse_js_1.abortRawResponse; } });
14
16
  Object.defineProperty(exports, "toRawResponse", { enumerable: true, get: function () { return RawResponse_js_1.toRawResponse; } });
@@ -0,0 +1,49 @@
1
+ import { type LogConfig, type Logger } from "../logging/logger.js";
2
+ import { Supplier } from "./Supplier.js";
3
+ export declare namespace PassthroughRequest {
4
+ /**
5
+ * Per-request options that can override the SDK client defaults.
6
+ */
7
+ interface RequestOptions {
8
+ /** Override the default timeout for this request (in seconds). */
9
+ timeoutInSeconds?: number;
10
+ /** Override the default number of retries for this request. */
11
+ maxRetries?: number;
12
+ /** Additional headers to include in this request. */
13
+ headers?: Record<string, string>;
14
+ /** Abort signal for this request. */
15
+ abortSignal?: AbortSignal;
16
+ }
17
+ /**
18
+ * SDK client configuration used by the passthrough fetch method.
19
+ */
20
+ interface ClientOptions {
21
+ /** The base URL or environment for the client. */
22
+ environment?: Supplier<string>;
23
+ /** Override the base URL. */
24
+ baseUrl?: Supplier<string>;
25
+ /** Default headers to include in requests. */
26
+ headers?: Record<string, unknown>;
27
+ /** Default maximum time to wait for a response in seconds. */
28
+ timeoutInSeconds?: number;
29
+ /** Default number of times to retry the request. Defaults to 2. */
30
+ maxRetries?: number;
31
+ /** A custom fetch function. */
32
+ fetch?: typeof fetch;
33
+ /** Logging configuration. */
34
+ logging?: LogConfig | Logger;
35
+ /** A function that returns auth headers. */
36
+ getAuthHeaders?: () => Promise<Record<string, string>>;
37
+ }
38
+ }
39
+ /**
40
+ * Makes a passthrough HTTP request using the SDK's configuration (auth, retry, logging, etc.)
41
+ * while mimicking the standard `fetch` API.
42
+ *
43
+ * @param input - The URL, path, or Request object. If a relative path, it will be resolved against the configured base URL.
44
+ * @param init - Standard RequestInit options (method, headers, body, signal, etc.)
45
+ * @param clientOptions - SDK client options (auth, default headers, logging, etc.)
46
+ * @param requestOptions - Per-request overrides (timeout, retries, extra headers, abort signal).
47
+ * @returns A standard Response object.
48
+ */
49
+ export declare function makePassthroughRequest(input: Request | string | URL, init: RequestInit | undefined, clientOptions: PassthroughRequest.ClientOptions, requestOptions?: PassthroughRequest.RequestOptions): Promise<Response>;
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.makePassthroughRequest = makePassthroughRequest;
13
+ const logger_js_1 = require("../logging/logger.js");
14
+ const join_js_1 = require("../url/join.js");
15
+ const EndpointSupplier_js_1 = require("./EndpointSupplier.js");
16
+ const getFetchFn_js_1 = require("./getFetchFn.js");
17
+ const makeRequest_js_1 = require("./makeRequest.js");
18
+ const requestWithRetries_js_1 = require("./requestWithRetries.js");
19
+ const Supplier_js_1 = require("./Supplier.js");
20
+ /**
21
+ * Makes a passthrough HTTP request using the SDK's configuration (auth, retry, logging, etc.)
22
+ * while mimicking the standard `fetch` API.
23
+ *
24
+ * @param input - The URL, path, or Request object. If a relative path, it will be resolved against the configured base URL.
25
+ * @param init - Standard RequestInit options (method, headers, body, signal, etc.)
26
+ * @param clientOptions - SDK client options (auth, default headers, logging, etc.)
27
+ * @param requestOptions - Per-request overrides (timeout, retries, extra headers, abort signal).
28
+ * @returns A standard Response object.
29
+ */
30
+ function makePassthroughRequest(input, init, clientOptions, requestOptions) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ var _a, _b, _c, _d, _e, _f, _g;
33
+ const logger = (0, logger_js_1.createLogger)(clientOptions.logging);
34
+ // Extract URL and default init properties from Request object if provided
35
+ let url;
36
+ let effectiveInit = init;
37
+ if (input instanceof Request) {
38
+ url = input.url;
39
+ // If no explicit init provided, extract properties from the Request object
40
+ if (init == null) {
41
+ effectiveInit = {
42
+ method: input.method,
43
+ headers: Object.fromEntries(input.headers.entries()),
44
+ body: input.body,
45
+ signal: input.signal,
46
+ credentials: input.credentials,
47
+ cache: input.cache,
48
+ redirect: input.redirect,
49
+ referrer: input.referrer,
50
+ integrity: input.integrity,
51
+ mode: input.mode,
52
+ };
53
+ }
54
+ }
55
+ else {
56
+ url = input instanceof URL ? input.toString() : input;
57
+ }
58
+ // Resolve the base URL
59
+ const baseUrl = (_a = (clientOptions.baseUrl != null ? yield Supplier_js_1.Supplier.get(clientOptions.baseUrl) : undefined)) !== null && _a !== void 0 ? _a : (clientOptions.environment != null ? yield Supplier_js_1.Supplier.get(clientOptions.environment) : undefined);
60
+ // Determine the full URL
61
+ let fullUrl;
62
+ if (url.startsWith("http://") || url.startsWith("https://")) {
63
+ fullUrl = url;
64
+ }
65
+ else if (baseUrl != null) {
66
+ fullUrl = (0, join_js_1.join)(baseUrl, url);
67
+ }
68
+ else {
69
+ fullUrl = url;
70
+ }
71
+ // Merge headers: SDK default headers -> auth headers -> user-provided headers
72
+ const mergedHeaders = {};
73
+ // Apply SDK default headers (resolve suppliers)
74
+ if (clientOptions.headers != null) {
75
+ for (const [key, value] of Object.entries(clientOptions.headers)) {
76
+ const resolved = yield EndpointSupplier_js_1.EndpointSupplier.get(value, { endpointMetadata: {} });
77
+ if (resolved != null) {
78
+ mergedHeaders[key.toLowerCase()] = `${resolved}`;
79
+ }
80
+ }
81
+ }
82
+ // Apply auth headers
83
+ if (clientOptions.getAuthHeaders != null) {
84
+ const authHeaders = yield clientOptions.getAuthHeaders();
85
+ for (const [key, value] of Object.entries(authHeaders)) {
86
+ mergedHeaders[key.toLowerCase()] = value;
87
+ }
88
+ }
89
+ // Apply user-provided headers from init
90
+ if ((effectiveInit === null || effectiveInit === void 0 ? void 0 : effectiveInit.headers) != null) {
91
+ const initHeaders = effectiveInit.headers instanceof Headers
92
+ ? Object.fromEntries(effectiveInit.headers.entries())
93
+ : Array.isArray(effectiveInit.headers)
94
+ ? Object.fromEntries(effectiveInit.headers)
95
+ : effectiveInit.headers;
96
+ for (const [key, value] of Object.entries(initHeaders)) {
97
+ if (value != null) {
98
+ mergedHeaders[key.toLowerCase()] = value;
99
+ }
100
+ }
101
+ }
102
+ // Apply per-request option headers (highest priority)
103
+ if ((requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers) != null) {
104
+ for (const [key, value] of Object.entries(requestOptions.headers)) {
105
+ mergedHeaders[key.toLowerCase()] = value;
106
+ }
107
+ }
108
+ const method = (_b = effectiveInit === null || effectiveInit === void 0 ? void 0 : effectiveInit.method) !== null && _b !== void 0 ? _b : "GET";
109
+ const body = effectiveInit === null || effectiveInit === void 0 ? void 0 : effectiveInit.body;
110
+ const timeoutInSeconds = (_c = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _c !== void 0 ? _c : clientOptions.timeoutInSeconds;
111
+ const timeoutMs = timeoutInSeconds != null ? timeoutInSeconds * 1000 : undefined;
112
+ const maxRetries = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _d !== void 0 ? _d : clientOptions.maxRetries;
113
+ const abortSignal = (_f = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal) !== null && _e !== void 0 ? _e : effectiveInit === null || effectiveInit === void 0 ? void 0 : effectiveInit.signal) !== null && _f !== void 0 ? _f : undefined;
114
+ const fetchFn = (_g = clientOptions.fetch) !== null && _g !== void 0 ? _g : (yield (0, getFetchFn_js_1.getFetchFn)());
115
+ if (logger.isDebug()) {
116
+ logger.debug("Making passthrough HTTP request", {
117
+ method,
118
+ url: fullUrl,
119
+ hasBody: body != null,
120
+ });
121
+ }
122
+ const response = yield (0, requestWithRetries_js_1.requestWithRetries)(() => __awaiter(this, void 0, void 0, function* () {
123
+ return (0, makeRequest_js_1.makeRequest)(fetchFn, fullUrl, method, mergedHeaders, body !== null && body !== void 0 ? body : undefined, timeoutMs, abortSignal, (effectiveInit === null || effectiveInit === void 0 ? void 0 : effectiveInit.credentials) === "include", undefined, // duplex
124
+ false);
125
+ }), maxRetries);
126
+ if (logger.isDebug()) {
127
+ logger.debug("Passthrough HTTP request completed", {
128
+ method,
129
+ url: fullUrl,
130
+ statusCode: response.status,
131
+ });
132
+ }
133
+ return response;
134
+ });
135
+ }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "5.0.1";
1
+ export declare const SDK_VERSION = "5.0.3";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "5.0.1";
4
+ exports.SDK_VERSION = "5.0.3";
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "@getbrevo/brevo",
9
- "X-Fern-SDK-Version": "5.0.1",
10
- "User-Agent": "@getbrevo/brevo/5.0.1",
9
+ "X-Fern-SDK-Version": "5.0.3",
10
+ "User-Agent": "@getbrevo/brevo/5.0.3",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -32,6 +32,7 @@ import { WebhooksClient } from "./api/resources/webhooks/client/Client.mjs";
32
32
  import { WhatsAppCampaignsClient } from "./api/resources/whatsAppCampaigns/client/Client.mjs";
33
33
  import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.mjs";
34
34
  import { type NormalizedClientOptionsWithAuth } from "./BaseClient.mjs";
35
+ import * as core from "./core/index.mjs";
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,4 +1,13 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  import { AccountClient } from "./api/resources/account/client/Client.mjs";
3
12
  import { BalanceClient } from "./api/resources/balance/client/Client.mjs";
4
13
  import { CompaniesClient } from "./api/resources/companies/client/Client.mjs";
@@ -32,6 +41,7 @@ import { UserClient } from "./api/resources/user/client/Client.mjs";
32
41
  import { WebhooksClient } from "./api/resources/webhooks/client/Client.mjs";
33
42
  import { WhatsAppCampaignsClient } from "./api/resources/whatsAppCampaigns/client/Client.mjs";
34
43
  import { normalizeClientOptionsWithAuth } from "./BaseClient.mjs";
44
+ import * as core from "./core/index.mjs";
35
45
  export class BrevoClient {
36
46
  constructor(options) {
37
47
  this._options = normalizeClientOptionsWithAuth(options);
@@ -164,4 +174,28 @@ export class BrevoClient {
164
174
  var _a;
165
175
  return ((_a = this._smsTemplates) !== null && _a !== void 0 ? _a : (this._smsTemplates = new SmsTemplatesClient(this._options)));
166
176
  }
177
+ /**
178
+ * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
179
+ * This is useful for making requests to endpoints not yet supported in the SDK.
180
+ * The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
181
+ *
182
+ * @param {Request | string | URL} input - The URL, path, or Request object.
183
+ * @param {RequestInit} init - Standard fetch RequestInit options.
184
+ * @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
185
+ * @returns {Promise<Response>} A standard Response object.
186
+ */
187
+ fetch(input, init, requestOptions) {
188
+ return __awaiter(this, void 0, void 0, function* () {
189
+ var _a;
190
+ return core.makePassthroughRequest(input, init, {
191
+ baseUrl: (_a = this._options.baseUrl) !== null && _a !== void 0 ? _a : this._options.environment,
192
+ headers: this._options.headers,
193
+ timeoutInSeconds: this._options.timeoutInSeconds,
194
+ maxRetries: this._options.maxRetries,
195
+ fetch: this._options.fetch,
196
+ logging: this._options.logging,
197
+ getAuthHeaders: () => __awaiter(this, void 0, void 0, function* () { return (yield this._options.authProvider.getAuthRequest()).headers; }),
198
+ }, requestOptions);
199
+ });
200
+ }
167
201
  }
@@ -55,7 +55,7 @@ export class BalanceClient {
55
55
  __getActiveBalancesApi(request, requestOptions) {
56
56
  return __awaiter(this, void 0, void 0, function* () {
57
57
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
58
- const { pid, limit, offset, sort_field: sortField, sort, contact_id: contactId, balance_definition_id: balanceDefinitionId, } = request;
58
+ const { pid, limit, offset, sort_field: sortField, sort, contact_id: contactId, balance_definition_id: balanceDefinitionId, includeInternal, } = request;
59
59
  const _queryParams = {
60
60
  limit,
61
61
  offset,
@@ -63,6 +63,7 @@ export class BalanceClient {
63
63
  sort,
64
64
  contact_id: contactId,
65
65
  balance_definition_id: balanceDefinitionId,
66
+ includeInternal,
66
67
  };
67
68
  const _authRequest = yield this._options.authProvider.getAuthRequest();
68
69
  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);
@@ -745,14 +746,17 @@ export class BalanceClient {
745
746
  __getContactBalances(request, requestOptions) {
746
747
  return __awaiter(this, void 0, void 0, function* () {
747
748
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
748
- const { pid } = request;
749
+ const { pid, includeInternal } = request;
750
+ const _queryParams = {
751
+ includeInternal,
752
+ };
749
753
  const _authRequest = yield this._options.authProvider.getAuthRequest();
750
754
  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);
751
755
  const _response = yield core.fetcher({
752
756
  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`),
753
757
  method: "GET",
754
758
  headers: _headers,
755
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
759
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
756
760
  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,
757
761
  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,
758
762
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -877,14 +881,17 @@ export class BalanceClient {
877
881
  __getSubscriptionBalances(request, requestOptions) {
878
882
  return __awaiter(this, void 0, void 0, function* () {
879
883
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
880
- const { pid, cid } = request;
884
+ const { pid, cid, includeInternal } = request;
885
+ const _queryParams = {
886
+ includeInternal,
887
+ };
881
888
  const _authRequest = yield this._options.authProvider.getAuthRequest();
882
889
  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);
883
890
  const _response = yield core.fetcher({
884
891
  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`),
885
892
  method: "GET",
886
893
  headers: _headers,
887
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
894
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
888
895
  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,
889
896
  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,
890
897
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -1016,7 +1023,7 @@ export class BalanceClient {
1016
1023
  __getTransactionHistoryApi(request, requestOptions) {
1017
1024
  return __awaiter(this, void 0, void 0, function* () {
1018
1025
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1019
- const { pid, limit, offset, sortField, sort, contactId, balanceDefinitionId, filters } = request;
1026
+ const { pid, limit, offset, sortField, sort, contactId, balanceDefinitionId, filters, status, transactionType, } = request;
1020
1027
  const _queryParams = {
1021
1028
  limit,
1022
1029
  offset,
@@ -1025,6 +1032,8 @@ export class BalanceClient {
1025
1032
  contactId,
1026
1033
  balanceDefinitionId,
1027
1034
  filters,
1035
+ status: status != null ? status : undefined,
1036
+ transactionType: transactionType != null ? transactionType : undefined,
1028
1037
  };
1029
1038
  const _authRequest = yield this._options.authProvider.getAuthRequest();
1030
1039
  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);