@artaio/node-api 1.9.0 → 1.10.0

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 (36) hide show
  1. package/dist/lib/ArtaClient.js +57 -144
  2. package/dist/lib/arta.d.ts +2 -0
  3. package/dist/lib/arta.js +31 -30
  4. package/dist/lib/endpoint/addressVerifications.js +13 -16
  5. package/dist/lib/endpoint/attachment.js +13 -16
  6. package/dist/lib/endpoint/emailRules.js +16 -19
  7. package/dist/lib/endpoint/emailSubscriptions.js +16 -19
  8. package/dist/lib/endpoint/endpoint.js +44 -160
  9. package/dist/lib/endpoint/hostedSessions.js +19 -70
  10. package/dist/lib/endpoint/importCostEstimates.d.ts +17 -0
  11. package/dist/lib/endpoint/importCostEstimates.js +21 -0
  12. package/dist/lib/endpoint/invoicePayments.js +17 -27
  13. package/dist/lib/endpoint/invoices.js +11 -14
  14. package/dist/lib/endpoint/keys.js +15 -18
  15. package/dist/lib/endpoint/logs.js +17 -27
  16. package/dist/lib/endpoint/metadata.js +63 -64
  17. package/dist/lib/endpoint/organization.js +12 -67
  18. package/dist/lib/endpoint/payments.js +17 -27
  19. package/dist/lib/endpoint/requests.js +35 -113
  20. package/dist/lib/endpoint/selfShipCollectionAvailabilityChecks.js +6 -47
  21. package/dist/lib/endpoint/selfShipCollections.js +13 -16
  22. package/dist/lib/endpoint/shipments.js +21 -23
  23. package/dist/lib/endpoint/tags.js +13 -16
  24. package/dist/lib/endpoint/trackings.js +12 -66
  25. package/dist/lib/endpoint/uploads.js +13 -16
  26. package/dist/lib/endpoint/webhookDeliveries.js +9 -12
  27. package/dist/lib/endpoint/webhooks.js +37 -112
  28. package/dist/lib/error.js +14 -35
  29. package/dist/lib/index.d.ts +1 -0
  30. package/dist/lib/logging.js +18 -48
  31. package/dist/lib/net/FetchHttpClient.js +43 -108
  32. package/dist/lib/queryParams.js +5 -6
  33. package/dist/lib/types.d.ts +47 -0
  34. package/dist/lib/utils.js +10 -17
  35. package/dist/package.json +24 -18
  36. package/package.json +24 -18
