@artaio/node-api 0.27.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.
- package/LICENSE.md +21 -0
- package/README.md +48 -0
- package/dist/lib/ArtaClient.d.ts +21 -0
- package/dist/lib/ArtaClient.js +155 -0
- package/dist/lib/MetadataTypes.d.ts +96 -0
- package/dist/lib/MetadataTypes.js +2 -0
- package/dist/lib/arta.d.ts +45 -0
- package/dist/lib/arta.js +57 -0
- package/dist/lib/endpoint/attachment.d.ts +32 -0
- package/dist/lib/endpoint/attachment.js +27 -0
- package/dist/lib/endpoint/emailRules.d.ts +30 -0
- package/dist/lib/endpoint/emailRules.js +33 -0
- package/dist/lib/endpoint/emailSubscriptions.d.ts +32 -0
- package/dist/lib/endpoint/emailSubscriptions.js +33 -0
- package/dist/lib/endpoint/endpoint.d.ts +26 -0
- package/dist/lib/endpoint/endpoint.js +168 -0
- package/dist/lib/endpoint/hostedSessions.d.ts +53 -0
- package/dist/lib/endpoint/hostedSessions.js +81 -0
- package/dist/lib/endpoint/invoicePayments.d.ts +24 -0
- package/dist/lib/endpoint/invoicePayments.js +26 -0
- package/dist/lib/endpoint/invoices.d.ts +27 -0
- package/dist/lib/endpoint/invoices.js +27 -0
- package/dist/lib/endpoint/keys.d.ts +28 -0
- package/dist/lib/endpoint/keys.js +30 -0
- package/dist/lib/endpoint/logs.d.ts +29 -0
- package/dist/lib/endpoint/logs.js +27 -0
- package/dist/lib/endpoint/metadata.d.ts +67 -0
- package/dist/lib/endpoint/metadata.js +56 -0
- package/dist/lib/endpoint/organization.d.ts +31 -0
- package/dist/lib/endpoint/organization.js +84 -0
- package/dist/lib/endpoint/payments.d.ts +21 -0
- package/dist/lib/endpoint/payments.js +26 -0
- package/dist/lib/endpoint/requests.d.ts +80 -0
- package/dist/lib/endpoint/requests.js +113 -0
- package/dist/lib/endpoint/shipments.d.ts +80 -0
- package/dist/lib/endpoint/shipments.js +44 -0
- package/dist/lib/endpoint/trackings.d.ts +25 -0
- package/dist/lib/endpoint/trackings.js +64 -0
- package/dist/lib/endpoint/uploads.d.ts +36 -0
- package/dist/lib/endpoint/uploads.js +27 -0
- package/dist/lib/endpoint/webhookDeliveries.d.ts +26 -0
- package/dist/lib/endpoint/webhookDeliveries.js +21 -0
- package/dist/lib/endpoint/webhooks.d.ts +35 -0
- package/dist/lib/endpoint/webhooks.js +124 -0
- package/dist/lib/error.d.ts +8 -0
- package/dist/lib/error.js +54 -0
- package/dist/lib/index.d.ts +19 -0
- package/dist/lib/index.js +20 -0
- package/dist/lib/logging.d.ts +17 -0
- package/dist/lib/logging.js +79 -0
- package/dist/lib/net/HttpClient.d.ts +19 -0
- package/dist/lib/net/HttpClient.js +2 -0
- package/dist/lib/net/NodeHttpClient.d.ts +20 -0
- package/dist/lib/net/NodeHttpClient.js +203 -0
- package/dist/lib/net/RestClient.d.ts +6 -0
- package/dist/lib/net/RestClient.js +2 -0
- package/dist/lib/pagination.d.ts +9 -0
- package/dist/lib/pagination.js +2 -0
- package/dist/lib/queryParams.d.ts +7 -0
- package/dist/lib/queryParams.js +23 -0
- package/dist/lib/search.d.ts +3 -0
- package/dist/lib/search.js +2 -0
- package/dist/lib/utils.d.ts +9 -0
- package/dist/lib/utils.js +24 -0
- package/dist/package.json +49 -0
- package/package.json +58 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 artaio
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Arta Node.js Library
|
|
2
|
+
===
|
|
3
|
+
|
|
4
|
+
The Arta Node library provides a seamless integration to Arta API for applications running on Node.js using both Typescript or Javascript.
|
|
5
|
+
|
|
6
|
+
## Documentation
|
|
7
|
+
|
|
8
|
+
Please refer to [Arta official documentation](https://api-reference.arta.io/).
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Getting Started
|
|
12
|
+
|
|
13
|
+
### 1. Install Arta Node Library
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
$ npm install arta-node
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### 2. Use it to interact with our API in pure JS
|
|
20
|
+
```js
|
|
21
|
+
const { Arta } = require('arta-node');
|
|
22
|
+
const arta = new Arta('<YOUR_API_TOKEN>');
|
|
23
|
+
|
|
24
|
+
const endpoints = arta.endpoint.list();
|
|
25
|
+
|
|
26
|
+
const myEndpoint = endpoint[0];
|
|
27
|
+
|
|
28
|
+
myEndpoint.ping().then(console.log);
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 3. Use it to interact with our API in TS
|
|
32
|
+
```ts
|
|
33
|
+
import { Arta } from 'arta-node';
|
|
34
|
+
const arta: Arta = new Arta('<YOUR_API_TOKEN>');
|
|
35
|
+
|
|
36
|
+
const endpoints: ArtaEndpoint[] = arta.endpoint.list();
|
|
37
|
+
|
|
38
|
+
const myEndpoint: ArtaEndpoint = endpoint[0];
|
|
39
|
+
|
|
40
|
+
myEndpoint.ping().then(console.log);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Contributing
|
|
44
|
+
|
|
45
|
+
Please be aware of our zero-dependency policy and ensure that there are no packages under "dependencies" in the `package.json`. Dev dependencies are fine, as these will not be contained in the final published package.
|
|
46
|
+
|
|
47
|
+
### Development
|
|
48
|
+
To develop a new function on the SDK, run `npm install` to install all the dependencies (only dev dependencies) and then run `npm run build` and the compiled JS code will be stored in the `dist/` folder which is the folder with the content published to NPM.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HttpClient } from './net/HttpClient';
|
|
2
|
+
import { RestClient } from './net/RestClient';
|
|
3
|
+
export type ArtaID = number | string;
|
|
4
|
+
interface ArtaClientConfig {
|
|
5
|
+
apiKey: string;
|
|
6
|
+
host: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class ArtaClient implements RestClient {
|
|
9
|
+
private readonly httpClient;
|
|
10
|
+
private readonly config;
|
|
11
|
+
private readonly logger;
|
|
12
|
+
constructor(httpClient: HttpClient, config: ArtaClientConfig);
|
|
13
|
+
private request;
|
|
14
|
+
private makeReqParams;
|
|
15
|
+
private makeArtaAuthHeader;
|
|
16
|
+
get(path: string, auth?: string): Promise<any>;
|
|
17
|
+
post(path: string, payload: any, auth?: string): Promise<any>;
|
|
18
|
+
patch(path: string, payload: any, auth?: string): Promise<any>;
|
|
19
|
+
delete(path: string, auth?: string): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,155 @@
|
|
|
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;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
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) {
|
|
45
|
+
this.httpClient = httpClient;
|
|
46
|
+
this.config = config;
|
|
47
|
+
this.logger = (0, logging_1.getLogger)();
|
|
48
|
+
}
|
|
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.Authorization == null) {
|
|
57
|
+
params.headers.Authorization = authValue;
|
|
58
|
+
}
|
|
59
|
+
return [4 /*yield*/, this.httpClient.request(this.config.host, params)];
|
|
60
|
+
case 1:
|
|
61
|
+
req = _a.sent();
|
|
62
|
+
message = "[".concat(req.statusCode, "] ").concat(params.method, " ").concat(params.path);
|
|
63
|
+
if (!(req.statusCode && req.statusCode >= 400)) return [3 /*break*/, 3];
|
|
64
|
+
return [4 /*yield*/, req.json()];
|
|
65
|
+
case 2:
|
|
66
|
+
errorResponse = _a.sent();
|
|
67
|
+
this.logger.error(message);
|
|
68
|
+
this.logger.debug('Error body', errorResponse);
|
|
69
|
+
throw new error_1.ArtaSDKError(errorResponse, req.statusCode);
|
|
70
|
+
case 3:
|
|
71
|
+
this.logger.info(message);
|
|
72
|
+
return [2 /*return*/, req];
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
ArtaClient.prototype.makeReqParams = function (path, method, auth, body) {
|
|
78
|
+
var reqParams = {
|
|
79
|
+
path: path,
|
|
80
|
+
method: method,
|
|
81
|
+
headers: {
|
|
82
|
+
'User-Agent': "ARTA/v1 arta-node/".concat(package_json_1.version),
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
if (auth) {
|
|
86
|
+
reqParams.headers.Authorization = this.makeArtaAuthHeader(auth);
|
|
87
|
+
}
|
|
88
|
+
if (body) {
|
|
89
|
+
reqParams.requestData = body;
|
|
90
|
+
}
|
|
91
|
+
return reqParams;
|
|
92
|
+
};
|
|
93
|
+
ArtaClient.prototype.makeArtaAuthHeader = function (apiKey) {
|
|
94
|
+
return "ARTA_APIKey ".concat(apiKey);
|
|
95
|
+
};
|
|
96
|
+
ArtaClient.prototype.get = function (path, auth) {
|
|
97
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
98
|
+
var reqParams, res;
|
|
99
|
+
return __generator(this, function (_a) {
|
|
100
|
+
switch (_a.label) {
|
|
101
|
+
case 0:
|
|
102
|
+
reqParams = this.makeReqParams(path, 'get', auth);
|
|
103
|
+
return [4 /*yield*/, this.request(reqParams)];
|
|
104
|
+
case 1:
|
|
105
|
+
res = _a.sent();
|
|
106
|
+
return [2 /*return*/, res.json()];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
ArtaClient.prototype.post = function (path, payload, auth) {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
113
|
+
var reqParams, res;
|
|
114
|
+
return __generator(this, function (_a) {
|
|
115
|
+
switch (_a.label) {
|
|
116
|
+
case 0:
|
|
117
|
+
reqParams = this.makeReqParams(path, 'post', auth, JSON.stringify(payload));
|
|
118
|
+
return [4 /*yield*/, this.request(reqParams)];
|
|
119
|
+
case 1:
|
|
120
|
+
res = _a.sent();
|
|
121
|
+
return [2 /*return*/, res.json()];
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
ArtaClient.prototype.patch = function (path, payload, auth) {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128
|
+
var reqParams, res;
|
|
129
|
+
return __generator(this, function (_a) {
|
|
130
|
+
switch (_a.label) {
|
|
131
|
+
case 0:
|
|
132
|
+
reqParams = this.makeReqParams(path, 'patch', auth, JSON.stringify(payload));
|
|
133
|
+
return [4 /*yield*/, this.request(reqParams)];
|
|
134
|
+
case 1:
|
|
135
|
+
res = _a.sent();
|
|
136
|
+
return [2 /*return*/, res.json()];
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
ArtaClient.prototype.delete = function (path, auth) {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
143
|
+
return __generator(this, function (_a) {
|
|
144
|
+
switch (_a.label) {
|
|
145
|
+
case 0: return [4 /*yield*/, this.request(this.makeReqParams(path, 'delete', auth))];
|
|
146
|
+
case 1:
|
|
147
|
+
_a.sent();
|
|
148
|
+
return [2 /*return*/, Promise.resolve()];
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
return ArtaClient;
|
|
154
|
+
}());
|
|
155
|
+
exports.ArtaClient = ArtaClient;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Nullable, NullableString } from './utils';
|
|
2
|
+
export type AdditionalService = 'assembly' | 'debris_disposal' | 'deinstallation' | 'destination_additional_labor' | 'destination_building_coi' | 'destination_condition_check' | 'destination_full_condition_report' | 'destination_unpacking' | 'double_blind_bols' | 'installation' | 'origin_building_coi' | 'origin_condition_check' | 'origin_full_condition_report' | 'placement' | 'signature_delivery' | 'tarmac_supervision';
|
|
3
|
+
export type AccessRestriction = 'elevator_only' | 'freight_elevator' | 'loading_dock' | 'loading_dock_low' | 'low_clearance' | 'non_paved' | 'stairs_only' | 'steep_gradient';
|
|
4
|
+
export type Insurance = 'arta_transit_insurance' | 'no_arta_insurance';
|
|
5
|
+
export type PaymentProcessType = 'checkout' | 'checkout_direct' | 'invoicing';
|
|
6
|
+
export type QuoteType = 'parcel' | 'premium' | 'select' | 'self_ship';
|
|
7
|
+
export type QuoteRequestStatus = 'cancelled' | 'closed' | 'disqualified' | 'expired' | 'in_progress' | 'pending' | 'quoted';
|
|
8
|
+
export type EmailNotificationId = 'booking' | 'cancelled' | 'collected' | 'collection' | 'complete' | 'custom_quoted_dashboard' | 'in_transit' | 'invoice' | 'self_ship_label' | 'payment' | 'scheduling' | 'eei';
|
|
9
|
+
export type Recipients = 'payer' | 'origin' | 'destination';
|
|
10
|
+
export type MimeType = 'application/pdf' | 'application/vnd.ms-excel' | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' | 'image/jpeg' | 'image/png' | 'text/csv' | 'video/mp4' | 'video/quicktime' | 'application/msword';
|
|
11
|
+
export type DocumentType = 'bill_of_lading' | 'certificate_of_insurance' | 'certificate_of_insurance_template' | 'condition_report' | 'condition_check' | 'image' | 'instructions' | 'airway_bill' | 'commercial_invoice' | 'power_of_attorney' | 'proof_of_export' | 'proof_of_delivery' | 'quote' | 'shipping_label' | 'other';
|
|
12
|
+
export type PackingType = 'alcohol_case' | 'blanket' | 'box' | 'cbin_closed' | 'cbin_open' | 'crate' | 'foam_lined_box' | 'frame' | 'lockbox' | 'no_packing' | 'pallet' | 'portfolio' | 'rug_roll' | 'shadow_box' | 'slipcase' | 'soft_packing' | 'soft_wrap' | 'sonotube' | 'stabilizing_box' | 'tube';
|
|
13
|
+
export type PackingSubType = 'alcohol_case' | 'lay_flat_wine_box' | 'blanket' | 'wardrobe_box' | 'cardboard_box' | 'chandelier_box' | 'chair_box' | 'cbin_closed' | 'cbin_open' | 'ply_box' | 'fine_art_econo_crate' | 'fine_art_international_crate' | 'econo_crate' | 'international_econo_crate' | 'furniture_crate' | 'international_furniture_crate' | 'parcel_crate' | 'museum_crate' | 'international_museum_crate' | 'foam_lined_box' | 'cavity_box' | 'strongbox' | 'double_box' | 'travel_frame' | 'travel_frame_art' | 'travel_frame_other' | 'a_frame' | 'slat_crate' | 'tri_wall_crate' | 'lockbox' | 'no_packing' | 'pallet' | 'international_pallet' | 'portfolio' | 'rug_rolled' | 'shadow_box' | 'slipcase' | 'slipcase_glass_tape' | 'poly_cardboard' | 'bubble_cardboard' | 'garment_bag' | 'poly_only' | 'dartek_only' | 'bubble_only' | 'cling_wrap' | 'cbin_communal' | 'sonotube' | 'stabilizing_box' | 'shipping_tube_small' | 'shipping_tube_large';
|
|
14
|
+
export type ObjectType = 'art' | 'furniture' | 'jewelry' | 'decorative_arts' | 'collectibles' | 'alcohol' | 'automotive' | 'fashion' | 'other';
|
|
15
|
+
export type ObjectSubType = 'painting_unframed' | 'painting_framed' | 'painting_framed_plexi' | 'painting_framed_glass' | 'work_on_paper_unframed' | 'work_on_paper_framed' | 'work_on_paper_framed_plexi' | 'work_on_paper_framed_glass' | 'mixed_media_unframed' | 'mixed_media_framed' | 'mixed_media_framed_plexi' | 'mixed_media_framed_glass' | 'photograph_unframed' | 'photograph_framed' | 'photograph_framed_plexi' | 'photograph_framed_glass' | 'new_media' | 'sculpture' | 'pedestal' | 'pedestal_case_glass' | 'pedestal_case_plexi' | 'ceramic' | 'neon' | 'tapestry' | 'other_art' | 'table' | 'chair' | 'sofa_loveseat_chaise' | 'floor_lamp' | 'floor_lamp_shade' | 'table_lamp' | 'table_lamp_shade' | 'sconce' | 'ottoman' | 'bookcase_storage' | 'nightstand' | 'armoire_dresser' | 'carpet_rug' | 'mirror' | 'chandelier' | 'bedframe' | 'headboard' | 'desk_vanity' | 'media_console' | 'other_furniture' | 'earrings' | 'necklace' | 'bracelet' | 'ring' | 'brooch' | 'watch' | 'cufflinks' | 'eyeglasses' | 'set' | 'precious_stones' | 'snuff_box_cigarette_case' | 'other_jewelry' | 'vase_vessel' | 'bowl' | 'plaque' | 'object_of_vertu' | 'candelabra_candlestick' | 'dinnerware' | 'flatware' | 'glassware' | 'serveware' | 'porcelain_plate' | 'porcelain_bowl' | 'tabletop_accessory' | 'clock' | 'other_decorative_arts' | 'stamp' | 'book' | 'coin' | 'document_manuscript' | 'toy' | 'miniature_model' | 'figurine_doll' | 'neon_sign' | 'memorabilia' | 'camera_electrical' | 'other_collectibles' | 'wine_bottle' | 'spirits_bottle' | 'beer_bottle' | 'wine_case' | 'spirits_case' | 'beer_case' | 'wine_barrel' | 'spirits_barrel' | 'beer_barrel' | 'other_alcohols' | 'car' | 'motorcycle' | 'bus' | 'van' | 'limousine' | 'carriage' | 'trailer' | 'sidecar' | 'other_automotive' | 'clothing' | 'footwear' | 'handbag' | 'accessories' | 'other_fashion' | 'musical_instrument' | 'firearm_weapon' | 'hunting_fishing' | 'medical_equipment' | 'other';
|
|
16
|
+
export type ParcelTransportServices = 'economy' | 'economy_freight' | 'ground' | 'next_day_air' | 'priority' | 'priority_freight' | 'second_day_air' | 'standard';
|
|
17
|
+
export type WebhookDeliveryType = 'request.created' | 'request.status.updated' | 'shipment.created' | 'shipment.eei_form_status.updated' | 'shipment.schedule.updated' | 'shipment.status.updated' | 'shipment.tracking.updated' | 'ping';
|
|
18
|
+
export type ObjectMaterial = 'stone_marble' | 'precious_stones' | 'fiber_synthetic' | 'fabric_natural' | 'taxidermy' | 'carbon_fiber' | 'live_animal' | 'paper' | 'glass' | 'presious_metals' | 'particleboard' | 'styrofoam' | 'wood' | 'photo_film' | 'sand' | 'metal' | 'plexiglass' | 'aquatic_life' | 'canvas' | 'drywall' | 'hard_plastic' | 'vinyl' | 'soft_plastic' | 'leather' | 'rubber' | 'concreate' | 'paint' | 'electronics' | 'fiber_natural' | 'gas' | 'fabric_synthetic' | 'CITES' | 'liquids' | 'salts';
|
|
19
|
+
export type ArtaTrackingServiceType = 'transport' | 'location' | 'handling' | 'packing' | 'storage' | 'administration' | 'taxes_duties_fees' | 'security' | 'equipment';
|
|
20
|
+
export type ArtaTrackingServiceSubType = 'specialized' | 'consolidated' | 'freight' | 'parcel' | 'collection' | 'delivery' | 'location' | 'unpacking' | 'condition' | 'installation' | 'deinstallation' | 'debris_disposal' | 'site_visit' | 'handling' | 'packing' | 'packing_materials' | 'receive_release' | 'warehouse' | 'customs' | 'coi' | 'administration' | 'taxes_duties' | 'fees' | 'security' | 'equipment';
|
|
21
|
+
export type ArtaTrackingServiceSubSubType = 'armored_transport' | 'dedicated_transport' | 'specialized_shuttle' | 'road_groupage' | 'sea_groupage' | 'sea_freight' | 'ltl_freight' | 'ftl_freight' | 'air_freight' | 'cargo_air_freight' | 'parcel' | 'priority_freight' | 'economy_freight' | 'collection' | 'art_fair_collection' | 'residential_collection' | 'airport_collection' | 'port_collection' | 'dock_collection' | 'consolidated_collection' | 'failed_collection' | 'recollection' | 'delivery' | 'inside_delivery' | 'art_fair_delivery' | 'room_of_choice_delivery' | 'curbside_delivery' | 'residential_delivery' | 'signature_delivery' | 'saturday_delivery' | 'sunday_delivery' | 'scheduled_delivery' | 'after_hours_delivery' | 'airport_delivery' | 'port_delivery' | 'dock_delivery' | 'failed_delivery' | 'redelivery' | 'origin_additional_stops' | 'destination_additional_stops' | 'origin_off_route' | 'destination_off_route' | 'must_fly' | 'origin_unpacking_soft' | 'destination_unpacking_soft' | 'origin_unpacking_wood' | 'destination_unpacking_wood' | 'origin_unpacking' | 'destination_unpacking' | 'origin_full_condition_report' | 'destination_full_condition_report' | 'origin_condition_check' | 'destination_condition_check' | 'installation' | 'placement' | 'assembly' | 'deinstallation' | 'disassembly' | 'debris_disposal' | 'crate_disposal' | 'soft_packed_disposal' | 'origin_site_visit' | 'destination_site_visit' | 'origin_additional_labor' | 'destination_additional_labor' | 'airport_handling' | 'origin_oversized_handling' | 'destination_oversized_handling' | 'origin_additional_stairs' | 'destination_additional_stairs' | 'packing_labor' | 'crate_fabrication' | 't_frame_fabrication' | 'fabrication' | 'retrofitting' | 'additional_packing' | 'pack_into' | 'poly' | 'dartek' | 'bubble' | 'cling_wrap' | 'cbin_communal' | 'blanket' | 'portfolio' | 'poly_cardboard' | 'bubble_cardboard' | 'rug_rolled' | 'cbin_closed' | 'cbin_open' | 'garment_bag' | 'wardrobe_box' | 'cardboard_box' | 'chandelier_box' | 'chair_box' | 'slipcase' | 'glass_tape' | 'stabilizing_box' | 'shadow_box' | 'foam_lined_box' | 'cavity_box' | 'strongbox' | 'double_box' | 'shipping_tube_small' | 'shipping_tube_large' | 'sonotube' | 'alcohol_case' | 'lay_flat_wine_box' | 'lockbox' | 'travel_frame' | 'travel_frame_art' | 'travel_frame_other' | 'a_frame' | 'slat_crate' | 'tri_wall_crate' | 'ply_box' | 'fine_art_econo_crate' | 'fine_art_international_crate' | 'econo_crate' | 'international_econo_crate' | 'furniture_crate' | 'international_furniture_crate' | 'parcel_crate' | 'museum_crate' | 'international_museum_crate' | 'pallet' | 'international_pallet' | 'warehouse_handling' | 'receive_in_fee' | 'release_fee' | 'storage' | 'temp_storage' | 'viewing_room' | 'staging' | 'import_customs_formalities' | 'export_customs_formalities' | 'origin_building_coi' | 'destination_building_coi' | 'double_blind_bols' | 'power_of_attorney' | 'administrative' | 'mpf' | 'bond' | 'duties' | 'taxes' | 'disbursement' | 'temporary_customs_entry' | 'fuel_surcharge' | 'tarmac_supervision' | 'courier_onboard' | 'fork_lift' | 'gantry' | 'pallet_jack' | 'scaffolding' | 'rigging' | 'lift_gate' | 'ramp' | 'floor_protection';
|
|
22
|
+
export type DisqualificationReasonCode = 'external_service_unavailable' | 'client_timeout_reached';
|
|
23
|
+
export type PackageStatus = 'pending' | 'transit' | 'out_for_delivery' | 'delivered' | 'unknown' | 'notfound' | 'undelivered' | 'exception' | 'expired';
|
|
24
|
+
export type EEIFormStatus = 'pending' | 'cleared' | 'approved' | 'rejected' | 'submitted';
|
|
25
|
+
export type ShipmentStatus = 'pending' | 'confirmed' | 'collected' | 'in_transit' | 'completed';
|
|
26
|
+
export type WebhookResourceType = 'ping' | 'request' | 'shipment';
|
|
27
|
+
export type WebhookDeliveryStatus = 'delivered' | 'failed';
|
|
28
|
+
export type PaymentContext = 'hosted_checkout' | 'invoiced';
|
|
29
|
+
export type SupportedCurrency = 'CAD' | 'EUR' | 'GBP' | 'HKD' | 'USD';
|
|
30
|
+
export type AuthTypes = 'api_key';
|
|
31
|
+
export type APIStatus = 'active' | 'beta' | 'deprecated';
|
|
32
|
+
export interface Contact {
|
|
33
|
+
name: string;
|
|
34
|
+
email_address?: NullableString;
|
|
35
|
+
phone_number?: NullableString;
|
|
36
|
+
}
|
|
37
|
+
export interface ArtaLocation {
|
|
38
|
+
access_restrictions?: Nullable<AccessRestriction[]>;
|
|
39
|
+
address_line_1?: NullableString;
|
|
40
|
+
address_line_2?: NullableString;
|
|
41
|
+
address_line_3?: NullableString;
|
|
42
|
+
city?: NullableString;
|
|
43
|
+
region?: NullableString;
|
|
44
|
+
postal_code?: NullableString;
|
|
45
|
+
country: string;
|
|
46
|
+
title?: NullableString;
|
|
47
|
+
contacts?: Nullable<Contact[]>;
|
|
48
|
+
}
|
|
49
|
+
export type Details = {
|
|
50
|
+
materials?: Nullable<ObjectMaterial[]>;
|
|
51
|
+
creation_date?: NullableString;
|
|
52
|
+
creator?: NullableString;
|
|
53
|
+
notes?: NullableString;
|
|
54
|
+
title?: NullableString;
|
|
55
|
+
is_fragile?: Nullable<boolean>;
|
|
56
|
+
is_cites?: Nullable<boolean>;
|
|
57
|
+
};
|
|
58
|
+
export interface ArtaObject {
|
|
59
|
+
internal_reference?: NullableString;
|
|
60
|
+
current_packing?: Nullable<PackingSubType[]>;
|
|
61
|
+
details?: Nullable<Details>;
|
|
62
|
+
height: number | string;
|
|
63
|
+
width: number | string;
|
|
64
|
+
weight?: Nullable<number | string>;
|
|
65
|
+
value: number | string;
|
|
66
|
+
depth?: Nullable<number | string>;
|
|
67
|
+
images?: Nullable<string[]>;
|
|
68
|
+
public_reference?: string;
|
|
69
|
+
subtype: ObjectSubType;
|
|
70
|
+
unit_of_measurement?: NullableString;
|
|
71
|
+
weight_unit?: NullableString;
|
|
72
|
+
value_currency: SupportedCurrency;
|
|
73
|
+
}
|
|
74
|
+
export interface Disqualification {
|
|
75
|
+
quote_types: QuoteType[];
|
|
76
|
+
reason?: NullableString;
|
|
77
|
+
reason_code: DisqualificationReasonCode;
|
|
78
|
+
}
|
|
79
|
+
export interface InsurancePolicy {
|
|
80
|
+
amount: number;
|
|
81
|
+
amount_currency: SupportedCurrency;
|
|
82
|
+
id: string;
|
|
83
|
+
insured_value: number;
|
|
84
|
+
insured_value_currency: SupportedCurrency;
|
|
85
|
+
}
|
|
86
|
+
export interface ArtaService {
|
|
87
|
+
amount: number;
|
|
88
|
+
amount_currency: SupportedCurrency;
|
|
89
|
+
included_services: ArtaService[];
|
|
90
|
+
is_requested: boolean;
|
|
91
|
+
is_required: boolean;
|
|
92
|
+
name: string;
|
|
93
|
+
sub_subtype: ArtaTrackingServiceSubSubType;
|
|
94
|
+
subtype: ArtaTrackingServiceSubType;
|
|
95
|
+
type: ArtaTrackingServiceType;
|
|
96
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Logger, LoggerVerbosity } from './logging';
|
|
2
|
+
import { AttachmentsEndpoint } from './endpoint/attachment';
|
|
3
|
+
import { EmailRulesEndpoint } from './endpoint/emailRules';
|
|
4
|
+
import { EmailSubscriptionsEndpoint } from './endpoint/emailSubscriptions';
|
|
5
|
+
import { HostedSessionsEndpoint } from './endpoint/hostedSessions';
|
|
6
|
+
import { InvoicePaymentsEndpoint } from './endpoint/invoicePayments';
|
|
7
|
+
import { InvoicesEndpoint } from './endpoint/invoices';
|
|
8
|
+
import { KeysEndpoint } from './endpoint/keys';
|
|
9
|
+
import { LogsEndpoint } from './endpoint/logs';
|
|
10
|
+
import { MetadataEndpoint } from './endpoint/metadata';
|
|
11
|
+
import { OrganizationsEndpoint } from './endpoint/organization';
|
|
12
|
+
import { PaymentsEndpoint } from './endpoint/payments';
|
|
13
|
+
import { UploadsEndpoint } from './endpoint/uploads';
|
|
14
|
+
import { WebhookDeliveriesEndpoint } from './endpoint/webhookDeliveries';
|
|
15
|
+
import { WebhooksEndpoint } from './endpoint/webhooks';
|
|
16
|
+
import { TrackingsEndpoint } from './endpoint/trackings';
|
|
17
|
+
import { QuoteRequestsEndpoint } from './endpoint/requests';
|
|
18
|
+
import { ShipmentsEndpoint } from './endpoint/shipments';
|
|
19
|
+
export interface ArtaConfig {
|
|
20
|
+
host: string;
|
|
21
|
+
verbosity: LoggerVerbosity;
|
|
22
|
+
logger: Logger;
|
|
23
|
+
}
|
|
24
|
+
export declare class Arta {
|
|
25
|
+
private readonly artaClient;
|
|
26
|
+
private readonly config;
|
|
27
|
+
attachments: AttachmentsEndpoint;
|
|
28
|
+
email_rules: EmailRulesEndpoint;
|
|
29
|
+
email_subscriptions: EmailSubscriptionsEndpoint;
|
|
30
|
+
hosted_sessions: HostedSessionsEndpoint;
|
|
31
|
+
invoice_payments: InvoicePaymentsEndpoint;
|
|
32
|
+
invoices: InvoicesEndpoint;
|
|
33
|
+
keys: KeysEndpoint;
|
|
34
|
+
logs: LogsEndpoint;
|
|
35
|
+
metadata: MetadataEndpoint;
|
|
36
|
+
organizations: OrganizationsEndpoint;
|
|
37
|
+
payments: PaymentsEndpoint;
|
|
38
|
+
requests: QuoteRequestsEndpoint;
|
|
39
|
+
shipments: ShipmentsEndpoint;
|
|
40
|
+
trackings: TrackingsEndpoint;
|
|
41
|
+
uploads: UploadsEndpoint;
|
|
42
|
+
webhook_deliveries: WebhookDeliveriesEndpoint;
|
|
43
|
+
webhooks: WebhooksEndpoint;
|
|
44
|
+
constructor(apiKey: string, config?: Partial<ArtaConfig>);
|
|
45
|
+
}
|
package/dist/lib/arta.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Arta = void 0;
|
|
4
|
+
var ArtaClient_1 = require("./ArtaClient");
|
|
5
|
+
var logging_1 = require("./logging");
|
|
6
|
+
var NodeHttpClient_1 = require("./net/NodeHttpClient");
|
|
7
|
+
var attachment_1 = require("./endpoint/attachment");
|
|
8
|
+
var emailRules_1 = require("./endpoint/emailRules");
|
|
9
|
+
var emailSubscriptions_1 = require("./endpoint/emailSubscriptions");
|
|
10
|
+
var hostedSessions_1 = require("./endpoint/hostedSessions");
|
|
11
|
+
var invoicePayments_1 = require("./endpoint/invoicePayments");
|
|
12
|
+
var invoices_1 = require("./endpoint/invoices");
|
|
13
|
+
var keys_1 = require("./endpoint/keys");
|
|
14
|
+
var logs_1 = require("./endpoint/logs");
|
|
15
|
+
var metadata_1 = require("./endpoint/metadata");
|
|
16
|
+
var organization_1 = require("./endpoint/organization");
|
|
17
|
+
var payments_1 = require("./endpoint/payments");
|
|
18
|
+
var uploads_1 = require("./endpoint/uploads");
|
|
19
|
+
var webhookDeliveries_1 = require("./endpoint/webhookDeliveries");
|
|
20
|
+
var webhooks_1 = require("./endpoint/webhooks");
|
|
21
|
+
var trackings_1 = require("./endpoint/trackings");
|
|
22
|
+
var requests_1 = require("./endpoint/requests");
|
|
23
|
+
var shipments_1 = require("./endpoint/shipments");
|
|
24
|
+
var defaultConfig = {
|
|
25
|
+
host: 'api.arta.io',
|
|
26
|
+
verbosity: 'ERROR',
|
|
27
|
+
logger: console,
|
|
28
|
+
};
|
|
29
|
+
var Arta = /** @class */ (function () {
|
|
30
|
+
function Arta(apiKey, config) {
|
|
31
|
+
this.config = Object.assign(defaultConfig, config);
|
|
32
|
+
(0, logging_1.initLogger)(this.config.logger, this.config.verbosity);
|
|
33
|
+
this.artaClient = new ArtaClient_1.ArtaClient(new NodeHttpClient_1.NodeHttpClient(), {
|
|
34
|
+
apiKey: apiKey,
|
|
35
|
+
host: this.config.host,
|
|
36
|
+
});
|
|
37
|
+
this.attachments = new attachment_1.AttachmentsEndpoint(this.artaClient);
|
|
38
|
+
this.email_rules = new emailRules_1.EmailRulesEndpoint(this.artaClient);
|
|
39
|
+
this.email_subscriptions = new emailSubscriptions_1.EmailSubscriptionsEndpoint(this.artaClient);
|
|
40
|
+
this.hosted_sessions = new hostedSessions_1.HostedSessionsEndpoint(this.artaClient);
|
|
41
|
+
this.invoice_payments = new invoicePayments_1.InvoicePaymentsEndpoint(this.artaClient);
|
|
42
|
+
this.invoices = new invoices_1.InvoicesEndpoint(this.artaClient);
|
|
43
|
+
this.keys = new keys_1.KeysEndpoint(this.artaClient);
|
|
44
|
+
this.logs = new logs_1.LogsEndpoint(this.artaClient);
|
|
45
|
+
this.metadata = new metadata_1.MetadataEndpoint(this.artaClient);
|
|
46
|
+
this.organizations = new organization_1.OrganizationsEndpoint(this.artaClient);
|
|
47
|
+
this.payments = new payments_1.PaymentsEndpoint(this.artaClient);
|
|
48
|
+
this.requests = new requests_1.QuoteRequestsEndpoint(this.artaClient);
|
|
49
|
+
this.shipments = new shipments_1.ShipmentsEndpoint(this.artaClient);
|
|
50
|
+
this.trackings = new trackings_1.TrackingsEndpoint(this.artaClient);
|
|
51
|
+
this.uploads = new uploads_1.UploadsEndpoint(this.artaClient);
|
|
52
|
+
this.webhook_deliveries = new webhookDeliveries_1.WebhookDeliveriesEndpoint(this.artaClient);
|
|
53
|
+
this.webhooks = new webhooks_1.WebhooksEndpoint(this.artaClient);
|
|
54
|
+
}
|
|
55
|
+
return Arta;
|
|
56
|
+
}());
|
|
57
|
+
exports.Arta = Arta;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ArtaID } from '../ArtaClient';
|
|
2
|
+
import { RestClient } from '../net/RestClient';
|
|
3
|
+
import { DatedInterface, NullableString } from '../utils';
|
|
4
|
+
import { Page } from '../pagination';
|
|
5
|
+
export interface Attachment extends DatedInterface {
|
|
6
|
+
id: ArtaID;
|
|
7
|
+
upload_id: number;
|
|
8
|
+
request_id?: NullableString;
|
|
9
|
+
shipment_id?: NullableString;
|
|
10
|
+
}
|
|
11
|
+
export interface AttachmentCreateBodyRequest {
|
|
12
|
+
upload_id: number;
|
|
13
|
+
request_id: string;
|
|
14
|
+
}
|
|
15
|
+
export interface AttachmentCreateBodyShipment {
|
|
16
|
+
upload_id: number;
|
|
17
|
+
shipment_id: string;
|
|
18
|
+
}
|
|
19
|
+
export type AttachmentCreateBody = AttachmentCreateBodyRequest | AttachmentCreateBodyShipment;
|
|
20
|
+
export interface AttachmentCreate {
|
|
21
|
+
attachment: AttachmentCreateBody;
|
|
22
|
+
}
|
|
23
|
+
export declare class AttachmentsEndpoint {
|
|
24
|
+
private readonly artaClient;
|
|
25
|
+
private readonly defaultEndpoint;
|
|
26
|
+
private readonly path;
|
|
27
|
+
constructor(artaClient: RestClient);
|
|
28
|
+
getById(id: ArtaID, auth?: string): Promise<Attachment>;
|
|
29
|
+
list(page?: number, pageSize?: number, auth?: string): Promise<Page<Attachment>>;
|
|
30
|
+
create(payload: AttachmentCreateBody, auth?: string): Promise<Attachment>;
|
|
31
|
+
remove(id: ArtaID, auth?: string): Promise<void>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AttachmentsEndpoint = void 0;
|
|
4
|
+
var endpoint_1 = require("./endpoint");
|
|
5
|
+
var AttachmentsEndpoint = /** @class */ (function () {
|
|
6
|
+
function AttachmentsEndpoint(artaClient) {
|
|
7
|
+
this.artaClient = artaClient;
|
|
8
|
+
this.path = '/attachments';
|
|
9
|
+
this.defaultEndpoint = new endpoint_1.DefaultEndpoint(this.path, this.artaClient);
|
|
10
|
+
}
|
|
11
|
+
AttachmentsEndpoint.prototype.getById = function (id, auth) {
|
|
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) {
|
|
20
|
+
return this.defaultEndpoint.create({ attachment: payload }, auth);
|
|
21
|
+
};
|
|
22
|
+
AttachmentsEndpoint.prototype.remove = function (id, auth) {
|
|
23
|
+
return this.defaultEndpoint.remove(id, auth);
|
|
24
|
+
};
|
|
25
|
+
return AttachmentsEndpoint;
|
|
26
|
+
}());
|
|
27
|
+
exports.AttachmentsEndpoint = AttachmentsEndpoint;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ArtaID } from '../ArtaClient';
|
|
2
|
+
import { RestClient } from '../net/RestClient';
|
|
3
|
+
import { DatedInterface } from '../utils';
|
|
4
|
+
import { Page } from '../pagination';
|
|
5
|
+
import { EmailNotificationId, Recipients } from '../MetadataTypes';
|
|
6
|
+
export interface EmailRule extends DatedInterface {
|
|
7
|
+
id: ArtaID;
|
|
8
|
+
email_notification_id: EmailNotificationId;
|
|
9
|
+
recipients: Recipients[];
|
|
10
|
+
}
|
|
11
|
+
export interface EmailRuleCreateBody {
|
|
12
|
+
email_notification_id: EmailNotificationId;
|
|
13
|
+
recipients: Recipients[];
|
|
14
|
+
}
|
|
15
|
+
export interface EmailRuleCreate {
|
|
16
|
+
email_rule: EmailRuleCreateBody;
|
|
17
|
+
}
|
|
18
|
+
export declare class EmailRulesEndpoint {
|
|
19
|
+
private readonly artaClient;
|
|
20
|
+
private readonly defaultEndpoint;
|
|
21
|
+
private readonly path;
|
|
22
|
+
constructor(artaClient: RestClient);
|
|
23
|
+
getById(id: ArtaID, auth?: string): Promise<EmailRule>;
|
|
24
|
+
list(page?: number, pageSize?: number, auth?: string): Promise<Page<EmailRule>>;
|
|
25
|
+
update(id: ArtaID, payload: {
|
|
26
|
+
recipients: Recipients[];
|
|
27
|
+
}, auth?: string): Promise<EmailRule>;
|
|
28
|
+
create(payload: EmailRuleCreateBody, auth?: string): Promise<EmailRule>;
|
|
29
|
+
remove(id: ArtaID, auth?: string): Promise<void>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EmailRulesEndpoint = void 0;
|
|
4
|
+
var endpoint_1 = require("./endpoint");
|
|
5
|
+
var EmailRulesEndpoint = /** @class */ (function () {
|
|
6
|
+
function EmailRulesEndpoint(artaClient) {
|
|
7
|
+
this.artaClient = artaClient;
|
|
8
|
+
this.path = '/email_rules';
|
|
9
|
+
this.defaultEndpoint = new endpoint_1.DefaultEndpoint(this.path, this.artaClient);
|
|
10
|
+
}
|
|
11
|
+
EmailRulesEndpoint.prototype.getById = function (id, auth) {
|
|
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 = {
|
|
21
|
+
email_rule: payload,
|
|
22
|
+
};
|
|
23
|
+
return this.defaultEndpoint.update(id, emailRulesPayload, auth);
|
|
24
|
+
};
|
|
25
|
+
EmailRulesEndpoint.prototype.create = function (payload, auth) {
|
|
26
|
+
return this.defaultEndpoint.create({ email_rule: payload }, auth);
|
|
27
|
+
};
|
|
28
|
+
EmailRulesEndpoint.prototype.remove = function (id, auth) {
|
|
29
|
+
return this.defaultEndpoint.remove(id, auth);
|
|
30
|
+
};
|
|
31
|
+
return EmailRulesEndpoint;
|
|
32
|
+
}());
|
|
33
|
+
exports.EmailRulesEndpoint = EmailRulesEndpoint;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ArtaID } from '../ArtaClient';
|
|
2
|
+
import { RestClient } from '../net/RestClient';
|
|
3
|
+
import { DatedInterface, NullableString } from '../utils';
|
|
4
|
+
import { Page } from '../pagination';
|
|
5
|
+
import { EmailNotificationId } from '../MetadataTypes';
|
|
6
|
+
export interface EmailSubscription extends DatedInterface {
|
|
7
|
+
id: ArtaID;
|
|
8
|
+
email_notification_ids: EmailNotificationId;
|
|
9
|
+
email_address: string;
|
|
10
|
+
name?: NullableString;
|
|
11
|
+
}
|
|
12
|
+
export interface EmailSubscriptionCreateBody {
|
|
13
|
+
email_notification_ids: EmailNotificationId;
|
|
14
|
+
email_address: string;
|
|
15
|
+
name?: NullableString;
|
|
16
|
+
}
|
|
17
|
+
export interface EmailSubscriptionCreate {
|
|
18
|
+
email_subscription: EmailSubscriptionCreateBody;
|
|
19
|
+
}
|
|
20
|
+
export declare class EmailSubscriptionsEndpoint {
|
|
21
|
+
private readonly artaClient;
|
|
22
|
+
private readonly defaultEndpoint;
|
|
23
|
+
private readonly path;
|
|
24
|
+
constructor(artaClient: RestClient);
|
|
25
|
+
getById(id: ArtaID, auth?: string): Promise<EmailSubscription>;
|
|
26
|
+
list(page?: number, pageSize?: number, auth?: string): Promise<Page<EmailSubscription>>;
|
|
27
|
+
update(id: ArtaID, payload: {
|
|
28
|
+
email_notification_ids: EmailNotificationId[];
|
|
29
|
+
}, auth?: string): Promise<EmailSubscription>;
|
|
30
|
+
create(payload: EmailSubscriptionCreateBody, auth?: string): Promise<EmailSubscription>;
|
|
31
|
+
remove(id: ArtaID, auth?: string): Promise<void>;
|
|
32
|
+
}
|