@artaio/node-api 1.2.0 → 1.2.3

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.
@@ -16,6 +16,7 @@ import { WebhooksEndpoint } from './endpoint/webhooks';
16
16
  import { TrackingsEndpoint } from './endpoint/trackings';
17
17
  import { QuoteRequestsEndpoint } from './endpoint/requests';
18
18
  import { ShipmentsEndpoint } from './endpoint/shipments';
19
+ import { TagsEndpoint } from './endpoint/tags';
19
20
  export interface ArtaConfig {
20
21
  host: string;
21
22
  verbosity: LoggerVerbosity;
@@ -37,6 +38,7 @@ export declare class Arta {
37
38
  payments: PaymentsEndpoint;
38
39
  requests: QuoteRequestsEndpoint;
39
40
  shipments: ShipmentsEndpoint;
41
+ tags: TagsEndpoint;
40
42
  trackings: TrackingsEndpoint;
41
43
  uploads: UploadsEndpoint;
42
44
  webhook_deliveries: WebhookDeliveriesEndpoint;
package/dist/lib/arta.js CHANGED
@@ -21,6 +21,7 @@ var webhooks_1 = require("./endpoint/webhooks");
21
21
  var trackings_1 = require("./endpoint/trackings");
22
22
  var requests_1 = require("./endpoint/requests");
23
23
  var shipments_1 = require("./endpoint/shipments");
24
+ var tags_1 = require("./endpoint/tags");
24
25
  var defaultConfig = {
25
26
  host: 'api.arta.io',
26
27
  verbosity: 'ERROR',
@@ -47,6 +48,7 @@ var Arta = /** @class */ (function () {
47
48
  this.payments = new payments_1.PaymentsEndpoint(this.artaClient);
48
49
  this.requests = new requests_1.QuoteRequestsEndpoint(this.artaClient);
49
50
  this.shipments = new shipments_1.ShipmentsEndpoint(this.artaClient);
51
+ this.tags = new tags_1.TagsEndpoint(this.artaClient);
50
52
  this.trackings = new trackings_1.TrackingsEndpoint(this.artaClient);
51
53
  this.uploads = new uploads_1.UploadsEndpoint(this.artaClient);
52
54
  this.webhook_deliveries = new webhookDeliveries_1.WebhookDeliveriesEndpoint(this.artaClient);
@@ -40,6 +40,9 @@ export declare class QuoteRequestsEndpoint {
40
40
  getById(id: string, auth?: string): Promise<EnrichRequest<QuoteRequest>>;
41
41
  list(search?: RequestsSearch, page?: number, pageSize?: number, auth?: string): Promise<Page<EnrichRequest<QuoteRequestListItem>>>;
42
42
  create(payload: QuoteRequestCreateBody, auth?: string): Promise<EnrichRequest<QuoteRequest>>;
43
+ update(id: QuoteRequest['id'], payload: Partial<Pick<QuoteRequest, 'destination' | 'internal_reference' | 'origin' | 'payment_process' | 'public_reference'> & {
44
+ tags: Array<string>;
45
+ }>, auth?: string): Promise<EnrichRequest<QuoteRequest>>;
43
46
  updateContacts(id: string, contacts: UpdateRequestsContactsBody, auth?: string): Promise<EnrichRequest<QuoteRequest>>;
44
47
  requireCustomQuotes(id: string, customQuote: CustomQuotePayload, auth?: string): Promise<QuoteRequest>;
45
48
  cancel(id: string, auth?: string): Promise<QuoteRequest>;
@@ -63,7 +63,19 @@ var QuoteRequestsEndpoint = /** @class */ (function () {
63
63
  q.total = Number(q.total);
64
64
  q.included_services.forEach(utils_1.parseService);
65
65
  q.optional_services.forEach(utils_1.parseService);
66
+ if (q.tags) {
67
+ q.tags.forEach(function (t) {
68
+ q.created_at = (0, utils_1.createDateAsUTC)(t.created_at);
69
+ q.updated_at = (0, utils_1.createDateAsUTC)(t.updated_at);
70
+ });
71
+ }
66
72
  });
73
+ if (resource.tags) {
74
+ resource.tags.forEach(function (t) {
75
+ t.created_at = (0, utils_1.createDateAsUTC)(t.created_at);
76
+ t.updated_at = (0, utils_1.createDateAsUTC)(t.updated_at);
77
+ });
78
+ }
67
79
  }
68
80
  var updateContacts = function (contacts, auth) { return _this.updateContacts(resource.id, contacts, auth); };
69
81
  var requireCustomQuotes = function (customQuote, auth) { return _this.requireCustomQuotes(resource.id, customQuote, auth); };
@@ -81,6 +93,9 @@ var QuoteRequestsEndpoint = /** @class */ (function () {
81
93
  QuoteRequestsEndpoint.prototype.create = function (payload, auth) {
82
94
  return this.defaultEndpoint.create({ request: payload }, auth);
83
95
  };
96
+ QuoteRequestsEndpoint.prototype.update = function (id, payload, auth) {
97
+ return this.defaultEndpoint.update(id, { request: payload }, auth);
98
+ };
84
99
  QuoteRequestsEndpoint.prototype.updateContacts = function (id, contacts, auth) {
85
100
  return __awaiter(this, void 0, void 0, function () {
86
101
  var rawReq;
@@ -22,4 +22,7 @@ export declare class ShipmentsEndpoint {
22
22
  getById(id: ArtaID, auth?: string): Promise<Shipment>;
23
23
  list(search?: ShipmentsSearch, page?: number, pageSize?: number, auth?: string): Promise<Page<Shipment>>;
24
24
  create(payload: ShipmentCreateBody, auth?: string): Promise<Shipment>;
25
+ update(id: Shipment['id'], payload: Partial<Pick<Shipment, 'internal_reference' | 'payment_process' | 'public_reference'> & {
26
+ tags: Array<string>;
27
+ }>, auth?: string): Promise<Shipment>;
25
28
  }
@@ -34,6 +34,12 @@ var ShipmentsEndpoint = /** @class */ (function () {
34
34
  e.updated_at = (0, utils_1.createDateAsUTC)(e.updated_at);
35
35
  });
36
36
  }
37
+ if (s.tags) {
38
+ s.tags.forEach(function (t) {
39
+ t.created_at = (0, utils_1.createDateAsUTC)(t.created_at);
40
+ t.updated_at = (0, utils_1.createDateAsUTC)(t.updated_at);
41
+ });
42
+ }
37
43
  s.services && s.services.forEach(utils_1.parseService);
38
44
  return s;
39
45
  };
@@ -48,6 +54,9 @@ var ShipmentsEndpoint = /** @class */ (function () {
48
54
  ShipmentsEndpoint.prototype.create = function (payload, auth) {
49
55
  return this.defaultEndpoint.create({ shipment: payload }, auth);
50
56
  };
57
+ ShipmentsEndpoint.prototype.update = function (id, payload, auth) {
58
+ return this.defaultEndpoint.update(id, { shipment: payload }, auth);
59
+ };
51
60
  return ShipmentsEndpoint;
52
61
  }());
53
62
  exports.ShipmentsEndpoint = ShipmentsEndpoint;
@@ -0,0 +1,17 @@
1
+ import type { RestClient } from '../net/RestClient';
2
+ import type { Page } from '../pagination';
3
+ import type { Tag } from '../types';
4
+ export type TagCreateBody = Omit<Tag, 'id' | 'created_at' | 'updated_at'>;
5
+ export interface TagCreate {
6
+ tag: TagCreateBody;
7
+ }
8
+ export declare class TagsEndpoint {
9
+ private readonly artaClient;
10
+ private readonly defaultEndpoint;
11
+ private readonly path;
12
+ constructor(artaClient: RestClient);
13
+ getByName(name: Tag['name'], auth?: string): Promise<Tag>;
14
+ list(page?: number, pageSize?: number, auth?: string): Promise<Page<Tag>>;
15
+ create(payload: TagCreateBody, auth?: string): Promise<Tag>;
16
+ update(name: Tag['name'], payload: Partial<TagCreateBody>, auth?: string): Promise<Tag>;
17
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TagsEndpoint = void 0;
4
+ var endpoint_1 = require("./endpoint");
5
+ var TagsEndpoint = /** @class */ (function () {
6
+ function TagsEndpoint(artaClient) {
7
+ this.artaClient = artaClient;
8
+ this.path = '/tags';
9
+ this.defaultEndpoint = new endpoint_1.DefaultEndpoint(this.path, this.artaClient);
10
+ }
11
+ TagsEndpoint.prototype.getByName = function (name, auth) {
12
+ return this.defaultEndpoint.getById(name, auth);
13
+ };
14
+ TagsEndpoint.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
+ TagsEndpoint.prototype.create = function (payload, auth) {
20
+ return this.defaultEndpoint.create({ tag: payload }, auth);
21
+ };
22
+ TagsEndpoint.prototype.update = function (name, payload, auth) {
23
+ return this.defaultEndpoint.update(name, { tag: payload }, auth);
24
+ };
25
+ return TagsEndpoint;
26
+ }());
27
+ exports.TagsEndpoint = TagsEndpoint;
@@ -1,3 +1,14 @@
1
+ export type Tag = {
2
+ updated_at: Date;
3
+ created_at: Date;
4
+ id: string;
5
+ created_by?: (number | null) | undefined;
6
+ description?: (string | null) | undefined;
7
+ name: string;
8
+ updated_by?: (number | null) | undefined;
9
+ color: string;
10
+ is_active: boolean;
11
+ };
1
12
  export type Attachment = {
2
13
  updated_at: Date;
3
14
  created_at: Date;
@@ -61,7 +72,17 @@ export type QuoteRequest = {
61
72
  quote_types: ("parcel" | "premium" | "select" | "self_ship")[];
62
73
  shortcode: string;
63
74
  status: "cancelled" | "closed" | "disqualified" | "expired" | "in_progress" | "pending" | "quoted";
64
- tags?: any;
75
+ tags: {
76
+ updated_at: Date;
77
+ created_at: Date;
78
+ id: string;
79
+ created_by?: (number | null) | undefined;
80
+ description?: (string | null) | undefined;
81
+ name: string;
82
+ updated_by?: (number | null) | undefined;
83
+ color: string;
84
+ is_active: boolean;
85
+ }[];
65
86
  currency: "CAD" | "CHF" | "EUR" | "GBP" | "HKD" | "USD";
66
87
  additional_services: ("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")[];
67
88
  disqualifications: {
@@ -273,6 +294,17 @@ export type Shipment = {
273
294
  shortcode: string;
274
295
  status: "pending" | "confirmed" | "collected" | "in_transit" | "completed";
275
296
  total: number;
297
+ tags: {
298
+ updated_at: Date;
299
+ created_at: Date;
300
+ id: string;
301
+ created_by?: (number | null) | undefined;
302
+ description?: (string | null) | undefined;
303
+ name: string;
304
+ updated_by?: (number | null) | undefined;
305
+ color: string;
306
+ is_active: boolean;
307
+ }[];
276
308
  total_currency: "CAD" | "CHF" | "EUR" | "GBP" | "HKD" | "USD";
277
309
  url?: (string | null) | undefined;
278
310
  tracking?: ({
@@ -743,7 +775,17 @@ export type QuoteRequestListItem = {
743
775
  quote_types: ("parcel" | "premium" | "select" | "self_ship")[];
744
776
  shortcode: string;
745
777
  status: "cancelled" | "closed" | "disqualified" | "expired" | "in_progress" | "pending" | "quoted";
746
- tags?: any;
778
+ tags: {
779
+ updated_at: Date;
780
+ created_at: Date;
781
+ id: string;
782
+ created_by?: (number | null) | undefined;
783
+ description?: (string | null) | undefined;
784
+ name: string;
785
+ updated_by?: (number | null) | undefined;
786
+ color: string;
787
+ is_active: boolean;
788
+ }[];
747
789
  };
748
790
  export type EmailNotificationId = "booking" | "cancelled" | "collected" | "collection" | "complete" | "custom_quoted_dashboard" | "in_transit" | "invoice" | "self_ship_label" | "payment" | "scheduling" | "eei";
749
791
  export type Recipient = "payer" | "origin" | "destination";
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artaio/node-api",
3
- "version": "1.2.0",
3
+ "version": "1.2.3",
4
4
  "description": "The Arta Node library provides a seamless integration to Arta API for backend applications using both Typescript or Javascript.",
5
5
  "scripts": {
6
6
  "build": "npm run build:types && tsc -p tsconfig-build.json",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artaio/node-api",
3
- "version": "1.2.0",
3
+ "version": "1.2.3",
4
4
  "description": "The Arta Node library provides a seamless integration to Arta API for backend applications using both Typescript or Javascript.",
5
5
  "scripts": {
6
6
  "build": "npm run build:types && tsc -p tsconfig-build.json",