@@ -1,71 +1,70 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MetadataEndpoint = void 0;
4
- var MetadataEndpoint = /** @class */ (function () {
5
- function MetadataEndpoint(artaClient) {
4
+ class MetadataEndpoint {
5
+ constructor(artaClient) {
6
6
  this.artaClient = artaClient;
7
7
  this.path = '/metadata';
8
8
  }
9
- MetadataEndpoint.prototype.apiVersions = function (auth) {
10
- return this.artaClient.get("".concat(this.path, "/api_versions"), auth);
11
- };
12
- MetadataEndpoint.prototype.currencies = function (auth) {
13
- return this.artaClient.get("".concat(this.path, "/currencies"), auth);
14
- };
15
- MetadataEndpoint.prototype.emailNotifications = function (auth) {
16
- return this.artaClient.get("".concat(this.path, "/email_notifications"), auth);
17
- };
18
- MetadataEndpoint.prototype.insurances = function (auth) {
19
- return this.artaClient.get("".concat(this.path, "/insurances"), auth);
20
- };
21
- MetadataEndpoint.prototype.locationAccessRestrictions = function (auth) {
22
- return this.artaClient.get("".concat(this.path, "/location_access_restrictions"), auth);
23
- };
24
- MetadataEndpoint.prototype.objectMaterials = function (auth) {
25
- return this.artaClient.get("".concat(this.path, "/object_materials"), auth);
26
- };
27
- MetadataEndpoint.prototype.objects = function (auth) {
28
- return this.artaClient.get("".concat(this.path, "/objects"), auth);
29
- };
30
- MetadataEndpoint.prototype.packageStatuses = function (auth) {
31
- return this.artaClient.get("".concat(this.path, "/package_statuses"), auth);
32
- };
33
- MetadataEndpoint.prototype.packings = function (auth) {
34
- return this.artaClient.get("".concat(this.path, "/packings"), auth);
35
- };
36
- MetadataEndpoint.prototype.parcelTransportServices = function (auth) {
37
- return this.artaClient.get("".concat(this.path, "/parcel_transport_services"), auth);
38
- };
39
- MetadataEndpoint.prototype.paymentProcessTypes = function (auth) {
40
- return this.artaClient.get("".concat(this.path, "/payment_process_types"), auth);
41
- };
42
- MetadataEndpoint.prototype.quotes = function (auth) {
43
- return this.artaClient.get("".concat(this.path, "/quotes"), auth);
44
- };
45
- MetadataEndpoint.prototype.quotingStrategies = function (auth) {
46
- return this.artaClient.get("".concat(this.path, "/quoting_strategies"), auth);
47
- };
48
- MetadataEndpoint.prototype.referenceRateProviders = function (auth) {
49
- return this.artaClient.get("".concat(this.path, "/reference_rate_providers"), auth);
50
- };
51
- MetadataEndpoint.prototype.referenceRateServiceLevels = function (auth) {
52
- return this.artaClient.get("".concat(this.path, "/reference_rate_service_levels"), auth);
53
- };
54
- MetadataEndpoint.prototype.objectComponents = function (auth) {
55
- return this.artaClient.get("".concat(this.path, "/object_components"), auth);
56
- };
57
- MetadataEndpoint.prototype.requestStatuses = function (auth) {
58
- return this.artaClient.get("".concat(this.path, "/request_statuses"), auth);
59
- };
60
- MetadataEndpoint.prototype.services = function (auth) {
61
- return this.artaClient.get("".concat(this.path, "/services"), auth);
62
- };
63
- MetadataEndpoint.prototype.shipmentExceptionTypes = function (auth) {
64
- return this.artaClient.get("".concat(this.path, "/shipment_exception_types"), auth);
65
- };
66
- MetadataEndpoint.prototype.shipmentStatuses = function (auth) {
67
- return this.artaClient.get("".concat(this.path, "/shipment_statuses"), auth);
68
- };
69
- return MetadataEndpoint;
70
- }());
9
+ apiVersions(auth) {
10
+ return this.artaClient.get(`${this.path}/api_versions`, auth);
11
+ }
12
+ currencies(auth) {
13
+ return this.artaClient.get(`${this.path}/currencies`, auth);
14
+ }
15
+ emailNotifications(auth) {
16
+ return this.artaClient.get(`${this.path}/email_notifications`, auth);
17
+ }
18
+ insurances(auth) {
19
+ return this.artaClient.get(`${this.path}/insurances`, auth);
20
+ }
21
+ locationAccessRestrictions(auth) {
22
+ return this.artaClient.get(`${this.path}/location_access_restrictions`, auth);
23
+ }
24
+ objectMaterials(auth) {
25
+ return this.artaClient.get(`${this.path}/object_materials`, auth);
26
+ }
27
+ objects(auth) {
28
+ return this.artaClient.get(`${this.path}/objects`, auth);
29
+ }
30
+ packageStatuses(auth) {
31
+ return this.artaClient.get(`${this.path}/package_statuses`, auth);
32
+ }
33
+ packings(auth) {
34
+ return this.artaClient.get(`${this.path}/packings`, auth);
35
+ }
36
+ parcelTransportServices(auth) {
37
+ return this.artaClient.get(`${this.path}/parcel_transport_services`, auth);
38
+ }
39
+ paymentProcessTypes(auth) {
40
+ return this.artaClient.get(`${this.path}/payment_process_types`, auth);
41
+ }
42
+ quotes(auth) {
43
+ return this.artaClient.get(`${this.path}/quotes`, auth);
44
+ }
45
+ quotingStrategies(auth) {
46
+ return this.artaClient.get(`${this.path}/quoting_strategies`, auth);
47
+ }
48
+ referenceRateProviders(auth) {
49
+ return this.artaClient.get(`${this.path}/reference_rate_providers`, auth);
50
+ }
51
+ referenceRateServiceLevels(auth) {
52
+ return this.artaClient.get(`${this.path}/reference_rate_service_levels`, auth);
53
+ }
54
+ objectComponents(auth) {
55
+ return this.artaClient.get(`${this.path}/object_components`, auth);
56
+ }
57
+ requestStatuses(auth) {
58
+ return this.artaClient.get(`${this.path}/request_statuses`, auth);
59
+ }
60
+ services(auth) {
61
+ return this.artaClient.get(`${this.path}/services`, auth);
62
+ }
63
+ shipmentExceptionTypes(auth) {
64
+ return this.artaClient.get(`${this.path}/shipment_exception_types`, auth);
65
+ }
66
+ shipmentStatuses(auth) {
67
+ return this.artaClient.get(`${this.path}/shipment_statuses`, auth);
68
+ }
69
+ }
71
70
  exports.MetadataEndpoint = MetadataEndpoint;
@@ -1,45 +1,9 @@
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.OrganizationsEndpoint = void 0;
40
- var utils_1 = require("../utils");
41
- var OrganizationsEndpoint = /** @class */ (function () {
42
- function OrganizationsEndpoint(artaClient) {
4
+ const utils_1 = require("../utils");
5
+ class OrganizationsEndpoint {
6
+ constructor(artaClient) {
43
7
  this.artaClient = artaClient;
44
8
  this.path = '/organization';
45
9
  }
@@ -48,37 +12,18 @@ var OrganizationsEndpoint = /** @class */ (function () {
48
12
  * @returns The Organization
49
13
  * @throws ArtaSDKError thrown if some problem happened while communicating with the API.
50
14
  */
51
- OrganizationsEndpoint.prototype.get = function (auth) {
52
- return __awaiter(this, void 0, void 0, function () {
53
- var artaResponse;
54
- return __generator(this, function (_a) {
55
- switch (_a.label) {
56
- case 0: return [4 /*yield*/, this.artaClient.get(this.path, auth)];
57
- case 1:
58
- artaResponse = _a.sent();
59
- return [2 /*return*/, (0, utils_1.convertDatesToUtc)(artaResponse)];
60
- }
61
- });
62
- });
63
- };
15
+ async get(auth) {
16
+ const artaResponse = await this.artaClient.get(this.path, auth);
17
+ return (0, utils_1.convertDatesToUtc)(artaResponse);
18
+ }
64
19
  /** Updates the Organization associated with the API Key
65
20
  * @param [auth] An optional API key.
66
21
  * @returns The Organization
67
22
  * @throws ArtaSDKError thrown if some problem happened while communicating with the API.
68
23
  */
69
- OrganizationsEndpoint.prototype.update = function (organization, auth) {
70
- return __awaiter(this, void 0, void 0, function () {
71
- var artaResponse;
72
- return __generator(this, function (_a) {
73
- switch (_a.label) {
74
- case 0: return [4 /*yield*/, this.artaClient.patch(this.path, { organization: organization }, auth)];
75
- case 1:
76
- artaResponse = _a.sent();
77
- return [2 /*return*/, (0, utils_1.convertDatesToUtc)(artaResponse)];
78
- }
79
- });
80
- });
81
- };
82
- return OrganizationsEndpoint;
83
- }());
24
+ async update(organization, auth) {
25
+ const artaResponse = await this.artaClient.patch(this.path, { organization }, auth);
26
+ return (0, utils_1.convertDatesToUtc)(artaResponse);
27
+ }
28
+ }
84
29
  exports.OrganizationsEndpoint = OrganizationsEndpoint;
@@ -1,36 +1,26 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  Object.defineProperty(exports, "__esModule", { value: true });
14
3
  exports.PaymentsEndpoint = void 0;
15
- var utils_1 = require("../utils");
16
- var endpoint_1 = require("./endpoint");
17
- var PaymentsEndpoint = /** @class */ (function () {
18
- function PaymentsEndpoint(artaClient) {
4
+ const utils_1 = require("../utils");
5
+ const endpoint_1 = require("./endpoint");
6
+ class PaymentsEndpoint {
7
+ constructor(artaClient) {
19
8
  this.artaClient = artaClient;
20
9
  this.path = '/payments';
21
10
  this.defaultEndpoint = new endpoint_1.DefaultEndpoint(this.path, this.artaClient, this.enrichFields);
22
11
  }
23
- PaymentsEndpoint.prototype.getById = function (id, auth) {
12
+ getById(id, auth) {
24
13
  return this.defaultEndpoint.getById(id, auth);
25
- };
26
- PaymentsEndpoint.prototype.list = function (page, pageSize, auth) {
27
- if (page === void 0) { page = 1; }
28
- if (pageSize === void 0) { pageSize = 20; }
29
- return this.defaultEndpoint.list({ page: page, page_size: pageSize }, auth);
30
- };
31
- PaymentsEndpoint.prototype.enrichFields = function (resource) {
32
- return __assign(__assign({}, resource), { amount: Number(resource.amount), paid_on: (0, utils_1.createDateAsUTC)(resource.paid_on) });
33
- };
34
- return PaymentsEndpoint;
35
- }());
14
+ }
15
+ list(page = 1, pageSize = 20, auth) {
16
+ return this.defaultEndpoint.list({ page, page_size: pageSize }, auth);
17
+ }
18
+ enrichFields(resource) {
19
+ return {
20
+ ...resource,
21
+ amount: Number(resource.amount),
22
+ paid_on: (0, utils_1.createDateAsUTC)(resource.paid_on),
23
+ };
24
+ }
25
+ }
36
26
  exports.PaymentsEndpoint = PaymentsEndpoint;
@@ -1,140 +1,62 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- 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);
24
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
- 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;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
2
  Object.defineProperty(exports, "__esModule", { value: true });
50
3
  exports.QuoteRequestsEndpoint = void 0;
51
- var utils_1 = require("../utils");
52
- var endpoint_1 = require("./endpoint");
53
- var QuoteRequestsEndpoint = /** @class */ (function () {
54
- function QuoteRequestsEndpoint(artaClient) {
4
+ const utils_1 = require("../utils");
5
+ const endpoint_1 = require("./endpoint");
6
+ class QuoteRequestsEndpoint {
7
+ constructor(artaClient) {
55
8
  this.artaClient = artaClient;
56
9
  this.path = '/requests';
57
10
  this.defaultEndpoint = new endpoint_1.DefaultEndpoint(this.path, this.artaClient, this.enrichFields.bind(this));
58
11
  }
59
- QuoteRequestsEndpoint.prototype.enrichFields = function (resource) {
60
- var _this = this;
12
+ enrichFields(resource) {
61
13
  if (Object.prototype.hasOwnProperty.call(resource, 'quotes')) {
62
- resource.quotes.forEach(function (q) {
14
+ resource.quotes.forEach((q) => {
63
15
  q.total = Number(q.total);
64
16
  q.included_services.forEach(utils_1.parseService);
65
17
  q.optional_services.forEach(utils_1.parseService);
66
18
  if (q.tags) {
67
- q.tags.forEach(function (t) {
19
+ q.tags.forEach((t) => {
68
20
  q.created_at = (0, utils_1.createDateAsUTC)(t.created_at);
69
21
  q.updated_at = (0, utils_1.createDateAsUTC)(t.updated_at);
70
22
  });
71
23
  }
72
24
  });
73
25
  if (resource.tags) {
74
- resource.tags.forEach(function (t) {
26
+ resource.tags.forEach((t) => {
75
27
  t.created_at = (0, utils_1.createDateAsUTC)(t.created_at);
76
28
  t.updated_at = (0, utils_1.createDateAsUTC)(t.updated_at);
77
29
  });
78
30
  }
79
31
  }
80
- var updateContacts = function (contacts, auth) { return _this.updateContacts(resource.id, contacts, auth); };
81
- var requireCustomQuotes = function (customQuote, auth) { return _this.requireCustomQuotes(resource.id, customQuote, auth); };
82
- var cancel = function (auth) { return _this.cancel(resource.id, auth); };
83
- return __assign(__assign({}, resource), { updateContacts: updateContacts, requireCustomQuotes: requireCustomQuotes, cancel: cancel });
84
- };
85
- QuoteRequestsEndpoint.prototype.getById = function (id, auth) {
32
+ const updateContacts = (contacts, auth) => this.updateContacts(resource.id, contacts, auth);
33
+ const requireCustomQuotes = (customQuote, auth) => this.requireCustomQuotes(resource.id, customQuote, auth);
34
+ const cancel = (auth) => this.cancel(resource.id, auth);
35
+ return { ...resource, updateContacts, requireCustomQuotes, cancel };
36
+ }
37
+ getById(id, auth) {
86
38
  return this.defaultEndpoint.getById(id, auth);
87
- };
88
- QuoteRequestsEndpoint.prototype.list = function (search, page, pageSize, auth) {
89
- if (page === void 0) { page = 1; }
90
- if (pageSize === void 0) { pageSize = 20; }
91
- return this.defaultEndpoint.list({ page: page, page_size: pageSize, search: search }, auth);
92
- };
93
- QuoteRequestsEndpoint.prototype.create = function (payload, auth) {
39
+ }
40
+ list(search, page = 1, pageSize = 20, auth) {
41
+ return this.defaultEndpoint.list({ page, page_size: pageSize, search }, auth);
42
+ }
43
+ create(payload, auth) {
94
44
  return this.defaultEndpoint.create({ request: payload }, auth);
95
- };
96
- QuoteRequestsEndpoint.prototype.update = function (id, payload, auth) {
45
+ }
46
+ update(id, payload, auth) {
97
47
  return this.defaultEndpoint.update(id, { request: payload }, auth);
98
- };
99
- QuoteRequestsEndpoint.prototype.updateContacts = function (id, contacts, auth) {
100
- return __awaiter(this, void 0, void 0, function () {
101
- var rawReq;
102
- return __generator(this, function (_a) {
103
- switch (_a.label) {
104
- case 0: return [4 /*yield*/, this.artaClient.patch("".concat(this.path, "/").concat(id, "/contacts"), contacts, auth)];
105
- case 1:
106
- rawReq = (_a.sent());
107
- return [2 /*return*/, this.enrichFields(rawReq)];
108
- }
109
- });
110
- });
111
- };
112
- QuoteRequestsEndpoint.prototype.requireCustomQuotes = function (id, customQuote, auth) {
113
- return __awaiter(this, void 0, void 0, function () {
114
- var rawReq;
115
- return __generator(this, function (_a) {
116
- switch (_a.label) {
117
- case 0: return [4 /*yield*/, this.artaClient.patch("".concat(this.path, "/").concat(id, "/custom"), customQuote, auth)];
118
- case 1:
119
- rawReq = (_a.sent());
120
- return [2 /*return*/, this.enrichFields(rawReq)];
121
- }
122
- });
123
- });
124
- };
125
- QuoteRequestsEndpoint.prototype.cancel = function (id, auth) {
126
- return __awaiter(this, void 0, void 0, function () {
127
- var rawReq;
128
- return __generator(this, function (_a) {
129
- switch (_a.label) {
130
- case 0: return [4 /*yield*/, this.artaClient.patch("".concat(this.path, "/").concat(id, "/cancel"), undefined, auth)];
131
- case 1:
132
- rawReq = (_a.sent());
133
- return [2 /*return*/, this.enrichFields(rawReq)];
134
- }
135
- });
136
- });
137
- };
138
- return QuoteRequestsEndpoint;
139
- }());
48
+ }
49
+ async updateContacts(id, contacts, auth) {
50
+ const rawReq = (await this.artaClient.patch(`${this.path}/${id}/contacts`, contacts, auth));
51
+ return this.enrichFields(rawReq);
52
+ }
53
+ async requireCustomQuotes(id, customQuote, auth) {
54
+ const rawReq = (await this.artaClient.patch(`${this.path}/${id}/custom`, customQuote, auth));
55
+ return this.enrichFields(rawReq);
56
+ }
57
+ async cancel(id, auth) {
58
+ const rawReq = (await this.artaClient.patch(`${this.path}/${id}/cancel`, undefined, auth));
59
+ return this.enrichFields(rawReq);
60
+ }
61
+ }
140
62
  exports.QuoteRequestsEndpoint = QuoteRequestsEndpoint;
@@ -1,54 +1,13 @@
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.SelfShipCollectionAvailabilityChecksEndpoint = void 0;
40
- var SelfShipCollectionAvailabilityChecksEndpoint = /** @class */ (function () {
41
- function SelfShipCollectionAvailabilityChecksEndpoint(artaClient) {
4
+ class SelfShipCollectionAvailabilityChecksEndpoint {
5
+ constructor(artaClient) {
42
6
  this.artaClient = artaClient;
43
7
  this.path = '/self_ship_collection_availability_checks';
44
8
  }
45
- SelfShipCollectionAvailabilityChecksEndpoint.prototype.create = function (payload, auth) {
46
- return __awaiter(this, void 0, void 0, function () {
47
- return __generator(this, function (_a) {
48
- return [2 /*return*/, this.artaClient.post(this.path, { self_ship_collection_availability_check: payload }, auth)];
49
- });
50
- });
51
- };
52
- return SelfShipCollectionAvailabilityChecksEndpoint;
53
- }());
9
+ async create(payload, auth) {
10
+ return this.artaClient.post(this.path, { self_ship_collection_availability_check: payload }, auth);
11
+ }
12
+ }
54
13
  exports.SelfShipCollectionAvailabilityChecksEndpoint = SelfShipCollectionAvailabilityChecksEndpoint;
@@ -1,27 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SelfShipCollectionsEndpoint = void 0;
4
- var endpoint_1 = require("./endpoint");
5
- var SelfShipCollectionsEndpoint = /** @class */ (function () {
6
- function SelfShipCollectionsEndpoint(artaClient) {
4
+ const endpoint_1 = require("./endpoint");
5
+ class SelfShipCollectionsEndpoint {
6
+ constructor(artaClient) {
7
7
  this.artaClient = artaClient;
8
8
  this.path = '/self_ship_collections';
9
9
  this.defaultEndpoint = new endpoint_1.DefaultEndpoint(this.path, this.artaClient);
10
10
  }
11
- SelfShipCollectionsEndpoint.prototype.getById = function (id, auth) {
11
+ getById(id, auth) {
12
12
  return this.defaultEndpoint.getById(id, auth);
13
- };
14
- SelfShipCollectionsEndpoint.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
- SelfShipCollectionsEndpoint.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
- SelfShipCollectionsEndpoint.prototype.create = function (payload, auth) {
19
+ }
20
+ create(payload, auth) {
23
21
  return this.defaultEndpoint.create({ self_ship_collection: payload }, auth);
24
- };
25
- return SelfShipCollectionsEndpoint;
26
- }());
22
+ }
23
+ }
27
24
  exports.SelfShipCollectionsEndpoint = SelfShipCollectionsEndpoint;