@shipengine/connect-carrier-api 2.1.18 → 2.1.22
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/lib/app/carrier-app-definition.d.ts +12 -2
- package/lib/app/carrier-app.js +79 -53
- package/lib/app/carrier-app.js.map +1 -1
- package/lib/app/constants.d.ts +14 -0
- package/lib/app/constants.js +19 -0
- package/lib/app/constants.js.map +1 -0
- package/lib/app/internal/route.d.ts +1 -0
- package/lib/models/authorization.d.ts +4 -0
- package/lib/models/authorization.js +7 -0
- package/lib/models/authorization.js.map +1 -0
- package/lib/models/billing/billing-categories.d.ts +2 -0
- package/lib/models/billing/billing-categories.js +4 -1
- package/lib/models/billing/billing-categories.js.map +1 -1
- package/lib/models/billing/billing-line-item.d.ts +2 -0
- package/lib/models/billing/billing-line-item.js +12 -1
- package/lib/models/billing/billing-line-item.js.map +1 -1
- package/lib/models/currency.d.ts +2 -0
- package/lib/models/currency.js +7 -1
- package/lib/models/currency.js.map +1 -1
- package/lib/models/documents/document-type.d.ts +2 -0
- package/lib/models/documents/document-type.js +4 -1
- package/lib/models/documents/document-type.js.map +1 -1
- package/lib/models/documents/document.d.ts +2 -0
- package/lib/models/documents/document.js +10 -1
- package/lib/models/documents/document.js.map +1 -1
- package/lib/models/identifier.d.ts +2 -0
- package/lib/models/identifier.js +7 -1
- package/lib/models/identifier.js.map +1 -1
- package/lib/models/inbound-content-types.d.ts +7 -0
- package/lib/models/inbound-content-types.js +13 -0
- package/lib/models/inbound-content-types.js.map +1 -0
- package/lib/models/index.d.ts +2 -0
- package/lib/models/index.js +2 -0
- package/lib/models/index.js.map +1 -1
- package/lib/models/labels/document-formats.d.ts +2 -0
- package/lib/models/labels/document-formats.js +4 -1
- package/lib/models/labels/document-formats.js.map +1 -1
- package/lib/models/labels/form-download.d.ts +2 -0
- package/lib/models/labels/form-download.js +6 -1
- package/lib/models/labels/form-download.js.map +1 -1
- package/lib/models/labels/label-download.d.ts +2 -0
- package/lib/models/labels/label-download.js +6 -1
- package/lib/models/labels/label-download.js.map +1 -1
- package/lib/models/labels/label-package.d.ts +2 -0
- package/lib/models/labels/label-package.js +10 -1
- package/lib/models/labels/label-package.js.map +1 -1
- package/lib/models/labels/void-response.d.ts +5 -0
- package/lib/models/labels/void-response.js +10 -1
- package/lib/models/labels/void-response.js.map +1 -1
- package/lib/models/manifests/manifest.d.ts +2 -0
- package/lib/models/manifests/manifest.js +10 -1
- package/lib/models/manifests/manifest.js.map +1 -1
- package/lib/models/pickup/pickup-confirmation.d.ts +2 -0
- package/lib/models/pickup/pickup-confirmation.js +10 -1
- package/lib/models/pickup/pickup-confirmation.js.map +1 -1
- package/lib/models/pickup/pickup-window.d.ts +2 -0
- package/lib/models/pickup/pickup-window.js +9 -1
- package/lib/models/pickup/pickup-window.js.map +1 -1
- package/lib/models/pickup/shipment-identifier.d.ts +2 -0
- package/lib/models/pickup/shipment-identifier.js +8 -1
- package/lib/models/pickup/shipment-identifier.js.map +1 -1
- package/lib/models/rates/rate.d.ts +2 -0
- package/lib/models/rates/rate.js +18 -1
- package/lib/models/rates/rate.js.map +1 -1
- package/lib/models/registration/credentials.d.ts +2 -0
- package/lib/models/registration/credentials.js +7 -1
- package/lib/models/registration/credentials.js.map +1 -1
- package/lib/models/resource-download.d.ts +2 -0
- package/lib/models/resource-download.js +7 -1
- package/lib/models/resource-download.js.map +1 -1
- package/lib/models/time-window.d.ts +2 -0
- package/lib/models/time-window.js +8 -1
- package/lib/models/time-window.js.map +1 -1
- package/lib/models/tracking/index.d.ts +1 -0
- package/lib/models/tracking/index.js +1 -0
- package/lib/models/tracking/index.js.map +1 -1
- package/lib/models/tracking/lat-long.d.ts +2 -0
- package/lib/models/tracking/lat-long.js +7 -1
- package/lib/models/tracking/lat-long.js.map +1 -1
- package/lib/models/tracking/service.d.ts +2 -0
- package/lib/models/tracking/service.js +7 -1
- package/lib/models/tracking/service.js.map +1 -1
- package/lib/models/tracking/standardized-status-codes.d.ts +2 -0
- package/lib/models/tracking/standardized-status-codes.js +4 -1
- package/lib/models/tracking/standardized-status-codes.js.map +1 -1
- package/lib/models/tracking/track-event.d.ts +2 -0
- package/lib/models/tracking/track-event.js +18 -1
- package/lib/models/tracking/track-event.js.map +1 -1
- package/lib/models/tracking/tracking-info.d.ts +2 -0
- package/lib/models/tracking/tracking-info.js +27 -1
- package/lib/models/tracking/tracking-info.js.map +1 -1
- package/lib/models/tracking/update-method.d.ts +9 -0
- package/lib/models/tracking/update-method.js +15 -0
- package/lib/models/tracking/update-method.js.map +1 -0
- package/lib/models/units/dimensions.d.ts +2 -0
- package/lib/models/units/dimensions.js +8 -1
- package/lib/models/units/dimensions.js.map +1 -1
- package/lib/requests/base-request.d.ts +2 -0
- package/lib/requests/base-request.js.map +1 -1
- package/lib/requests/index.d.ts +2 -0
- package/lib/requests/index.js +2 -0
- package/lib/requests/index.js.map +1 -1
- package/lib/requests/normalize-tracking-data-request.d.ts +8 -0
- package/lib/requests/normalize-tracking-data-request.js +3 -0
- package/lib/requests/normalize-tracking-data-request.js.map +1 -0
- package/lib/requests/validate-inbound-data-request.d.ts +8 -0
- package/lib/requests/validate-inbound-data-request.js +3 -0
- package/lib/requests/validate-inbound-data-request.js.map +1 -0
- package/lib/responses/base-response.d.ts +2 -0
- package/lib/responses/base-response.js +6 -1
- package/lib/responses/base-response.js.map +1 -1
- package/lib/responses/cancel-notification-response.d.ts +2 -0
- package/lib/responses/cancel-notification-response.js +7 -1
- package/lib/responses/cancel-notification-response.js.map +1 -1
- package/lib/responses/cancel-pickup-response.d.ts +2 -0
- package/lib/responses/cancel-pickup-response.js +9 -1
- package/lib/responses/cancel-pickup-response.js.map +1 -1
- package/lib/responses/create-label-response.d.ts +2 -0
- package/lib/responses/create-label-response.js +19 -1
- package/lib/responses/create-label-response.js.map +1 -1
- package/lib/responses/create-manifest-response.d.ts +2 -0
- package/lib/responses/create-manifest-response.js +8 -1
- package/lib/responses/create-manifest-response.js.map +1 -1
- package/lib/responses/create-notification-response.d.ts +2 -0
- package/lib/responses/create-notification-response.js +6 -1
- package/lib/responses/create-notification-response.js.map +1 -1
- package/lib/responses/get-rates-response.d.ts +2 -0
- package/lib/responses/get-rates-response.js +7 -1
- package/lib/responses/get-rates-response.js.map +1 -1
- package/lib/responses/index.d.ts +2 -0
- package/lib/responses/index.js +2 -0
- package/lib/responses/index.js.map +1 -1
- package/lib/responses/normalize-tracking-data-response.d.ts +14 -0
- package/lib/responses/normalize-tracking-data-response.js +16 -0
- package/lib/responses/normalize-tracking-data-response.js.map +1 -0
- package/lib/responses/register-response.d.ts +2 -0
- package/lib/responses/register-response.js +8 -1
- package/lib/responses/register-response.js.map +1 -1
- package/lib/responses/schedule-pickup-response.d.ts +2 -0
- package/lib/responses/schedule-pickup-response.js +11 -1
- package/lib/responses/schedule-pickup-response.js.map +1 -1
- package/lib/responses/tracking-response.d.ts +1 -0
- package/lib/responses/tracking-response.js +5 -1
- package/lib/responses/tracking-response.js.map +1 -1
- package/lib/responses/validate-inbound-data-response.d.ts +9 -0
- package/lib/responses/validate-inbound-data-response.js +15 -0
- package/lib/responses/validate-inbound-data-response.js.map +1 -0
- package/lib/responses/void-labels-response.d.ts +2 -0
- package/lib/responses/void-labels-response.js +7 -1
- package/lib/responses/void-labels-response.js.map +1 -1
- package/package.json +2 -2
- package/spec.json +31 -1
- package/src/app/carrier-app-definition.ts +18 -0
- package/src/app/carrier-app.ts +107 -55
- package/src/app/constants.ts +14 -0
- package/src/app/internal/route.ts +1 -0
- package/src/models/authorization.ts +4 -0
- package/src/models/billing/billing-categories.ts +6 -0
- package/src/models/billing/billing-line-item.ts +14 -2
- package/src/models/currency.ts +7 -0
- package/src/models/documents/document-type.ts +6 -0
- package/src/models/documents/document.ts +11 -2
- package/src/models/identifier.ts +7 -0
- package/src/models/inbound-content-types.ts +10 -0
- package/src/models/index.ts +2 -0
- package/src/models/labels/document-formats.ts +5 -0
- package/src/models/labels/form-download.ts +6 -1
- package/src/models/labels/label-download.ts +6 -1
- package/src/models/labels/label-package.ts +9 -2
- package/src/models/labels/void-response.ts +11 -0
- package/src/models/manifests/manifest.ts +9 -1
- package/src/models/pickup/pickup-confirmation.ts +11 -2
- package/src/models/pickup/pickup-window.ts +8 -0
- package/src/models/pickup/shipment-identifier.ts +7 -1
- package/src/models/rates/rate.ts +20 -2
- package/src/models/registration/credentials.ts +7 -0
- package/src/models/resource-download.ts +7 -0
- package/src/models/time-window.ts +8 -0
- package/src/models/tracking/index.ts +1 -0
- package/src/models/tracking/lat-long.ts +7 -0
- package/src/models/tracking/service.ts +6 -0
- package/src/models/tracking/standardized-status-codes.ts +6 -0
- package/src/models/tracking/track-event.ts +16 -0
- package/src/models/tracking/tracking-info.ts +29 -4
- package/src/models/tracking/update-method.ts +13 -0
- package/src/models/units/dimensions.ts +7 -0
- package/src/requests/base-request.ts +3 -0
- package/src/requests/index.ts +2 -0
- package/src/requests/normalize-tracking-data-request.ts +9 -0
- package/src/requests/validate-inbound-data-request.ts +9 -0
- package/src/responses/base-response.ts +6 -0
- package/src/responses/cancel-notification-response.ts +7 -1
- package/src/responses/cancel-pickup-response.ts +9 -1
- package/src/responses/create-label-response.ts +25 -1
- package/src/responses/create-manifest-response.ts +8 -2
- package/src/responses/create-notification-response.ts +6 -1
- package/src/responses/get-rates-response.ts +7 -2
- package/src/responses/index.ts +2 -0
- package/src/responses/normalize-tracking-data-response.ts +24 -0
- package/src/responses/register-response.ts +6 -1
- package/src/responses/schedule-pickup-response.ts +18 -2
- package/src/responses/tracking-response.ts +6 -2
- package/src/responses/validate-inbound-data-response.ts +16 -0
- package/src/responses/void-labels-response.ts +7 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
|
|
1
3
|
/** @description Latitude and longitude */
|
|
2
4
|
export class LatLong {
|
|
3
5
|
/** @description latitude */
|
|
@@ -5,3 +7,8 @@ export class LatLong {
|
|
|
5
7
|
/** @description longitude */
|
|
6
8
|
long!: number;
|
|
7
9
|
}
|
|
10
|
+
|
|
11
|
+
export const LatLongSchema = Joi.object({
|
|
12
|
+
lat: Joi.number().required(),
|
|
13
|
+
long: Joi.number().required(),
|
|
14
|
+
});
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
|
|
1
3
|
/** @description Basic structure for a tracking service */
|
|
2
4
|
export class Service {
|
|
3
5
|
code?: string;
|
|
4
6
|
name?: string;
|
|
5
7
|
}
|
|
8
|
+
export const ServiceSchema = Joi.object({
|
|
9
|
+
code: Joi.string().optional().empty(),
|
|
10
|
+
name: Joi.string().optional().empty(),
|
|
11
|
+
});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
|
|
1
3
|
/** @description Status codes for tracking */
|
|
2
4
|
export enum StandardizedStatusCodes {
|
|
3
5
|
Unknown = 'UN',
|
|
@@ -8,3 +10,7 @@ export enum StandardizedStatusCodes {
|
|
|
8
10
|
DeliveryAttempt = 'AT',
|
|
9
11
|
NotYetInSystem = 'NY',
|
|
10
12
|
}
|
|
13
|
+
|
|
14
|
+
export const StandardizedStatusCodesSchema = Joi.string().valid(
|
|
15
|
+
...Object.values(StandardizedStatusCodes),
|
|
16
|
+
);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { LatLongSchema, StandardizedStatusCodesSchema } from '.';
|
|
1
3
|
import { LatLong } from './lat-long';
|
|
2
4
|
import { StandardizedStatusCodes } from './standardized-status-codes';
|
|
3
5
|
|
|
@@ -19,3 +21,17 @@ export class TrackEvent {
|
|
|
19
21
|
geo?: LatLong;
|
|
20
22
|
status_code?: StandardizedStatusCodes;
|
|
21
23
|
}
|
|
24
|
+
export const TrackEventSchema = Joi.object({
|
|
25
|
+
event_datetime: Joi.string().optional().empty().isoDate(),
|
|
26
|
+
event_datetime_local: Joi.string().optional().empty().isoDate(),
|
|
27
|
+
event_code: Joi.string().optional().empty(),
|
|
28
|
+
description: Joi.string().optional().empty(),
|
|
29
|
+
city: Joi.string().optional().empty(),
|
|
30
|
+
state: Joi.string().optional().empty(),
|
|
31
|
+
postal_code: Joi.string().optional().empty(),
|
|
32
|
+
country: Joi.string().optional().empty(),
|
|
33
|
+
company: Joi.string().optional().empty(),
|
|
34
|
+
signer: Joi.string().optional().empty(),
|
|
35
|
+
geo: LatLongSchema.optional(),
|
|
36
|
+
status_code: StandardizedStatusCodesSchema.optional(),
|
|
37
|
+
});
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
StandardizedStatusCodes,
|
|
3
|
+
StandardizedStatusCodesSchema,
|
|
4
|
+
} from './standardized-status-codes';
|
|
5
|
+
import { Dimensions, DimensionsSchema } from '../units/dimensions';
|
|
6
|
+
import { Service, ServiceSchema } from './service';
|
|
7
|
+
import { TrackEvent, TrackEventSchema } from './track-event';
|
|
8
|
+
import Joi from 'joi';
|
|
5
9
|
|
|
6
10
|
/** @description Basic structure for tracking information */
|
|
7
11
|
export class TrackingInfo {
|
|
@@ -24,3 +28,24 @@ export class TrackingInfo {
|
|
|
24
28
|
shipping_problem_code?: string;
|
|
25
29
|
error_description?: string;
|
|
26
30
|
}
|
|
31
|
+
|
|
32
|
+
export const TrackingInfoSchema = Joi.object({
|
|
33
|
+
carrier_name: Joi.string().optional().empty(),
|
|
34
|
+
tracking_number: Joi.string().optional().empty(),
|
|
35
|
+
standardized_status_code: StandardizedStatusCodesSchema.required(),
|
|
36
|
+
carrier_status_code: Joi.string().optional().empty(),
|
|
37
|
+
carrier_status_description: Joi.string().optional().empty(),
|
|
38
|
+
shipped_datetime: Joi.string().optional().empty().isoDate(),
|
|
39
|
+
estimated_delivery_datetime: Joi.string().optional().empty(),
|
|
40
|
+
actual_delivery_datetime: Joi.string().optional().empty().isoDate(),
|
|
41
|
+
shipping_problem_description: Joi.string().optional().empty(),
|
|
42
|
+
weight: Joi.number().optional().empty(),
|
|
43
|
+
dimensions: DimensionsSchema.optional(),
|
|
44
|
+
service: ServiceSchema.optional(),
|
|
45
|
+
packaging: Joi.string().optional().empty(),
|
|
46
|
+
package_count: Joi.number().optional().empty(),
|
|
47
|
+
events: Joi.array().optional().items(TrackEventSchema),
|
|
48
|
+
shipping_problem: Joi.boolean().optional().empty(),
|
|
49
|
+
shipping_problem_code: Joi.string().optional().empty(),
|
|
50
|
+
error_description: Joi.string().optional().empty(),
|
|
51
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
|
|
3
|
+
/** @description Update method to use for the tracking information */
|
|
4
|
+
export enum UpdateMethods {
|
|
5
|
+
/** @description Append the new data to the existing data set */
|
|
6
|
+
Append = 'append',
|
|
7
|
+
/** @description Replace the existing data set with the new data */
|
|
8
|
+
Replace = 'replace',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const UpdateMethodsSchema = Joi.string().valid(
|
|
12
|
+
...Object.values(UpdateMethods),
|
|
13
|
+
);
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
|
|
1
3
|
/** @description Basic structure for dimensions */
|
|
2
4
|
export class Dimensions {
|
|
3
5
|
length?: number;
|
|
4
6
|
width?: number;
|
|
5
7
|
height?: number;
|
|
6
8
|
}
|
|
9
|
+
export const DimensionsSchema = Joi.object({
|
|
10
|
+
length: Joi.number().optional(),
|
|
11
|
+
width: Joi.number().optional(),
|
|
12
|
+
height: Joi.number().optional(),
|
|
13
|
+
});
|
package/src/requests/index.ts
CHANGED
|
@@ -8,3 +8,5 @@ export * from './tracking-request';
|
|
|
8
8
|
export * from './void-labels-request';
|
|
9
9
|
export * from './create-notification-request';
|
|
10
10
|
export * from './cancel-notification-request';
|
|
11
|
+
export * from './validate-inbound-data-request';
|
|
12
|
+
export * from './normalize-tracking-data-request';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseRequest } from './base-request';
|
|
2
|
+
|
|
3
|
+
/** @description Basic structure for a request to normalize tracking data from inbound tracking data requests (e.g. webhooks) */
|
|
4
|
+
export interface NormalizeTrackingDataRequest extends BaseRequest {
|
|
5
|
+
/** @description The request's data, e.g. the body of the webhook http request */
|
|
6
|
+
data: string;
|
|
7
|
+
/** @description Headers sent with the inbound request if it was received via http */
|
|
8
|
+
headers: Record<string, string[]>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseRequest } from './base-request';
|
|
2
|
+
|
|
3
|
+
/** @description Basic structure for a request to validate inbound data */
|
|
4
|
+
export interface ValidateInboundDataRequest extends BaseRequest {
|
|
5
|
+
/** @description The request's data, e.g. the body of the webhook http request */
|
|
6
|
+
data: string;
|
|
7
|
+
/** @description Headers sent with the inbound request if it was received via http */
|
|
8
|
+
headers: Record<string, string[]>;
|
|
9
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { BaseResponse, BaseResponseSchema } from './base-response';
|
|
2
3
|
|
|
3
4
|
export class CancelNotificationResponse extends BaseResponse {
|
|
4
5
|
/** @description User facing text describing the cancellation process. May be left blank to present a default value */
|
|
@@ -6,3 +7,8 @@ export class CancelNotificationResponse extends BaseResponse {
|
|
|
6
7
|
/** @description A list of errors preventing this notification from being cancelled. If no errors are returned the void is considered successful. If any errors are returned the void is considered failed. */
|
|
7
8
|
errors?: string[];
|
|
8
9
|
}
|
|
10
|
+
|
|
11
|
+
export const CancelNotificationResponseSchema = BaseResponseSchema.keys({
|
|
12
|
+
message: Joi.string().optional().empty(),
|
|
13
|
+
errors: Joi.array().optional().items(Joi.string()),
|
|
14
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { BaseResponse, BaseResponseSchema } from './base-response';
|
|
2
3
|
|
|
3
4
|
/** @description Basic structure for a response to cancel pickup */
|
|
4
5
|
export class CancelPickupResponse extends BaseResponse {
|
|
@@ -7,3 +8,10 @@ export class CancelPickupResponse extends BaseResponse {
|
|
|
7
8
|
status?: string;
|
|
8
9
|
custom_properties?: { [key: string]: string };
|
|
9
10
|
}
|
|
11
|
+
|
|
12
|
+
export const CancelPickupResponseSchema = BaseResponseSchema.keys({
|
|
13
|
+
confirmationa_id: Joi.string().optional(),
|
|
14
|
+
successful: Joi.boolean().required(),
|
|
15
|
+
status: Joi.string().optional().empty(),
|
|
16
|
+
custom_properties: Joi.object().pattern(/.*/, [Joi.string()]).optional(),
|
|
17
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseResponse } from './base-response';
|
|
1
|
+
import { BaseResponse, BaseResponseSchema } from './base-response';
|
|
2
2
|
import {
|
|
3
3
|
LabelDownload,
|
|
4
4
|
FormDownload,
|
|
@@ -7,7 +7,15 @@ import {
|
|
|
7
7
|
LabelPackage,
|
|
8
8
|
Identifier,
|
|
9
9
|
TimeWindow,
|
|
10
|
+
LabelDownloadSchema,
|
|
11
|
+
FormDownloadSchema,
|
|
12
|
+
DocumentSchema,
|
|
13
|
+
LabelPackageSchema,
|
|
14
|
+
BillingLineItemSchema,
|
|
15
|
+
IdentifierSchema,
|
|
16
|
+
TimeWindowSchema,
|
|
10
17
|
} from '../models';
|
|
18
|
+
import Joi from 'joi';
|
|
11
19
|
|
|
12
20
|
/** @description Basic structure for a response to create a label */
|
|
13
21
|
export class CreateLabelResponse extends BaseResponse {
|
|
@@ -27,3 +35,19 @@ export class CreateLabelResponse extends BaseResponse {
|
|
|
27
35
|
/** @description The delivery window is the time designated when the carrier will drop off the package to the recipient */
|
|
28
36
|
delivery_window?: TimeWindow;
|
|
29
37
|
}
|
|
38
|
+
|
|
39
|
+
export const CreateLabelResponseSchema = BaseResponseSchema.keys({
|
|
40
|
+
transaction_id: Joi.string().required(),
|
|
41
|
+
label_download: LabelDownloadSchema.optional(),
|
|
42
|
+
form_download: FormDownloadSchema.optional(),
|
|
43
|
+
documents: Joi.array().optional().items(DocumentSchema),
|
|
44
|
+
packages: Joi.array().optional().items(LabelPackageSchema),
|
|
45
|
+
billing_line_items: Joi.array().optional().items(BillingLineItemSchema),
|
|
46
|
+
tracking_number: Joi.string().optional().empty(),
|
|
47
|
+
trackable: Joi.boolean().optional(),
|
|
48
|
+
alternative_identifiers: Joi.array().optional().items(IdentifierSchema),
|
|
49
|
+
estimated_delivery_datetime: Joi.string().optional().empty().isoDate(),
|
|
50
|
+
consolidator_service_code: Joi.string().optional().empty(),
|
|
51
|
+
carrier_pickup_window: TimeWindowSchema.optional(),
|
|
52
|
+
delivery_window: TimeWindowSchema.optional(),
|
|
53
|
+
});
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { BaseResponse } from './base-response';
|
|
2
|
-
import { Manifest } from '../models';
|
|
1
|
+
import { BaseResponse, BaseResponseSchema } from './base-response';
|
|
2
|
+
import { Manifest, ManifestSchema } from '../models';
|
|
3
|
+
import Joi from 'joi';
|
|
3
4
|
|
|
4
5
|
/** @description Basic structure for a response to create a manifest */
|
|
5
6
|
export class CreateManifestResponse extends BaseResponse {
|
|
6
7
|
transaction_id!: string;
|
|
7
8
|
manifests?: Manifest[];
|
|
8
9
|
}
|
|
10
|
+
|
|
11
|
+
export const CreateManifestResponseSchema = BaseResponseSchema.keys({
|
|
12
|
+
transaction_id: Joi.string().required(),
|
|
13
|
+
manifests: Joi.array().optional().items(ManifestSchema),
|
|
14
|
+
});
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { BaseResponse, BaseResponseSchema } from './base-response';
|
|
2
3
|
|
|
3
4
|
export class CreateNotificationResponse extends BaseResponse {
|
|
4
5
|
/** @description The id of the sucessfully created notification*/
|
|
5
6
|
notification_id!: string;
|
|
6
7
|
}
|
|
8
|
+
|
|
9
|
+
export const CreateNotificationResponseSchema = BaseResponseSchema.keys({
|
|
10
|
+
notification_id: Joi.string().required(),
|
|
11
|
+
});
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { BaseResponse } from './base-response';
|
|
2
|
-
import { Rate } from '../models';
|
|
1
|
+
import { BaseResponse, BaseResponseSchema } from './base-response';
|
|
2
|
+
import { Rate, RateSchema } from '../models';
|
|
3
|
+
import Joi from 'joi';
|
|
3
4
|
|
|
4
5
|
/** @description Basic structure for a response to get rates */
|
|
5
6
|
export class GetRatesResponse extends BaseResponse {
|
|
6
7
|
rates!: Rate[];
|
|
7
8
|
}
|
|
9
|
+
|
|
10
|
+
export const GetRatesResponseSchema = BaseResponseSchema.keys({
|
|
11
|
+
rates: Joi.array().required().items(RateSchema),
|
|
12
|
+
});
|
package/src/responses/index.ts
CHANGED
|
@@ -9,3 +9,5 @@ export * from './void-labels-response';
|
|
|
9
9
|
export * from './error-response';
|
|
10
10
|
export * from './cancel-notification-response';
|
|
11
11
|
export * from './create-notification-response';
|
|
12
|
+
export * from './validate-inbound-data-response';
|
|
13
|
+
export * from './normalize-tracking-data-response';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseResponse, BaseResponseSchema } from './base-response';
|
|
2
|
+
import {
|
|
3
|
+
UpdateMethods,
|
|
4
|
+
TrackingInfo,
|
|
5
|
+
TrackingInfoSchema,
|
|
6
|
+
UpdateMethodsSchema,
|
|
7
|
+
} from '../models';
|
|
8
|
+
import Joi from 'joi';
|
|
9
|
+
|
|
10
|
+
/** @description Basic structure for a response to normalize inbound tracking data */
|
|
11
|
+
export class NormalizeTrackingDataResponse extends BaseResponse {
|
|
12
|
+
/** @description Collection of normalized tracking updates with one entry per package */
|
|
13
|
+
tracking_info!: TrackingInfo[];
|
|
14
|
+
/**
|
|
15
|
+
* @description Method for updating the tracking information state, i.e. is the returned information
|
|
16
|
+
* the complete state of the package or should it be appended to the existing state
|
|
17
|
+
*/
|
|
18
|
+
update_method!: UpdateMethods;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const NormalizeTrackingDataResponseSchema = BaseResponseSchema.keys({
|
|
22
|
+
tracking_info: Joi.array().required().items(TrackingInfoSchema),
|
|
23
|
+
update_method: UpdateMethodsSchema,
|
|
24
|
+
});
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { Credentials, CredentialsSchema } from '../models';
|
|
2
3
|
|
|
3
4
|
/** @description Basic structure for a response to register/connect */
|
|
4
5
|
export class RegisterResponse {
|
|
5
6
|
credentials!: Credentials;
|
|
6
7
|
metadata!: object;
|
|
7
8
|
}
|
|
9
|
+
export const RegisterResponseSchema = Joi.object({
|
|
10
|
+
credentials: CredentialsSchema.required(),
|
|
11
|
+
metadata: Joi.object().pattern(/.*/, [Joi.any()]).required(),
|
|
12
|
+
});
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import { BaseResponse } from './base-response';
|
|
2
|
-
import {
|
|
1
|
+
import { BaseResponse, BaseResponseSchema } from './base-response';
|
|
2
|
+
import {
|
|
3
|
+
PickupConfirmation,
|
|
4
|
+
PickupWindow,
|
|
5
|
+
BillingLineItem,
|
|
6
|
+
PickupConfirmationSchema,
|
|
7
|
+
PickupWindowSchema,
|
|
8
|
+
BillingLineItemSchema,
|
|
9
|
+
} from '../models';
|
|
10
|
+
import Joi from 'joi';
|
|
3
11
|
|
|
4
12
|
/** @description Basic structure for a response to schedule a pickup */
|
|
5
13
|
export class SchedulePickupResponse extends BaseResponse {
|
|
@@ -9,3 +17,11 @@ export class SchedulePickupResponse extends BaseResponse {
|
|
|
9
17
|
custom_properties?: { [key: string]: string };
|
|
10
18
|
billing_line_items?: BillingLineItem[];
|
|
11
19
|
}
|
|
20
|
+
|
|
21
|
+
export const SchedulePickupResponseSchema = BaseResponseSchema.keys({
|
|
22
|
+
confirmation: PickupConfirmationSchema.optional(),
|
|
23
|
+
pickup_windows: Joi.array().optional().items(PickupWindowSchema),
|
|
24
|
+
remarks: Joi.string().optional().empty(),
|
|
25
|
+
custom_properties: Joi.object().pattern(/.*/, [Joi.string()]).optional(),
|
|
26
|
+
billing_line_items: Joi.array().optional().items(BillingLineItemSchema),
|
|
27
|
+
});
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { BaseResponse } from './base-response';
|
|
2
|
-
import { TrackingInfo } from '../models';
|
|
1
|
+
import { BaseResponse, BaseResponseSchema } from './base-response';
|
|
2
|
+
import { TrackingInfo, TrackingInfoSchema } from '../models';
|
|
3
3
|
|
|
4
4
|
/** @description Basic structure for a response to get tracking information */
|
|
5
5
|
export class TrackingResponse extends BaseResponse {
|
|
6
6
|
tracking_info!: TrackingInfo;
|
|
7
7
|
}
|
|
8
|
+
|
|
9
|
+
export const TrackingResponseSchema = BaseResponseSchema.keys({
|
|
10
|
+
tracking_info: TrackingInfoSchema.required(),
|
|
11
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseResponse, BaseResponseSchema } from './base-response';
|
|
2
|
+
import {
|
|
3
|
+
InboundDataContentTypes,
|
|
4
|
+
InboundDataContentTypesSchema,
|
|
5
|
+
} from '../models';
|
|
6
|
+
import Joi from 'joi';
|
|
7
|
+
|
|
8
|
+
/** @description Basic structure for a response to validate inbound data */
|
|
9
|
+
export class ValidateInboundDataResponse extends BaseResponse {
|
|
10
|
+
/** @description List of content types included in the data */
|
|
11
|
+
content_types!: InboundDataContentTypes[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const ValidateInboundDataResponseSchema = BaseResponseSchema.keys({
|
|
15
|
+
content_types: Joi.array().required().items(InboundDataContentTypesSchema),
|
|
16
|
+
});
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { BaseResponse } from './base-response';
|
|
2
|
-
import { VoidResponse } from '../models';
|
|
1
|
+
import { BaseResponse, BaseResponseSchema } from './base-response';
|
|
2
|
+
import { VoidResponse, VoidResponseSchema } from '../models';
|
|
3
|
+
import Joi from 'joi';
|
|
3
4
|
|
|
4
5
|
/** @description Basic structure for a response to void labels */
|
|
5
6
|
export class VoidLabelsResponse extends BaseResponse {
|
|
6
7
|
/** @description List of void responses*/
|
|
7
8
|
void_responses!: VoidResponse[];
|
|
8
9
|
}
|
|
10
|
+
|
|
11
|
+
export const VoidLabelsResponseSchema = BaseResponseSchema.keys({
|
|
12
|
+
void_responses: Joi.array().required().items(VoidResponseSchema),
|
|
13
|
+
});
|