@getbrevo/brevo 5.0.1 → 5.0.4
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.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +12 -0
- package/dist/cjs/Client.js +67 -0
- package/dist/cjs/api/resources/balance/client/Client.js +15 -6
- package/dist/cjs/api/resources/balance/client/requests/GetContactBalancesRequest.d.ts +2 -0
- package/dist/cjs/api/resources/balance/client/requests/GetLoyaltyBalanceProgramsPidActiveBalanceRequest.d.ts +2 -0
- package/dist/cjs/api/resources/balance/client/requests/GetLoyaltyBalanceProgramsPidTransactionHistoryRequest.d.ts +5 -1
- package/dist/cjs/api/resources/balance/client/requests/GetSubscriptionBalancesRequest.d.ts +2 -0
- package/dist/cjs/api/resources/balance/client/requests/PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequest.d.ts +10 -1
- package/dist/cjs/api/resources/balance/client/requests/UpdateBalanceDefinitionRequest.d.ts +10 -1
- package/dist/cjs/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus.d.ts +8 -0
- package/dist/cjs/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus.js +11 -0
- package/dist/cjs/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType.d.ts +5 -0
- package/dist/cjs/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType.js +8 -0
- package/dist/cjs/api/resources/balance/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/balance/types/index.js +2 -0
- package/dist/cjs/api/resources/contacts/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/contacts/client/Client.js +5 -2
- package/dist/cjs/api/resources/contacts/client/requests/CreateContactRequest.d.ts +1 -1
- package/dist/cjs/api/resources/contacts/client/requests/UpdateContactRequest.d.ts +1 -1
- package/dist/cjs/api/resources/ecommerce/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/ecommerce/client/Client.js +8 -2
- package/dist/cjs/api/resources/ecommerce/client/requests/CreateUpdateBatchProductsRequest.d.ts +5 -1
- package/dist/cjs/api/resources/ecommerce/client/requests/CreateUpdateProductRequest.d.ts +5 -1
- package/dist/cjs/api/resources/event/client/Client.d.ts +20 -1
- package/dist/cjs/api/resources/event/client/Client.js +69 -1
- package/dist/cjs/api/resources/event/client/requests/CreateEventRequest.d.ts +2 -2
- package/dist/cjs/api/resources/event/client/requests/GetEventsRequest.d.ts +20 -0
- package/dist/cjs/api/resources/event/client/requests/GetEventsRequest.js +3 -0
- package/dist/cjs/api/resources/event/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/event/types/CreateBatchEventsRequestItem.d.ts +2 -2
- package/dist/cjs/api/resources/process/types/GetProcessResponse.d.ts +3 -2
- package/dist/cjs/api/resources/process/types/GetProcessResponse.js +1 -0
- package/dist/cjs/api/resources/process/types/GetProcessesResponse.d.ts +3 -2
- package/dist/cjs/api/resources/process/types/GetProcessesResponse.js +1 -0
- package/dist/cjs/api/resources/program/client/Client.js +2 -1
- package/dist/cjs/api/resources/program/client/requests/GetParameterSubscriptionInfoRequest.d.ts +2 -0
- package/dist/cjs/api/resources/tier/client/requests/CreateTierGroupRequest.d.ts +11 -0
- package/dist/cjs/api/resources/tier/client/requests/UpdateTierGroupRequest.d.ts +11 -0
- package/dist/cjs/api/types/BatchAcceptedResponse.d.ts +9 -0
- package/dist/cjs/api/types/BatchAcceptedResponse.js +3 -0
- package/dist/cjs/api/types/GetEventsList.d.ts +32 -0
- package/dist/cjs/api/types/GetEventsList.js +3 -0
- package/dist/cjs/api/types/GetProductDetails.d.ts +4 -0
- package/dist/cjs/api/types/InternalServerErrorBody.d.ts +48 -0
- package/dist/cjs/api/types/InternalServerErrorBody.js +46 -0
- package/dist/cjs/api/types/index.d.ts +3 -0
- package/dist/cjs/api/types/index.js +3 -0
- package/dist/cjs/core/auth/BasicAuth.d.ts +2 -2
- package/dist/cjs/core/auth/BasicAuth.js +7 -1
- package/dist/cjs/core/fetcher/BinaryResponse.d.ts +1 -1
- package/dist/cjs/core/fetcher/Fetcher.d.ts +2 -0
- package/dist/cjs/core/fetcher/Fetcher.js +4 -0
- package/dist/cjs/core/fetcher/index.d.ts +2 -0
- package/dist/cjs/core/fetcher/index.js +3 -1
- package/dist/cjs/core/fetcher/makePassthroughRequest.d.ts +49 -0
- package/dist/cjs/core/fetcher/makePassthroughRequest.js +135 -0
- package/dist/cjs/core/file/file.js +3 -2
- package/dist/cjs/errors/BrevoError.d.ts +3 -1
- package/dist/cjs/errors/BrevoError.js +4 -1
- package/dist/cjs/errors/BrevoTimeoutError.d.ts +4 -1
- package/dist/cjs/errors/BrevoTimeoutError.js +4 -1
- package/dist/cjs/errors/handleNonStatusCodeError.js +4 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +12 -0
- package/dist/esm/Client.mjs +34 -0
- package/dist/esm/api/resources/balance/client/Client.mjs +15 -6
- package/dist/esm/api/resources/balance/client/requests/GetContactBalancesRequest.d.mts +2 -0
- package/dist/esm/api/resources/balance/client/requests/GetLoyaltyBalanceProgramsPidActiveBalanceRequest.d.mts +2 -0
- package/dist/esm/api/resources/balance/client/requests/GetLoyaltyBalanceProgramsPidTransactionHistoryRequest.d.mts +5 -1
- package/dist/esm/api/resources/balance/client/requests/GetSubscriptionBalancesRequest.d.mts +2 -0
- package/dist/esm/api/resources/balance/client/requests/PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequest.d.mts +10 -1
- package/dist/esm/api/resources/balance/client/requests/UpdateBalanceDefinitionRequest.d.mts +10 -1
- package/dist/esm/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus.d.mts +8 -0
- package/dist/esm/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus.mjs +8 -0
- package/dist/esm/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType.d.mts +5 -0
- package/dist/esm/api/resources/balance/types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType.mjs +5 -0
- package/dist/esm/api/resources/balance/types/index.d.mts +2 -0
- package/dist/esm/api/resources/balance/types/index.mjs +2 -0
- package/dist/esm/api/resources/contacts/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/contacts/client/Client.mjs +5 -2
- package/dist/esm/api/resources/contacts/client/requests/CreateContactRequest.d.mts +1 -1
- package/dist/esm/api/resources/contacts/client/requests/UpdateContactRequest.d.mts +1 -1
- package/dist/esm/api/resources/ecommerce/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/ecommerce/client/Client.mjs +8 -2
- package/dist/esm/api/resources/ecommerce/client/requests/CreateUpdateBatchProductsRequest.d.mts +5 -1
- package/dist/esm/api/resources/ecommerce/client/requests/CreateUpdateProductRequest.d.mts +5 -1
- package/dist/esm/api/resources/event/client/Client.d.mts +20 -1
- package/dist/esm/api/resources/event/client/Client.mjs +69 -1
- package/dist/esm/api/resources/event/client/requests/CreateEventRequest.d.mts +2 -2
- package/dist/esm/api/resources/event/client/requests/GetEventsRequest.d.mts +20 -0
- package/dist/esm/api/resources/event/client/requests/GetEventsRequest.mjs +2 -0
- package/dist/esm/api/resources/event/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/event/types/CreateBatchEventsRequestItem.d.mts +2 -2
- package/dist/esm/api/resources/process/types/GetProcessResponse.d.mts +3 -2
- package/dist/esm/api/resources/process/types/GetProcessResponse.mjs +1 -0
- package/dist/esm/api/resources/process/types/GetProcessesResponse.d.mts +3 -2
- package/dist/esm/api/resources/process/types/GetProcessesResponse.mjs +1 -0
- package/dist/esm/api/resources/program/client/Client.mjs +2 -1
- package/dist/esm/api/resources/program/client/requests/GetParameterSubscriptionInfoRequest.d.mts +2 -0
- package/dist/esm/api/resources/tier/client/requests/CreateTierGroupRequest.d.mts +11 -0
- package/dist/esm/api/resources/tier/client/requests/UpdateTierGroupRequest.d.mts +11 -0
- package/dist/esm/api/types/BatchAcceptedResponse.d.mts +9 -0
- package/dist/esm/api/types/BatchAcceptedResponse.mjs +2 -0
- package/dist/esm/api/types/GetEventsList.d.mts +32 -0
- package/dist/esm/api/types/GetEventsList.mjs +2 -0
- package/dist/esm/api/types/GetProductDetails.d.mts +4 -0
- package/dist/esm/api/types/InternalServerErrorBody.d.mts +48 -0
- package/dist/esm/api/types/InternalServerErrorBody.mjs +43 -0
- package/dist/esm/api/types/index.d.mts +3 -0
- package/dist/esm/api/types/index.mjs +3 -0
- package/dist/esm/core/auth/BasicAuth.d.mts +2 -2
- package/dist/esm/core/auth/BasicAuth.mjs +7 -1
- package/dist/esm/core/fetcher/BinaryResponse.d.mts +1 -1
- package/dist/esm/core/fetcher/Fetcher.d.mts +2 -0
- package/dist/esm/core/fetcher/Fetcher.mjs +4 -0
- package/dist/esm/core/fetcher/index.d.mts +2 -0
- package/dist/esm/core/fetcher/index.mjs +1 -0
- package/dist/esm/core/fetcher/makePassthroughRequest.d.mts +49 -0
- package/dist/esm/core/fetcher/makePassthroughRequest.mjs +132 -0
- package/dist/esm/core/file/file.mjs +3 -2
- package/dist/esm/errors/BrevoError.d.mts +3 -1
- package/dist/esm/errors/BrevoError.mjs +4 -1
- package/dist/esm/errors/BrevoTimeoutError.d.mts +4 -1
- package/dist/esm/errors/BrevoTimeoutError.mjs +4 -1
- package/dist/esm/errors/handleNonStatusCodeError.mjs +4 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +7 -7
- package/reference.md +72 -5
|
@@ -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
|
+
}
|
|
@@ -85,7 +85,7 @@ function getFileWithMetadata(file_1) {
|
|
|
85
85
|
}
|
|
86
86
|
if ("path" in file) {
|
|
87
87
|
const fs = yield Promise.resolve().then(() => __importStar(require("fs")));
|
|
88
|
-
if (!fs ||
|
|
88
|
+
if (!(fs === null || fs === void 0 ? void 0 : fs.createReadStream)) {
|
|
89
89
|
throw new Error("File path uploads are not supported in this environment.");
|
|
90
90
|
}
|
|
91
91
|
const data = fs.createReadStream(file.path);
|
|
@@ -126,9 +126,10 @@ function isFileLike(value) {
|
|
|
126
126
|
}
|
|
127
127
|
function tryGetFileSizeFromPath(path) {
|
|
128
128
|
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
var _a;
|
|
129
130
|
try {
|
|
130
131
|
const fs = yield Promise.resolve().then(() => __importStar(require("fs")));
|
|
131
|
-
if (!fs ||
|
|
132
|
+
if (!((_a = fs === null || fs === void 0 ? void 0 : fs.promises) === null || _a === void 0 ? void 0 : _a.stat)) {
|
|
132
133
|
return undefined;
|
|
133
134
|
}
|
|
134
135
|
const fileStat = yield fs.promises.stat(path);
|
|
@@ -3,10 +3,12 @@ export declare class BrevoError extends Error {
|
|
|
3
3
|
readonly statusCode?: number;
|
|
4
4
|
readonly body?: unknown;
|
|
5
5
|
readonly rawResponse?: core.RawResponse;
|
|
6
|
-
|
|
6
|
+
readonly cause?: unknown;
|
|
7
|
+
constructor({ message, statusCode, body, rawResponse, cause, }: {
|
|
7
8
|
message?: string;
|
|
8
9
|
statusCode?: number;
|
|
9
10
|
body?: unknown;
|
|
10
11
|
rawResponse?: core.RawResponse;
|
|
12
|
+
cause?: unknown;
|
|
11
13
|
});
|
|
12
14
|
}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.BrevoError = void 0;
|
|
5
5
|
const json_js_1 = require("../core/json.js");
|
|
6
6
|
class BrevoError extends Error {
|
|
7
|
-
constructor({ message, statusCode, body, rawResponse, }) {
|
|
7
|
+
constructor({ message, statusCode, body, rawResponse, cause, }) {
|
|
8
8
|
super(buildMessage({ message, statusCode, body }));
|
|
9
9
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
10
10
|
if (Error.captureStackTrace) {
|
|
@@ -14,6 +14,9 @@ class BrevoError extends Error {
|
|
|
14
14
|
this.statusCode = statusCode;
|
|
15
15
|
this.body = body;
|
|
16
16
|
this.rawResponse = rawResponse;
|
|
17
|
+
if (cause != null) {
|
|
18
|
+
this.cause = cause;
|
|
19
|
+
}
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
exports.BrevoError = BrevoError;
|
|
@@ -3,13 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.BrevoTimeoutError = void 0;
|
|
5
5
|
class BrevoTimeoutError extends Error {
|
|
6
|
-
constructor(message) {
|
|
6
|
+
constructor(message, opts) {
|
|
7
7
|
super(message);
|
|
8
8
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
9
9
|
if (Error.captureStackTrace) {
|
|
10
10
|
Error.captureStackTrace(this, this.constructor);
|
|
11
11
|
}
|
|
12
12
|
this.name = this.constructor.name;
|
|
13
|
+
if ((opts === null || opts === void 0 ? void 0 : opts.cause) != null) {
|
|
14
|
+
this.cause = opts.cause;
|
|
15
|
+
}
|
|
13
16
|
}
|
|
14
17
|
}
|
|
15
18
|
exports.BrevoTimeoutError = BrevoTimeoutError;
|
|
@@ -50,11 +50,14 @@ function handleNonStatusCodeError(error, rawResponse, method, path) {
|
|
|
50
50
|
rawResponse: rawResponse,
|
|
51
51
|
});
|
|
52
52
|
case "timeout":
|
|
53
|
-
throw new errors.BrevoTimeoutError(`Timeout exceeded when calling ${method} ${path}
|
|
53
|
+
throw new errors.BrevoTimeoutError(`Timeout exceeded when calling ${method} ${path}.`, {
|
|
54
|
+
cause: error.cause,
|
|
55
|
+
});
|
|
54
56
|
case "unknown":
|
|
55
57
|
throw new errors.BrevoError({
|
|
56
58
|
message: error.errorMessage,
|
|
57
59
|
rawResponse: rawResponse,
|
|
60
|
+
cause: error.cause,
|
|
58
61
|
});
|
|
59
62
|
default:
|
|
60
63
|
throw new errors.BrevoError({
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "5.0.
|
|
1
|
+
export declare const SDK_VERSION = "5.0.4";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -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.
|
|
10
|
-
"User-Agent": "@getbrevo/brevo/5.0.
|
|
9
|
+
"X-Fern-SDK-Version": "5.0.4",
|
|
10
|
+
"User-Agent": "@getbrevo/brevo/5.0.4",
|
|
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);
|
package/dist/esm/Client.d.mts
CHANGED
|
@@ -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
|
}
|
package/dist/esm/Client.mjs
CHANGED
|
@@ -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);
|
|
@@ -12,7 +12,7 @@ export interface GetLoyaltyBalanceProgramsPidTransactionHistoryRequest {
|
|
|
12
12
|
pid: string;
|
|
13
13
|
/** Limit the number of records returned */
|
|
14
14
|
limit?: number;
|
|
15
|
-
/**
|
|
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
|
}
|
|
@@ -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?:
|
|
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?:
|
|
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,5 @@
|
|
|
1
|
+
export declare const GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType: {
|
|
2
|
+
readonly Credit: "credit";
|
|
3
|
+
readonly Debit: "debit";
|
|
4
|
+
};
|
|
5
|
+
export type GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType = (typeof GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType)[keyof typeof GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType];
|
|
@@ -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";
|
|
@@ -36,7 +36,7 @@ export declare class ContactsClient {
|
|
|
36
36
|
* @example
|
|
37
37
|
* await client.contacts.createContact()
|
|
38
38
|
*/
|
|
39
|
-
createContact(request?: Brevo.CreateContactRequest, requestOptions?: ContactsClient.RequestOptions): core.HttpResponsePromise<Brevo.CreateContactResponse>;
|
|
39
|
+
createContact(request?: Brevo.CreateContactRequest, requestOptions?: ContactsClient.RequestOptions): core.HttpResponsePromise<Brevo.CreateContactResponse | undefined>;
|
|
40
40
|
private __createContact;
|
|
41
41
|
/**
|
|
42
42
|
* @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -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
|
|
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
|
|
@@ -127,7 +127,10 @@ export class ContactsClient {
|
|
|
127
127
|
logging: this._options.logging,
|
|
128
128
|
});
|
|
129
129
|
if (_response.ok) {
|
|
130
|
-
return {
|
|
130
|
+
return {
|
|
131
|
+
data: _response.body,
|
|
132
|
+
rawResponse: _response.rawResponse,
|
|
133
|
+
};
|
|
131
134
|
}
|
|
132
135
|
if (_response.error.reason === "status-code") {
|
|
133
136
|
switch (_response.error.statusCode) {
|
|
@@ -1544,7 +1547,7 @@ export class ContactsClient {
|
|
|
1544
1547
|
}
|
|
1545
1548
|
/**
|
|
1546
1549
|
* <Note>Follow this format when passing a "SMS" phone number as an attribute.
|
|
1547
|
-
* Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx
|
|
1550
|
+
* 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
1551
|
* 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
1552
|
*
|
|
1550
1553
|
* @param {Brevo.UpdateContactRequest} request
|