@artaio/node-api 1.9.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.
- package/dist/lib/ArtaClient.js +57 -144
- package/dist/lib/arta.js +29 -30
- package/dist/lib/endpoint/addressVerifications.js +13 -16
- package/dist/lib/endpoint/attachment.js +13 -16
- package/dist/lib/endpoint/emailRules.js +16 -19
- package/dist/lib/endpoint/emailSubscriptions.js +16 -19
- package/dist/lib/endpoint/endpoint.js +44 -160
- package/dist/lib/endpoint/hostedSessions.js +19 -70
- package/dist/lib/endpoint/invoicePayments.js +17 -27
- package/dist/lib/endpoint/invoices.js +11 -14
- package/dist/lib/endpoint/keys.js +15 -18
- package/dist/lib/endpoint/logs.js +17 -27
- package/dist/lib/endpoint/metadata.js +63 -64
- package/dist/lib/endpoint/organization.js +12 -67
- package/dist/lib/endpoint/payments.js +17 -27
- package/dist/lib/endpoint/requests.js +35 -113
- package/dist/lib/endpoint/selfShipCollectionAvailabilityChecks.js +6 -47
- package/dist/lib/endpoint/selfShipCollections.js +13 -16
- package/dist/lib/endpoint/shipments.js +21 -23
- package/dist/lib/endpoint/tags.js +13 -16
- package/dist/lib/endpoint/trackings.js +12 -66
- package/dist/lib/endpoint/uploads.js +13 -16
- package/dist/lib/endpoint/webhookDeliveries.js +9 -12
- package/dist/lib/endpoint/webhooks.js +37 -112
- package/dist/lib/error.js +14 -35
- package/dist/lib/logging.js +18 -48
- package/dist/lib/net/FetchHttpClient.js +43 -108
- package/dist/lib/queryParams.js +5 -6
- package/dist/lib/utils.js +10 -17
- package/dist/package.json +24 -18
- package/package.json +24 -18
package/dist/lib/ArtaClient.js
CHANGED
|
@@ -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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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':
|
|
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':
|
|
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
|
-
|
|
107
|
-
return
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
34
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
11
|
+
getById(id, auth) {
|
|
12
12
|
return this.defaultEndpoint.getById(id, auth);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
19
|
+
}
|
|
20
|
+
create(payload, auth) {
|
|
23
21
|
return this.defaultEndpoint.create({ address_verification: payload }, auth);
|
|
24
|
-
}
|
|
25
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
11
|
+
getById(id, auth) {
|
|
12
12
|
return this.defaultEndpoint.getById(id, auth);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
19
|
+
}
|
|
20
|
+
remove(id, auth) {
|
|
23
21
|
return this.defaultEndpoint.remove(id, auth);
|
|
24
|
-
}
|
|
25
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
11
|
+
getById(id, auth) {
|
|
12
12
|
return this.defaultEndpoint.getById(id, auth);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
22
|
+
}
|
|
23
|
+
create(payload, auth) {
|
|
26
24
|
return this.defaultEndpoint.create({ email_rule: payload }, auth);
|
|
27
|
-
}
|
|
28
|
-
|
|
25
|
+
}
|
|
26
|
+
remove(id, auth) {
|
|
29
27
|
return this.defaultEndpoint.remove(id, auth);
|
|
30
|
-
}
|
|
31
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
11
|
+
getById(id, auth) {
|
|
12
12
|
return this.defaultEndpoint.getById(id, auth);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
22
|
+
}
|
|
23
|
+
create(payload, auth) {
|
|
26
24
|
return this.defaultEndpoint.create({ email_subscription: payload }, auth);
|
|
27
|
-
}
|
|
28
|
-
|
|
25
|
+
}
|
|
26
|
+
remove(id, auth) {
|
|
29
27
|
return this.defaultEndpoint.remove(id, auth);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
}());
|
|
28
|
+
}
|
|
29
|
+
}
|
|
33
30
|
exports.EmailSubscriptionsEndpoint = EmailSubscriptionsEndpoint;
|