@artaio/node-api 1.8.0 → 1.9.1

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 (33) hide show
  1. package/dist/lib/ArtaClient.js +57 -144
  2. package/dist/lib/arta.js +29 -30
  3. package/dist/lib/endpoint/addressVerifications.js +13 -16
  4. package/dist/lib/endpoint/attachment.js +13 -16
  5. package/dist/lib/endpoint/emailRules.js +16 -19
  6. package/dist/lib/endpoint/emailSubscriptions.js +16 -19
  7. package/dist/lib/endpoint/endpoint.js +44 -160
  8. package/dist/lib/endpoint/hostedSessions.js +19 -70
  9. package/dist/lib/endpoint/invoicePayments.js +17 -27
  10. package/dist/lib/endpoint/invoices.js +11 -14
  11. package/dist/lib/endpoint/keys.js +15 -18
  12. package/dist/lib/endpoint/logs.js +17 -27
  13. package/dist/lib/endpoint/metadata.js +63 -64
  14. package/dist/lib/endpoint/organization.js +12 -67
  15. package/dist/lib/endpoint/payments.js +17 -27
  16. package/dist/lib/endpoint/requests.js +35 -113
  17. package/dist/lib/endpoint/selfShipCollectionAvailabilityChecks.js +6 -47
  18. package/dist/lib/endpoint/selfShipCollections.js +13 -16
  19. package/dist/lib/endpoint/shipments.d.ts +3 -0
  20. package/dist/lib/endpoint/shipments.js +21 -23
  21. package/dist/lib/endpoint/tags.js +13 -16
  22. package/dist/lib/endpoint/trackings.js +12 -66
  23. package/dist/lib/endpoint/uploads.js +13 -16
  24. package/dist/lib/endpoint/webhookDeliveries.js +9 -12
  25. package/dist/lib/endpoint/webhooks.js +37 -112
  26. package/dist/lib/error.js +14 -35
  27. package/dist/lib/logging.js +18 -48
  28. package/dist/lib/net/FetchHttpClient.js +43 -108
  29. package/dist/lib/queryParams.js +5 -6
  30. package/dist/lib/types.d.ts +3 -3
  31. package/dist/lib/utils.js +10 -17
  32. package/dist/package.json +24 -18
  33. package/package.json +24 -18
@@ -1,98 +1,50 @@
1
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
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
2
  Object.defineProperty(exports, "__esModule", { value: true });
39
3
  exports.ArtaClient = void 0;
