@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
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "@getbrevo/brevo",
|
|
46
|
-
"X-Fern-SDK-Version": "5.0.
|
|
47
|
-
"User-Agent": "@getbrevo/brevo/5.0.
|
|
46
|
+
"X-Fern-SDK-Version": "5.0.4",
|
|
47
|
+
"User-Agent": "@getbrevo/brevo/5.0.4",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ import { WebhooksClient } from "./api/resources/webhooks/client/Client.js";
|
|
|
32
32
|
import { WhatsAppCampaignsClient } from "./api/resources/whatsAppCampaigns/client/Client.js";
|
|
33
33
|
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
|
|
34
34
|
import { type NormalizedClientOptionsWithAuth } from "./BaseClient.js";
|
|
35
|
+
import * as core from "./core/index.js";
|
|
35
36
|
export declare namespace BrevoClient {
|
|
36
37
|
type Options = BaseClientOptions;
|
|
37
38
|
interface RequestOptions extends BaseRequestOptions {
|
|
@@ -104,4 +105,15 @@ export declare class BrevoClient {
|
|
|
104
105
|
get transactionalEmails(): TransactionalEmailsClient;
|
|
105
106
|
get transactionalSms(): TransactionalSmsClient;
|
|
106
107
|
get smsTemplates(): SmsTemplatesClient;
|
|
108
|
+
/**
|
|
109
|
+
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
110
|
+
* This is useful for making requests to endpoints not yet supported in the SDK.
|
|
111
|
+
* The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
|
|
112
|
+
*
|
|
113
|
+
* @param {Request | string | URL} input - The URL, path, or Request object.
|
|
114
|
+
* @param {RequestInit} init - Standard fetch RequestInit options.
|
|
115
|
+
* @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
|
|
116
|
+
* @returns {Promise<Response>} A standard Response object.
|
|
117
|
+
*/
|
|
118
|
+
fetch(input: Request | string | URL, init?: RequestInit, requestOptions?: core.PassthroughRequest.RequestOptions): Promise<Response>;
|
|
107
119
|
}
|
package/dist/cjs/Client.js
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
3
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
46
|
exports.BrevoClient = void 0;
|
|
5
47
|
const Client_js_1 = require("./api/resources/account/client/Client.js");
|
|
@@ -35,6 +77,7 @@ const Client_js_30 = require("./api/resources/user/client/Client.js");
|
|
|
35
77
|
const Client_js_31 = require("./api/resources/webhooks/client/Client.js");
|
|
36
78
|
const Client_js_32 = require("./api/resources/whatsAppCampaigns/client/Client.js");
|
|
37
79
|
const BaseClient_js_1 = require("./BaseClient.js");
|
|
80
|
+
const core = __importStar(require("./core/index.js"));
|
|
38
81
|
class BrevoClient {
|
|
39
82
|
constructor(options) {
|
|
40
83
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
@@ -167,5 +210,29 @@ class BrevoClient {
|
|
|
167
210
|
var _a;
|
|
168
211
|
return ((_a = this._smsTemplates) !== null && _a !== void 0 ? _a : (this._smsTemplates = new Client_js_24.SmsTemplatesClient(this._options)));
|
|
169
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
215
|
+
* This is useful for making requests to endpoints not yet supported in the SDK.
|
|
216
|
+
* The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
|
|
217
|
+
*
|
|
218
|
+
* @param {Request | string | URL} input - The URL, path, or Request object.
|
|
219
|
+
* @param {RequestInit} init - Standard fetch RequestInit options.
|
|
220
|
+
* @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
|
|
221
|
+
* @returns {Promise<Response>} A standard Response object.
|
|
222
|
+
*/
|
|
223
|
+
fetch(input, init, requestOptions) {
|
|
224
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
225
|
+
var _a;
|
|
226
|
+
return core.makePassthroughRequest(input, init, {
|
|
227
|
+
baseUrl: (_a = this._options.baseUrl) !== null && _a !== void 0 ? _a : this._options.environment,
|
|
228
|
+
headers: this._options.headers,
|
|
229
|
+
timeoutInSeconds: this._options.timeoutInSeconds,
|
|
230
|
+
maxRetries: this._options.maxRetries,
|
|
231
|
+
fetch: this._options.fetch,
|
|
232
|
+
logging: this._options.logging,
|
|
233
|
+
getAuthHeaders: () => __awaiter(this, void 0, void 0, function* () { return (yield this._options.authProvider.getAuthRequest()).headers; }),
|
|
234
|
+
}, requestOptions);
|
|
235
|
+
});
|
|
236
|
+
}
|
|
170
237
|
}
|
|
171
238
|
exports.BrevoClient = BrevoClient;
|
|
@@ -91,7 +91,7 @@ class BalanceClient {
|
|
|
91
91
|
__getActiveBalancesApi(request, requestOptions) {
|
|
92
92
|
return __awaiter(this, void 0, void 0, function* () {
|
|
93
93
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
94
|
-
const { pid, limit, offset, sort_field: sortField, sort, contact_id: contactId, balance_definition_id: balanceDefinitionId, } = request;
|
|
94
|
+
const { pid, limit, offset, sort_field: sortField, sort, contact_id: contactId, balance_definition_id: balanceDefinitionId, includeInternal, } = request;
|
|
95
95
|
const _queryParams = {
|
|
96
96
|
limit,
|
|
97
97
|
offset,
|
|
@@ -99,6 +99,7 @@ class BalanceClient {
|
|
|
99
99
|
sort,
|
|
100
100
|
contact_id: contactId,
|
|
101
101
|
balance_definition_id: balanceDefinitionId,
|
|
102
|
+
includeInternal,
|
|
102
103
|
};
|
|
103
104
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
104
105
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
@@ -781,14 +782,17 @@ class BalanceClient {
|
|
|
781
782
|
__getContactBalances(request, requestOptions) {
|
|
782
783
|
return __awaiter(this, void 0, void 0, function* () {
|
|
783
784
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
784
|
-
const { pid } = request;
|
|
785
|
+
const { pid, includeInternal } = request;
|
|
786
|
+
const _queryParams = {
|
|
787
|
+
includeInternal,
|
|
788
|
+
};
|
|
785
789
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
786
790
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
787
791
|
const _response = yield core.fetcher({
|
|
788
792
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.BrevoEnvironment.Default, `loyalty/balance/programs/${core.url.encodePathParam(pid)}/contact-balances`),
|
|
789
793
|
method: "GET",
|
|
790
794
|
headers: _headers,
|
|
791
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
795
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
792
796
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
793
797
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
794
798
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -913,14 +917,17 @@ class BalanceClient {
|
|
|
913
917
|
__getSubscriptionBalances(request, requestOptions) {
|
|
914
918
|
return __awaiter(this, void 0, void 0, function* () {
|
|
915
919
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
916
|
-
const { pid, cid } = request;
|
|
920
|
+
const { pid, cid, includeInternal } = request;
|
|
921
|
+
const _queryParams = {
|
|
922
|
+
includeInternal,
|
|
923
|
+
};
|
|
917
924
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
918
925
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
919
926
|
const _response = yield core.fetcher({
|
|
920
927
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.BrevoEnvironment.Default, `loyalty/balance/programs/${core.url.encodePathParam(pid)}/subscriptions/${core.url.encodePathParam(cid)}/balances`),
|
|
921
928
|
method: "GET",
|
|
922
929
|
headers: _headers,
|
|
923
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
930
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
924
931
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
925
932
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
926
933
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -1052,7 +1059,7 @@ class BalanceClient {
|
|
|
1052
1059
|
__getTransactionHistoryApi(request, requestOptions) {
|
|
1053
1060
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1054
1061
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1055
|
-
const { pid, limit, offset, sortField, sort, contactId, balanceDefinitionId, filters } = request;
|
|
1062
|
+
const { pid, limit, offset, sortField, sort, contactId, balanceDefinitionId, filters, status, transactionType, } = request;
|
|
1056
1063
|
const _queryParams = {
|
|
1057
1064
|
limit,
|
|
1058
1065
|
offset,
|
|
@@ -1061,6 +1068,8 @@ class BalanceClient {
|
|
|
1061
1068
|
contactId,
|
|
1062
1069
|
balanceDefinitionId,
|
|
1063
1070
|
filters,
|
|
1071
|
+
status: status != null ? status : undefined,
|
|
1072
|
+
transactionType: transactionType != null ? transactionType : undefined,
|
|
1064
1073
|
};
|
|
1065
1074
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
1066
1075
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
@@ -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,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus = void 0;
|
|
5
|
+
exports.GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus = {
|
|
6
|
+
Draft: "draft",
|
|
7
|
+
Completed: "completed",
|
|
8
|
+
Rejected: "rejected",
|
|
9
|
+
Cancelled: "cancelled",
|
|
10
|
+
Expired: "expired",
|
|
11
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType: {
|
|
2
|
+
readonly Credit: "credit";
|
|
3
|
+
readonly Debit: "debit";
|
|
4
|
+
};
|
|
5
|
+
export type GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType = (typeof GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType)[keyof typeof GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType = void 0;
|
|
5
|
+
exports.GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType = {
|
|
6
|
+
Credit: "credit",
|
|
7
|
+
Debit: "debit",
|
|
8
|
+
};
|
|
@@ -7,6 +7,8 @@ export * from "./GetBalanceDefinitionRequestVersion.js";
|
|
|
7
7
|
export * from "./GetBalanceLimitRequestVersion.js";
|
|
8
8
|
export * from "./GetContactBalancesResponse.js";
|
|
9
9
|
export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort.js";
|
|
10
|
+
export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus.js";
|
|
11
|
+
export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType.js";
|
|
10
12
|
export * from "./GetLoyaltyBalanceProgramsPidTransactionHistoryResponse.js";
|
|
11
13
|
export * from "./GetSubscriptionBalancesResponse.js";
|
|
12
14
|
export * from "./PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse.js";
|
|
@@ -23,6 +23,8 @@ __exportStar(require("./GetBalanceDefinitionRequestVersion.js"), exports);
|
|
|
23
23
|
__exportStar(require("./GetBalanceLimitRequestVersion.js"), exports);
|
|
24
24
|
__exportStar(require("./GetContactBalancesResponse.js"), exports);
|
|
25
25
|
__exportStar(require("./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort.js"), exports);
|
|
26
|
+
__exportStar(require("./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus.js"), exports);
|
|
27
|
+
__exportStar(require("./GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType.js"), exports);
|
|
26
28
|
__exportStar(require("./GetLoyaltyBalanceProgramsPidTransactionHistoryResponse.js"), exports);
|
|
27
29
|
__exportStar(require("./GetSubscriptionBalancesResponse.js"), exports);
|
|
28
30
|
__exportStar(require("./PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse.js"), exports);
|
|
@@ -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
|
|
@@ -163,7 +163,10 @@ class ContactsClient {
|
|
|
163
163
|
logging: this._options.logging,
|
|
164
164
|
});
|
|
165
165
|
if (_response.ok) {
|
|
166
|
-
return {
|
|
166
|
+
return {
|
|
167
|
+
data: _response.body,
|
|
168
|
+
rawResponse: _response.rawResponse,
|
|
169
|
+
};
|
|
167
170
|
}
|
|
168
171
|
if (_response.error.reason === "status-code") {
|
|
169
172
|
switch (_response.error.statusCode) {
|
|
@@ -1580,7 +1583,7 @@ class ContactsClient {
|
|
|
1580
1583
|
}
|
|
1581
1584
|
/**
|
|
1582
1585
|
* <Note>Follow this format when passing a "SMS" phone number as an attribute.
|
|
1583
|
-
* Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx
|
|
1586
|
+
* Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx <br><br> If a blocklisted contact's email address is updated, it is going to remove that blocklisting from the contact and they will be resubscribed.</Note>
|
|
1584
1587
|
* There are 2 ways to update a contact <br><br> Option 1- https://api.brevo.com/v3/contacts/{identifier} <br><br> Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={} <br> <br> Option 1 only works if identifierType is email_id (for EMAIL) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL and ID of the contact. <br><br> Option 2 works for all identifierType, use email_id for EMAIL attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute
|
|
1585
1588
|
*
|
|
1586
1589
|
* @param {Brevo.UpdateContactRequest} request
|
|
@@ -32,7 +32,7 @@ export declare class EcommerceClient {
|
|
|
32
32
|
* id: "CAT123"
|
|
33
33
|
* })
|
|
34
34
|
*/
|
|
35
|
-
createUpdateCategory(request: Brevo.CreateUpdateCategoryRequest, requestOptions?: EcommerceClient.RequestOptions): core.HttpResponsePromise<Brevo.CreateUpdateCategoryResponse>;
|
|
35
|
+
createUpdateCategory(request: Brevo.CreateUpdateCategoryRequest, requestOptions?: EcommerceClient.RequestOptions): core.HttpResponsePromise<Brevo.CreateUpdateCategoryResponse | undefined>;
|
|
36
36
|
private __createUpdateCategory;
|
|
37
37
|
/**
|
|
38
38
|
* @param {Brevo.CreateUpdateBatchCategoryRequest} request
|
|
@@ -230,7 +230,7 @@ export declare class EcommerceClient {
|
|
|
230
230
|
* name: "Iphone 11"
|
|
231
231
|
* })
|
|
232
232
|
*/
|
|
233
|
-
createUpdateProduct(request: Brevo.CreateUpdateProductRequest, requestOptions?: EcommerceClient.RequestOptions): core.HttpResponsePromise<Brevo.CreateUpdateProductResponse>;
|
|
233
|
+
createUpdateProduct(request: Brevo.CreateUpdateProductRequest, requestOptions?: EcommerceClient.RequestOptions): core.HttpResponsePromise<Brevo.CreateUpdateProductResponse | undefined>;
|
|
234
234
|
private __createUpdateProduct;
|
|
235
235
|
/**
|
|
236
236
|
* @param {Brevo.CreateUpdateBatchProductsRequest} request
|
|
@@ -157,7 +157,10 @@ class EcommerceClient {
|
|
|
157
157
|
logging: this._options.logging,
|
|
158
158
|
});
|
|
159
159
|
if (_response.ok) {
|
|
160
|
-
return {
|
|
160
|
+
return {
|
|
161
|
+
data: _response.body,
|
|
162
|
+
rawResponse: _response.rawResponse,
|
|
163
|
+
};
|
|
161
164
|
}
|
|
162
165
|
if (_response.error.reason === "status-code") {
|
|
163
166
|
switch (_response.error.statusCode) {
|
|
@@ -895,7 +898,10 @@ class EcommerceClient {
|
|
|
895
898
|
logging: this._options.logging,
|
|
896
899
|
});
|
|
897
900
|
if (_response.ok) {
|
|
898
|
-
return {
|
|
901
|
+
return {
|
|
902
|
+
data: _response.body,
|
|
903
|
+
rawResponse: _response.rawResponse,
|
|
904
|
+
};
|
|
899
905
|
}
|
|
900
906
|
if (_response.error.reason === "status-code") {
|
|
901
907
|
switch (_response.error.statusCode) {
|
package/dist/cjs/api/resources/ecommerce/client/requests/CreateUpdateBatchProductsRequest.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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<
|
|
64
|
+
createBatchEvents(request: Brevo.CreateBatchEventsRequestItem[], requestOptions?: EventClient.RequestOptions): core.HttpResponsePromise<Brevo.BatchAcceptedResponse>;
|
|
46
65
|
private __createBatchEvents;
|
|
47
66
|
}
|
|
@@ -55,6 +55,74 @@ class EventClient {
|
|
|
55
55
|
constructor(options) {
|
|
56
56
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* <Note>
|
|
60
|
+
* This endpoint currently only supports custom events.
|
|
61
|
+
* </Note>
|
|
62
|
+
*
|
|
63
|
+
* Retrieve a list of events filtered by various criteria.
|
|
64
|
+
*
|
|
65
|
+
* @param {Brevo.GetEventsRequest} request
|
|
66
|
+
* @param {EventClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
67
|
+
*
|
|
68
|
+
* @throws {@link Brevo.BadRequestError}
|
|
69
|
+
* @throws {@link Brevo.UnauthorizedError}
|
|
70
|
+
* @throws {@link Brevo.InternalServerError}
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* await client.event.getEvents()
|
|
74
|
+
*/
|
|
75
|
+
getEvents(request = {}, requestOptions) {
|
|
76
|
+
return core.HttpResponsePromise.fromPromise(this.__getEvents(request, requestOptions));
|
|
77
|
+
}
|
|
78
|
+
__getEvents() {
|
|
79
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
80
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
81
|
+
const { contact_id: contactId, event_name: eventName, object_type: objectType, startDate, endDate, limit, offset, } = request;
|
|
82
|
+
const _queryParams = {
|
|
83
|
+
contact_id: contactId,
|
|
84
|
+
event_name: eventName,
|
|
85
|
+
object_type: objectType,
|
|
86
|
+
startDate,
|
|
87
|
+
endDate,
|
|
88
|
+
limit,
|
|
89
|
+
offset,
|
|
90
|
+
};
|
|
91
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
92
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
93
|
+
const _response = yield core.fetcher({
|
|
94
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.BrevoEnvironment.Default, "events"),
|
|
95
|
+
method: "GET",
|
|
96
|
+
headers: _headers,
|
|
97
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
98
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
99
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
100
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
101
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
102
|
+
logging: this._options.logging,
|
|
103
|
+
});
|
|
104
|
+
if (_response.ok) {
|
|
105
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
106
|
+
}
|
|
107
|
+
if (_response.error.reason === "status-code") {
|
|
108
|
+
switch (_response.error.statusCode) {
|
|
109
|
+
case 400:
|
|
110
|
+
throw new Brevo.BadRequestError(_response.error.body, _response.rawResponse);
|
|
111
|
+
case 401:
|
|
112
|
+
throw new Brevo.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
113
|
+
case 500:
|
|
114
|
+
throw new Brevo.InternalServerError(_response.error.body, _response.rawResponse);
|
|
115
|
+
default:
|
|
116
|
+
throw new errors.BrevoError({
|
|
117
|
+
statusCode: _response.error.statusCode,
|
|
118
|
+
body: _response.error.body,
|
|
119
|
+
rawResponse: _response.rawResponse,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/events");
|
|
124
|
+
});
|
|
125
|
+
}
|
|
58
126
|
/**
|
|
59
127
|
* Create an event to track a contact's interaction.
|
|
60
128
|
*
|
|
@@ -150,7 +218,7 @@ class EventClient {
|
|
|
150
218
|
logging: this._options.logging,
|
|
151
219
|
});
|
|
152
220
|
if (_response.ok) {
|
|
153
|
-
return { data:
|
|
221
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
154
222
|
}
|
|
155
223
|
if (_response.error.reason === "status-code") {
|
|
156
224
|
switch (_response.error.statusCode) {
|