40
- var error_1 = require("./error");
41
- var package_json_1 = require("../package.json");
42
- var logging_1 = require("./logging");
43
- var ArtaClient = /** @class */ (function () {
44
- function ArtaClient(httpClient, config) {
4
+ const error_1 = require("./error");
5
+ const package_json_1 = require("../package.json");
6
+ const logging_1 = require("./logging");
7
+ class ArtaClient {
8
+ constructor(httpClient, config) {
45
9
  this.httpClient = httpClient;
46
10
  this.config = config;
47
11
  this.logger = (0, logging_1.getLogger)();
48
12
  }
49
- ArtaClient.prototype.request = function (params) {
50
- return __awaiter(this, void 0, void 0, function () {
51
- var authValue, req, message, errorResponse;
52
- return __generator(this, function (_a) {
53
- switch (_a.label) {
54
- case 0:
55
- authValue = this.makeArtaAuthHeader(this.config.apiKey);
56
- if (params.headers == null) {
57
- params.headers = {
58
- 'Content-Type': 'application/json',
59
- 'User-Agent': "ARTA/v1 arta-node/".concat(package_json_1.version),
60
- };
61
- }
62
- if (params.headers.Authorization == null) {
63
- params.headers.Authorization = authValue;
64
- }
65
- return [4 /*yield*/, this.httpClient.request(this.config.host, params)];
66
- case 1:
67
- req = _a.sent();
68
- message = "[".concat(req.statusCode, "] ").concat(params.method, " ").concat(params.path);
69
- if (!(req.statusCode && req.statusCode >= 400)) return [3 /*break*/, 3];
70
- return [4 /*yield*/, req.json()];
71
- case 2:
72
- errorResponse = _a.sent();
73
- this.logger.error(message);
74
- this.logger.debug('Error body', errorResponse);
75
- throw new error_1.ArtaSDKError(errorResponse, req.statusCode);
76
- case 3:
77
- this.logger.info(message);
78
- return [2 /*return*/, req];
79
- }
80
- });
81
- });
82
- };
83
- ArtaClient.prototype.makeReqParams = function (path, method, auth, body) {
84
- var reqParams = {
85
- path: path,
86
- method: method,
13
+ async request(params) {
14
+ const authValue = this.makeArtaAuthHeader(this.config.apiKey);
15
+ if (params.headers == null) {
16
+ params.headers = {
17
+ 'Content-Type': 'application/json',
18
+ 'User-Agent': `ARTA/v1 arta-node/${package_json_1.version}`,
19
+ };
20
+ }
21
+ if (params.headers.Authorization == null) {
22
+ params.headers.Authorization = authValue;
23
+ }
24
+ const req = await this.httpClient.request(this.config.host, params);
25
+ const message = `[${req.statusCode}] ${params.method} ${params.path}`;
26
+ if (req.statusCode && req.statusCode >= 400) {
27
+ const errorResponse = await req.json();
28
+ this.logger.error(message);
29
+ this.logger.debug('Error body', errorResponse);
30
+ throw new error_1.ArtaSDKError(errorResponse, req.statusCode);
31
+ }
32
+ this.logger.info(message);
33
+ return req;
34
+ }
35
+ makeReqParams(path, method, auth, body) {
36
+ const reqParams = {
37
+ path,
38
+ method,
87
39
  headers: {
88
- 'User-Agent': "ARTA/v1 arta-node/".concat(package_json_1.version),
40
+ 'User-Agent': `ARTA/v1 arta-node/${package_json_1.version}`,
89
41
  'Content-Type': 'application/json',
90
42
  },
91
43
  };
92
44
  if (auth) {
93
45
  if (reqParams.headers == null) {
94
46
  reqParams.headers = {
95
- 'User-Agent': "ARTA/v1 arta-node/".concat(package_json_1.version),
47
+ 'User-Agent': `ARTA/v1 arta-node/${package_json_1.version}`,
96
48
  'Content-Type': 'application/json',
97
49
  };
98
50
  }
@@ -102,67 +54,28 @@ var ArtaClient = /** @class */ (function () {
102
54
  reqParams.requestData = body;
103
55
  }
104
56
  return reqParams;
105
- };
106
- ArtaClient.prototype.makeArtaAuthHeader = function (apiKey) {
107
- return "ARTA_APIKey ".concat(apiKey);
108
- };
109
- ArtaClient.prototype.get = function (path, auth) {
110
- return __awaiter(this, void 0, void 0, function () {
111
- var reqParams, res;
112
- return __generator(this, function (_a) {
113
- switch (_a.label) {
114
- case 0:
115
- reqParams = this.makeReqParams(path, 'GET', auth);
116
- return [4 /*yield*/, this.request(reqParams)];
117
- case 1:
118
- res = _a.sent();
119
- return [2 /*return*/, res.json()];
120
- }
121
- });
122
- });
123
- };
124
- ArtaClient.prototype.post = function (path, payload, auth) {
125
- return __awaiter(this, void 0, void 0, function () {
126
- var reqParams, res;
127
- return __generator(this, function (_a) {
128
- switch (_a.label) {
129
- case 0:
130
- reqParams = this.makeReqParams(path, 'POST', auth, JSON.stringify(payload));
131
- return [4 /*yield*/, this.request(reqParams)];
132
- case 1:
133
- res = _a.sent();
134
- return [2 /*return*/, res.json()];
135
- }
136
- });
137
- });
138
- };
139
- ArtaClient.prototype.patch = function (path, payload, auth) {
140
- return __awaiter(this, void 0, void 0, function () {
141
- var reqParams, res;
142
- return __generator(this, function (_a) {
143
- switch (_a.label) {
144
- case 0:
145
- reqParams = this.makeReqParams(path, 'PATCH', auth, JSON.stringify(payload));
146
- return [4 /*yield*/, this.request(reqParams)];
147
- case 1:
148
- res = _a.sent();
149
- return [2 /*return*/, res.json()];
150
- }
151
- });
152
- });
153
- };
154
- ArtaClient.prototype.delete = function (path, auth) {
155
- return __awaiter(this, void 0, void 0, function () {
156
- return __generator(this, function (_a) {
157
- switch (_a.label) {
158
- case 0: return [4 /*yield*/, this.request(this.makeReqParams(path, 'DELETE', auth))];
159
- case 1:
160
- _a.sent();
161
- return [2 /*return*/, Promise.resolve()];
162
- }
163
- });
164
- });
165
- };
166
- return ArtaClient;
167
- }());
57
+ }
58
+ makeArtaAuthHeader(apiKey) {
59
+ return `ARTA_APIKey ${apiKey}`;
60
+ }
61
+ async get(path, auth) {
62
+ const reqParams = this.makeReqParams(path, 'GET', auth);
63
+ const res = await this.request(reqParams);
64
+ return res.json();
65
+ }
66
+ async post(path, payload, auth) {
67
+ const reqParams = this.makeReqParams(path, 'POST', auth, JSON.stringify(payload));
68
+ const res = await this.request(reqParams);
69
+ return res.json();
70
+ }
71
+ async patch(path, payload, auth) {
72
+ const reqParams = this.makeReqParams(path, 'PATCH', auth, JSON.stringify(payload));
73
+ const res = await this.request(reqParams);
74
+ return res.json();
75
+ }
76
+ async delete(path, auth) {
77
+ await this.request(this.makeReqParams(path, 'DELETE', auth));
78
+ return Promise.resolve();
79
+ }
80
+ }
168
81
  exports.ArtaClient = ArtaClient;
package/dist/lib/arta.js CHANGED
@@ -1,41 +1,41 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Arta = void 0;
4
- var ArtaClient_1 = require("./ArtaClient");
5
- var logging_1 = require("./logging");
6
- var FetchHttpClient_1 = require("./net/FetchHttpClient");
7
- var addressVerifications_1 = require("./endpoint/addressVerifications");
8
- var attachment_1 = require("./endpoint/attachment");
9
- var emailRules_1 = require("./endpoint/emailRules");
10
- var emailSubscriptions_1 = require("./endpoint/emailSubscriptions");
11
- var hostedSessions_1 = require("./endpoint/hostedSessions");
12
- var invoicePayments_1 = require("./endpoint/invoicePayments");
13
- var invoices_1 = require("./endpoint/invoices");
14
- var keys_1 = require("./endpoint/keys");
15
- var logs_1 = require("./endpoint/logs");
16
- var metadata_1 = require("./endpoint/metadata");
17
- var organization_1 = require("./endpoint/organization");
18
- var payments_1 = require("./endpoint/payments");
19
- var uploads_1 = require("./endpoint/uploads");
20
- var webhookDeliveries_1 = require("./endpoint/webhookDeliveries");
21
- var webhooks_1 = require("./endpoint/webhooks");
22
- var trackings_1 = require("./endpoint/trackings");
23
- var requests_1 = require("./endpoint/requests");
24
- var selfShipCollectionAvailabilityChecks_1 = require("./endpoint/selfShipCollectionAvailabilityChecks");
25
- var selfShipCollections_1 = require("./endpoint/selfShipCollections");
26
- var shipments_1 = require("./endpoint/shipments");
27
- var tags_1 = require("./endpoint/tags");
28
- var defaultConfig = {
4
+ const ArtaClient_1 = require("./ArtaClient");
5
+ const logging_1 = require("./logging");
6
+ const FetchHttpClient_1 = require("./net/FetchHttpClient");
7
+ const addressVerifications_1 = require("./endpoint/addressVerifications");
8
+ const attachment_1 = require("./endpoint/attachment");
9
+ const emailRules_1 = require("./endpoint/emailRules");
10
+ const emailSubscriptions_1 = require("./endpoint/emailSubscriptions");
11
+ const hostedSessions_1 = require("./endpoint/hostedSessions");
12
+ const invoicePayments_1 = require("./endpoint/invoicePayments");
13
+ const invoices_1 = require("./endpoint/invoices");
14
+ const keys_1 = require("./endpoint/keys");
15
+ const logs_1 = require("./endpoint/logs");
16
+ const metadata_1 = require("./endpoint/metadata");
17
+ const organization_1 = require("./endpoint/organization");
18
+ const payments_1 = require("./endpoint/payments");
19
+ const uploads_1 = require("./endpoint/uploads");
20
+ const webhookDeliveries_1 = require("./endpoint/webhookDeliveries");
21
+ const webhooks_1 = require("./endpoint/webhooks");
22
+ const trackings_1 = require("./endpoint/trackings");
23
+ const requests_1 = require("./endpoint/requests");
24
+ const selfShipCollectionAvailabilityChecks_1 = require("./endpoint/selfShipCollectionAvailabilityChecks");
25
+ const selfShipCollections_1 = require("./endpoint/selfShipCollections");
26
+ const shipments_1 = require("./endpoint/shipments");
27
+ const tags_1 = require("./endpoint/tags");
28
+ const defaultConfig = {
29
29
  host: 'api.arta.io',
30
30
  verbosity: 'ERROR',
31
31
  logger: console,
32
32
  };
33
- var Arta = /** @class */ (function () {
34
- function Arta(apiKey, config) {
33
+ class Arta {
34
+ constructor(apiKey, config) {
35
35
  this.config = Object.assign(defaultConfig, config);
36
36
  (0, logging_1.initLogger)(this.config.logger, this.config.verbosity);
37
37
  this.artaClient = new ArtaClient_1.ArtaClient(new FetchHttpClient_1.FetchHttpClient(), {
38
- apiKey: apiKey,
38
+ apiKey,
39
39
  host: this.config.host,
40
40
  });
41
41
  this.address_verifications = new addressVerifications_1.AddressVerificationsEndpoint(this.artaClient);
@@ -61,6 +61,5 @@ var Arta = /** @class */ (function () {
61
61
  this.webhook_deliveries = new webhookDeliveries_1.WebhookDeliveriesEndpoint(this.artaClient);
62
62
  this.webhooks = new webhooks_1.WebhooksEndpoint(this.artaClient);
63
63
  }
64
- return Arta;
65
- }());
64
+ }
66
65
  exports.Arta = Arta;
@@ -1,27 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AddressVerificationsEndpoint = void 0;
4
- var endpoint_1 = require("./endpoint");
5
- var AddressVerificationsEndpoint = /** @class */ (function () {
6
- function AddressVerificationsEndpoint(artaClient) {
4
+ const endpoint_1 = require("./endpoint");
5
+ class AddressVerificationsEndpoint {
6
+ constructor(artaClient) {
7
7
  this.artaClient = artaClient;
8
8
  this.path = '/address_verifications';
9
9
  this.defaultEndpoint = new endpoint_1.DefaultEndpoint(this.path, this.artaClient);
10
10
  }
11
- AddressVerificationsEndpoint.prototype.getById = function (id, auth) {
11
+ getById(id, auth) {
12
12
  return this.defaultEndpoint.getById(id, auth);
13
- };
14
- AddressVerificationsEndpoint.prototype.list = function (page, pageSize, auth) {
15
- if (page === void 0) { page = 1; }
16
- if (pageSize === void 0) { pageSize = 20; }
17
- return this.defaultEndpoint.list({ page: page, page_size: pageSize }, auth);
18
- };
19
- AddressVerificationsEndpoint.prototype.listAll = function (auth) {
13
+ }
14
+ list(page = 1, pageSize = 20, auth) {
15
+ return this.defaultEndpoint.list({ page, page_size: pageSize }, auth);
16
+ }
17
+ listAll(auth) {
20
18
  return this.defaultEndpoint.listAll(auth);
21
- };
22
- AddressVerificationsEndpoint.prototype.create = function (payload, auth) {
19
+ }
20
+ create(payload, auth) {
23
21
  return this.defaultEndpoint.create({ address_verification: payload }, auth);
24
- };
25
- return AddressVerificationsEndpoint;
26
- }());
22
+ }
23
+ }
27
24
  exports.AddressVerificationsEndpoint = AddressVerificationsEndpoint;
@@ -1,27 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AttachmentsEndpoint = void 0;
4
- var endpoint_1 = require("./endpoint");
5
- var AttachmentsEndpoint = /** @class */ (function () {
6
- function AttachmentsEndpoint(artaClient) {
4
+ const endpoint_1 = require("./endpoint");
5
+ class AttachmentsEndpoint {
6
+ constructor(artaClient) {
7
7
  this.artaClient = artaClient;
8
8
  this.path = '/attachments';
9
9
  this.defaultEndpoint = new endpoint_1.DefaultEndpoint(this.path, this.artaClient);
10
10
  }
11
- AttachmentsEndpoint.prototype.getById = function (id, auth) {
11
+ getById(id, auth) {
12
12
  return this.defaultEndpoint.getById(id, auth);
13
- };
14
- AttachmentsEndpoint.prototype.list = function (page, pageSize, auth) {
15
- if (page === void 0) { page = 1; }
16
- if (pageSize === void 0) { pageSize = 20; }
17
- return this.defaultEndpoint.list({ page: page, page_size: pageSize }, auth);
18
- };
19
- AttachmentsEndpoint.prototype.create = function (payload, auth) {
13
+ }
14
+ list(page = 1, pageSize = 20, auth) {
15
+ return this.defaultEndpoint.list({ page, page_size: pageSize }, auth);
16
+ }
17
+ create(payload, auth) {
20
18
  return this.defaultEndpoint.create({ attachment: payload }, auth);
21
- };
22
- AttachmentsEndpoint.prototype.remove = function (id, auth) {
19
+ }
20
+ remove(id, auth) {
23
21
  return this.defaultEndpoint.remove(id, auth);
24
- };
25
- return AttachmentsEndpoint;
26
- }());
22
+ }
23
+ }
27
24
  exports.AttachmentsEndpoint = AttachmentsEndpoint;
@@ -1,33 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EmailRulesEndpoint = void 0;
4
- var endpoint_1 = require("./endpoint");
5
- var EmailRulesEndpoint = /** @class */ (function () {
6
- function EmailRulesEndpoint(artaClient) {
4
+ const endpoint_1 = require("./endpoint");
5
+ class EmailRulesEndpoint {
6
+ constructor(artaClient) {
7
7
  this.artaClient = artaClient;
8
8
  this.path = '/email_rules';
9
9
  this.defaultEndpoint = new endpoint_1.DefaultEndpoint(this.path, this.artaClient);
10
10
  }
11
- EmailRulesEndpoint.prototype.getById = function (id, auth) {
11
+ getById(id, auth) {
12
12
  return this.defaultEndpoint.getById(id, auth);
13
- };
14
- EmailRulesEndpoint.prototype.list = function (page, pageSize, auth) {
15
- if (page === void 0) { page = 1; }
16
- if (pageSize === void 0) { pageSize = 20; }
17
- return this.defaultEndpoint.list({ page: page, page_size: pageSize }, auth);
18
- };
19
- EmailRulesEndpoint.prototype.update = function (id, payload, auth) {
20
- var emailRulesPayload = {
13
+ }
14
+ list(page = 1, pageSize = 20, auth) {
15
+ return this.defaultEndpoint.list({ page, page_size: pageSize }, auth);
16
+ }
17
+ update(id, payload, auth) {
18
+ const emailRulesPayload = {
21
19
  email_rule: payload,
22
20
  };
23
21
  return this.defaultEndpoint.update(id, emailRulesPayload, auth);
24
- };
25
- EmailRulesEndpoint.prototype.create = function (payload, auth) {
22
+ }
23
+ create(payload, auth) {
26
24
  return this.defaultEndpoint.create({ email_rule: payload }, auth);
27
- };
28
- EmailRulesEndpoint.prototype.remove = function (id, auth) {
25
+ }
26
+ remove(id, auth) {
29
27
  return this.defaultEndpoint.remove(id, auth);
30
- };
31
- return EmailRulesEndpoint;
32
- }());
28
+ }
29
+ }
33
30
  exports.EmailRulesEndpoint = EmailRulesEndpoint;
@@ -1,33 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EmailSubscriptionsEndpoint = void 0;
4
- var endpoint_1 = require("./endpoint");
5
- var EmailSubscriptionsEndpoint = /** @class */ (function () {
6
- function EmailSubscriptionsEndpoint(artaClient) {
4
+ const endpoint_1 = require("./endpoint");
5
+ class EmailSubscriptionsEndpoint {
6
+ constructor(artaClient) {
7
7
  this.artaClient = artaClient;
8
8
  this.path = '/email_subscriptions';
9
9
  this.defaultEndpoint = new endpoint_1.DefaultEndpoint(this.path, this.artaClient);
10
10
  }
11
- EmailSubscriptionsEndpoint.prototype.getById = function (id, auth) {
11
+ getById(id, auth) {
12
12
  return this.defaultEndpoint.getById(id, auth);
13
- };
14
- EmailSubscriptionsEndpoint.prototype.list = function (page, pageSize, auth) {
15
- if (page === void 0) { page = 1; }
16
- if (pageSize === void 0) { pageSize = 20; }
17
- return this.defaultEndpoint.list({ page: page, page_size: pageSize }, auth);
18
- };
19
- EmailSubscriptionsEndpoint.prototype.update = function (id, payload, auth) {
20
- var emailNotificationPayload = {
13
+ }
14
+ list(page = 1, pageSize = 20, auth) {
15
+ return this.defaultEndpoint.list({ page, page_size: pageSize }, auth);
16
+ }
17
+ update(id, payload, auth) {
18
+ const emailNotificationPayload = {
21
19
  email_subscription: payload,
22
20
  };
23
21
  return this.defaultEndpoint.update(id, emailNotificationPayload, auth);
24
- };
25
- EmailSubscriptionsEndpoint.prototype.create = function (payload, auth) {
22
+ }
23
+ create(payload, auth) {
26
24
  return this.defaultEndpoint.create({ email_subscription: payload }, auth);
27
- };
28
- EmailSubscriptionsEndpoint.prototype.remove = function (id, auth) {
25
+ }
26
+ remove(id, auth) {
29
27
  return this.defaultEndpoint.remove(id, auth);
30
- };
31
- return EmailSubscriptionsEndpoint;
32
- }());
28
+ }
29
+ }
33
30
  exports.EmailSubscriptionsEndpoint = EmailSubscriptionsEndpoint;