@shipengine/connect-carrier-api 4.17.0-beta → 4.18.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 (92) hide show
  1. package/lib/app/carrier-app-definition.d.ts +14 -2
  2. package/lib/app/constants.d.ts +3 -1
  3. package/lib/app/constants.js +2 -0
  4. package/lib/app/constants.js.map +1 -1
  5. package/lib/app/create-endpoint-mapping.js +2 -0
  6. package/lib/app/create-endpoint-mapping.js.map +1 -1
  7. package/lib/app/metadata/shipping-option.d.ts +2 -1
  8. package/lib/app/metadata/shipping-option.js +1 -0
  9. package/lib/app/metadata/shipping-option.js.map +1 -1
  10. package/lib/models/advanced-options.d.ts +2 -0
  11. package/lib/models/advanced-options.js +2 -0
  12. package/lib/models/advanced-options.js.map +1 -1
  13. package/lib/models/index.d.ts +1 -0
  14. package/lib/models/index.js +1 -0
  15. package/lib/models/index.js.map +1 -1
  16. package/lib/models/seller-documents/index.d.ts +2 -0
  17. package/lib/models/seller-documents/index.js +6 -0
  18. package/lib/models/seller-documents/index.js.map +1 -0
  19. package/lib/models/seller-documents/seller-document.d.ts +9 -0
  20. package/lib/models/seller-documents/seller-document.js +14 -0
  21. package/lib/models/seller-documents/seller-document.js.map +1 -0
  22. package/lib/models/seller-documents/seller-documents-schema.d.ts +5 -0
  23. package/lib/models/seller-documents/seller-documents-schema.js +17 -0
  24. package/lib/models/seller-documents/seller-documents-schema.js.map +1 -0
  25. package/lib/models/tracking/index.d.ts +2 -0
  26. package/lib/models/tracking/index.js +2 -0
  27. package/lib/models/tracking/index.js.map +1 -1
  28. package/lib/models/tracking/start-tracking-status-schema.d.ts +2 -0
  29. package/lib/models/tracking/start-tracking-status-schema.js +10 -0
  30. package/lib/models/tracking/start-tracking-status-schema.js.map +1 -0
  31. package/lib/models/tracking/start-tracking-status.d.ts +7 -0
  32. package/lib/models/tracking/start-tracking-status.js +12 -0
  33. package/lib/models/tracking/start-tracking-status.js.map +1 -0
  34. package/lib/requests/index.d.ts +3 -0
  35. package/lib/requests/index.js +3 -0
  36. package/lib/requests/index.js.map +1 -1
  37. package/lib/requests/start-tracking-request-schema.d.ts +2 -0
  38. package/lib/requests/start-tracking-request-schema.js +11 -0
  39. package/lib/requests/start-tracking-request-schema.js.map +1 -0
  40. package/lib/requests/start-tracking-request.d.ts +8 -0
  41. package/lib/requests/start-tracking-request.js +12 -0
  42. package/lib/requests/start-tracking-request.js.map +1 -0
  43. package/lib/requests/upload-documents-request.d.ts +29 -0
  44. package/lib/requests/upload-documents-request.js +33 -0
  45. package/lib/requests/upload-documents-request.js.map +1 -0
  46. package/lib/responses/index.d.ts +6 -0
  47. package/lib/responses/index.js +6 -0
  48. package/lib/responses/index.js.map +1 -1
  49. package/lib/responses/seller-document-result.d.ts +9 -0
  50. package/lib/responses/seller-document-result.js +14 -0
  51. package/lib/responses/seller-document-result.js.map +1 -0
  52. package/lib/responses/start-tracking-response-schema.d.ts +3 -0
  53. package/lib/responses/start-tracking-response-schema.js +17 -0
  54. package/lib/responses/start-tracking-response-schema.js.map +1 -0
  55. package/lib/responses/start-tracking-response.d.ts +14 -0
  56. package/lib/responses/start-tracking-response.js +12 -0
  57. package/lib/responses/start-tracking-response.js.map +1 -0
  58. package/lib/responses/upload-document-result-schema.d.ts +2 -0
  59. package/lib/responses/upload-document-result-schema.js +12 -0
  60. package/lib/responses/upload-document-result-schema.js.map +1 -0
  61. package/lib/responses/upload-documents-response-schema.d.ts +2 -0
  62. package/lib/responses/upload-documents-response-schema.js +11 -0
  63. package/lib/responses/upload-documents-response-schema.js.map +1 -0
  64. package/lib/responses/upload-documents-response.d.ts +8 -0
  65. package/lib/responses/upload-documents-response.js +12 -0
  66. package/lib/responses/upload-documents-response.js.map +1 -0
  67. package/package.json +1 -1
  68. package/spec.json +277 -2
  69. package/src/app/carrier-app-definition.ts +18 -0
  70. package/src/app/constants.ts +2 -0
  71. package/src/app/create-endpoint-mapping.ts +2 -0
  72. package/src/app/metadata/shipping-option.ts +1 -0
  73. package/src/models/advanced-options.ts +2 -0
  74. package/src/models/index.ts +1 -0
  75. package/src/models/seller-documents/index.ts +2 -0
  76. package/src/models/seller-documents/seller-document.ts +12 -0
  77. package/src/models/seller-documents/seller-documents-schema.ts +13 -0
  78. package/src/models/tracking/index.ts +2 -0
  79. package/src/models/tracking/start-tracking-status-schema.ts +6 -0
  80. package/src/models/tracking/start-tracking-status.ts +7 -0
  81. package/src/requests/index.ts +3 -0
  82. package/src/requests/start-tracking-request-schema.ts +7 -0
  83. package/src/requests/start-tracking-request.ts +9 -0
  84. package/src/requests/upload-documents-request.ts +38 -0
  85. package/src/responses/index.ts +6 -0
  86. package/src/responses/seller-document-result.ts +9 -0
  87. package/src/responses/start-tracking-response-schema.ts +14 -0
  88. package/src/responses/start-tracking-response.ts +16 -0
  89. package/src/responses/upload-document-result-schema.ts +8 -0
  90. package/src/responses/upload-documents-response-schema.ts +7 -0
  91. package/src/responses/upload-documents-response.ts +9 -0
  92. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,2 @@
1
+ import Joi from 'joi';
2
+ export declare const UploadDocumentsResponseSchema: Joi.ObjectSchema<any>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UploadDocumentsResponseSchema = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const joi_1 = tslib_1.__importDefault(require("joi"));
6
+ const upload_document_result_schema_1 = require("./upload-document-result-schema");
7
+ exports.UploadDocumentsResponseSchema = joi_1.default.object({
8
+ metadata: joi_1.default.object().pattern(/.*/, [joi_1.default.any()]).required(),
9
+ documents: joi_1.default.array().required().min(1).items(upload_document_result_schema_1.UploadDocumentResultSchema),
10
+ });
11
+ //# sourceMappingURL=upload-documents-response-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-documents-response-schema.js","sourceRoot":"","sources":["../../src/responses/upload-documents-response-schema.ts"],"names":[],"mappings":";;;;AAAA,sDAAsB;AACtB,mFAA6E;AAEhE,QAAA,6BAA6B,GAAG,aAAG,CAAC,MAAM,CAAC;IACtD,QAAQ,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,aAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC5D,SAAS,EAAE,aAAG,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,0DAA0B,CAAC;CAC3E,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { BaseResponse } from './base-response';
2
+ import { SellerDocumentResult } from './seller-document-result';
3
+ /**
4
+ * Response for uploading documents to a carrier.
5
+ */
6
+ export declare class UploadDocumentsResponse extends BaseResponse {
7
+ documents?: SellerDocumentResult[];
8
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UploadDocumentsResponse = void 0;
4
+ const base_response_1 = require("./base-response");
5
+ /**
6
+ * Response for uploading documents to a carrier.
7
+ */
8
+ class UploadDocumentsResponse extends base_response_1.BaseResponse {
9
+ documents;
10
+ }
11
+ exports.UploadDocumentsResponse = UploadDocumentsResponse;
12
+ //# sourceMappingURL=upload-documents-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-documents-response.js","sourceRoot":"","sources":["../../src/responses/upload-documents-response.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAG/C;;GAEG;AACH,MAAa,uBAAwB,SAAQ,4BAAY;IACvD,SAAS,CAA0B;CACpC;AAFD,0DAEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/connect-carrier-api",
3
- "version": "4.17.0-beta",
3
+ "version": "4.18.0",
4
4
  "description": "This is the typescript/javascript definitions for carrier api",
5
5
  "homepage": "https://connect.shipengine.com",
6
6
  "main": "./lib/index.js",
package/spec.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "info": {
4
4
  "title": "Shipping API",
5
5
  "description": "This API specification describes the canonical ShipEngine Shipping API connector module.",
6
- "version": "1.29.0"
6
+ "version": "1.30.0"
7
7
  },
8
8
  "paths": {
9
9
  "/Register": {
@@ -947,6 +947,53 @@
947
947
  }
948
948
  }
949
949
  },
950
+ "/StartTracking": {
951
+ "post": {
952
+ "tags": [
953
+ "Tracking"
954
+ ],
955
+ "description": "This method subscribes to tracking events for one or more identifiers. This endpoint initiate the subscription with the carrier's system.",
956
+ "operationId": "StartTracking",
957
+ "requestBody": {
958
+ "description": "An object containing identifiers to subscribe to tracking events for.",
959
+ "content": {
960
+ "application/json": {
961
+ "schema": {
962
+ "$ref": "#/components/schemas/StartTrackingRequest"
963
+ },
964
+ "example": {
965
+ "identifiers": [
966
+ {
967
+ "type": "tracking_number",
968
+ "value": "PL1234567890"
969
+ },
970
+ {
971
+ "type": "tracking_number",
972
+ "value": "PL0987654321"
973
+ }
974
+ ],
975
+ "transaction_id": "771323cb-75eb-4e2a-bc11-fda608c6ade8",
976
+ "authorization": {},
977
+ "metadata": {},
978
+ "connection_name": "a_connect_connection_name_string"
979
+ }
980
+ }
981
+ }
982
+ },
983
+ "responses": {
984
+ "200": {
985
+ "description": "Successful subscription response with results for each identifier.",
986
+ "content": {
987
+ "application/json": {
988
+ "schema": {
989
+ "$ref": "#/components/schemas/StartTrackingResponse"
990
+ }
991
+ }
992
+ }
993
+ }
994
+ }
995
+ }
996
+ },
950
997
  "/UpdateSettings": {
951
998
  "post": {
952
999
  "tags": [
@@ -1209,6 +1256,10 @@
1209
1256
  },
1210
1257
  "transport_mean": {
1211
1258
  "$ref": "#/components/schemas/TransportMeanEnum"
1259
+ },
1260
+ "enable_document_upload": {
1261
+ "type": "boolean",
1262
+ "description": "Indicates whether document upload is enabled for the shipment."
1212
1263
  }
1213
1264
  },
1214
1265
  "additionalProperties": {},
@@ -3829,7 +3880,7 @@
3829
3880
  "items": {
3830
3881
  "$ref": "#/components/schemas/DisplayScheme"
3831
3882
  },
3832
- "description": "Label display scheme.",
3883
+ "description": "Display schemes for shipments.",
3833
3884
  "nullable": true
3834
3885
  }
3835
3886
  },
@@ -4411,6 +4462,62 @@
4411
4462
  ],
4412
4463
  "type": "string"
4413
4464
  },
4465
+ "SellerDocument": {
4466
+ "type": "object",
4467
+ "properties": {
4468
+ "document_upload_id": {
4469
+ "type": "string",
4470
+ "nullable": true
4471
+ },
4472
+ "type": {
4473
+ "type": "string",
4474
+ "description": "Standardized document format.",
4475
+ "nullable": true
4476
+ },
4477
+ "name": {
4478
+ "type": "string",
4479
+ "description": "The document name.",
4480
+ "nullable": true
4481
+ },
4482
+ "content": {
4483
+ "type": "string",
4484
+ "description": "Document content in base64 format.",
4485
+ "nullable": true
4486
+ }
4487
+ },
4488
+ "additionalProperties": false,
4489
+ "description": "Represents a document in the upload request."
4490
+ },
4491
+ "SellerDocumentResult": {
4492
+ "type": "object",
4493
+ "properties": {
4494
+ "document_upload_id": {
4495
+ "type": "string",
4496
+ "nullable": true
4497
+ },
4498
+ "carrier_document_id": {
4499
+ "type": "string",
4500
+ "description": "The document ID in the carrier's system.",
4501
+ "nullable": true
4502
+ },
4503
+ "uploaded_to_carrier_at": {
4504
+ "type": "string",
4505
+ "description": "The UTC timestamp of when the document was successfully uploaded to the carrier.",
4506
+ "format": "date-time",
4507
+ "nullable": true
4508
+ },
4509
+ "errors": {
4510
+ "type": "array",
4511
+ "items": {
4512
+ "type": "string"
4513
+ },
4514
+ "description": "The errors that occurred while uploading a document.",
4515
+ "nullable": true
4516
+ }
4517
+ },
4518
+ "additionalProperties": false,
4519
+ "description": "Represents the result of uploading a document to the carrier."
4520
+ },
4414
4521
  "Service": {
4415
4522
  "type": "object",
4416
4523
  "properties": {
@@ -5383,6 +5490,83 @@
5383
5490
  "additionalProperties": false,
5384
5491
  "description": "This model represents the successful response from a tracking request."
5385
5492
  },
5493
+ "StartTrackingRequest": {
5494
+ "required": [
5495
+ "identifiers",
5496
+ "transaction_id"
5497
+ ],
5498
+ "type": "object",
5499
+ "allOf": [
5500
+ {
5501
+ "$ref": "#/components/schemas/BaseRequest"
5502
+ }
5503
+ ],
5504
+ "properties": {
5505
+ "identifiers": {
5506
+ "type": "array",
5507
+ "items": {
5508
+ "$ref": "#/components/schemas/TrackingIdentifier"
5509
+ },
5510
+ "description": "Array of identifiers (e.g., tracking numbers) to subscribe to tracking events for.",
5511
+ "nullable": false
5512
+ }
5513
+ },
5514
+ "additionalProperties": false,
5515
+ "description": "This model represents the request payload for subscribing to tracking events for one or more identifiers."
5516
+ },
5517
+ "StartTrackingResponse": {
5518
+ "required": [
5519
+ "subscription_results"
5520
+ ],
5521
+ "type": "object",
5522
+ "allOf": [
5523
+ {
5524
+ "$ref": "#/components/schemas/BaseResponse"
5525
+ }
5526
+ ],
5527
+ "properties": {
5528
+ "subscription_results": {
5529
+ "type": "array",
5530
+ "items": {
5531
+ "$ref": "#/components/schemas/SubscriptionResult"
5532
+ },
5533
+ "description": "Array of subscription results, one for each identifier in the request.",
5534
+ "nullable": false
5535
+ }
5536
+ },
5537
+ "additionalProperties": false,
5538
+ "description": "This model represents the response from a start tracking subscription request."
5539
+ },
5540
+ "SubscriptionResult": {
5541
+ "required": [
5542
+ "identifier",
5543
+ "status"
5544
+ ],
5545
+ "type": "object",
5546
+ "properties": {
5547
+ "identifier": {
5548
+ "$ref": "#/components/schemas/TrackingIdentifier"
5549
+ },
5550
+ "status": {
5551
+ "$ref": "#/components/schemas/SubscriptionStatus"
5552
+ },
5553
+ "message": {
5554
+ "type": "string",
5555
+ "description": "Optional message providing additional details about the subscription result.",
5556
+ "nullable": true
5557
+ }
5558
+ },
5559
+ "additionalProperties": false,
5560
+ "description": "This model represents the result of a tracking subscription attempt for a single identifier."
5561
+ },
5562
+ "SubscriptionStatus": {
5563
+ "enum": [
5564
+ "success",
5565
+ "failed"
5566
+ ],
5567
+ "type": "string",
5568
+ "description": "Status of the tracking subscription attempt.\nsuccess - Subscription was successful\nfailed - Subscription failed"
5569
+ },
5386
5570
  "TransportMeanEnum": {
5387
5571
  "enum": [
5388
5572
  "ground",
@@ -5479,6 +5663,97 @@
5479
5663
  "additionalProperties": false,
5480
5664
  "description": "This model represents the successful response for updating carrier settings request."
5481
5665
  },
5666
+ "UploadDocumentsRequest": {
5667
+ "required": [
5668
+ "documents",
5669
+ "ship_from",
5670
+ "transaction_id"
5671
+ ],
5672
+ "type": "object",
5673
+ "allOf": [
5674
+ {
5675
+ "$ref": "#/components/schemas/BaseRequest"
5676
+ }
5677
+ ],
5678
+ "properties": {
5679
+ "documents": {
5680
+ "type": "array",
5681
+ "items": {
5682
+ "$ref": "#/components/schemas/SellerDocument"
5683
+ },
5684
+ "description": "An array of objects, one for each successfully processed document.",
5685
+ "nullable": true
5686
+ },
5687
+ "ship_from": {
5688
+ "$ref": "#/components/schemas/ShipFrom"
5689
+ },
5690
+ "tracking_number": {
5691
+ "type": "string",
5692
+ "description": "The carrier tracking number for this shipment",
5693
+ "nullable": true
5694
+ },
5695
+ "ship_to": {
5696
+ "$ref": "#/components/schemas/ShipTo"
5697
+ },
5698
+ "alternative_identifiers": {
5699
+ "type": "array",
5700
+ "items": {
5701
+ "$ref": "#/components/schemas/Identifier"
5702
+ },
5703
+ "description": "Alternative identifiers associated with this package",
5704
+ "nullable": true
5705
+ },
5706
+ "service_code": {
5707
+ "type": "string",
5708
+ "description": "The service code used for this shipment",
5709
+ "nullable": true
5710
+ },
5711
+ "packages": {
5712
+ "type": "array",
5713
+ "items": {
5714
+ "$ref": "#/components/schemas/ShippedPackage"
5715
+ },
5716
+ "description": "The list of packages associated with this shipment",
5717
+ "nullable": true
5718
+ },
5719
+ "advanced_options": {
5720
+ "$ref": "#/components/schemas/AdvancedOptions"
5721
+ },
5722
+ "pickup_location": {
5723
+ "$ref": "#/components/schemas/PudoLocation"
5724
+ },
5725
+ "dropoff_location": {
5726
+ "$ref": "#/components/schemas/PudoLocation"
5727
+ },
5728
+ "reference": {
5729
+ "type": "string",
5730
+ "description": "User specified free form string to identify shipment in their own system",
5731
+ "nullable": true
5732
+ }
5733
+ },
5734
+ "additionalProperties": false,
5735
+ "description": "A request to upload documents for a shipment."
5736
+ },
5737
+ "UploadDocumentsResponse": {
5738
+ "type": "object",
5739
+ "allOf": [
5740
+ {
5741
+ "$ref": "#/components/schemas/BaseResponse"
5742
+ }
5743
+ ],
5744
+ "properties": {
5745
+ "documents": {
5746
+ "type": "array",
5747
+ "items": {
5748
+ "$ref": "#/components/schemas/SellerDocumentResult"
5749
+ },
5750
+ "description": "An array of objects, one for each successfully processed document.",
5751
+ "nullable": true
5752
+ }
5753
+ },
5754
+ "additionalProperties": false,
5755
+ "description": "Response for uploading documents to a carrier."
5756
+ },
5482
5757
  "ValidateInboundDataRequest": {
5483
5758
  "required": [
5484
5759
  "transaction_id"
@@ -20,6 +20,7 @@ import {
20
20
  ImportTrackingEventsRequest,
21
21
  UpdateSettingsRequest,
22
22
  ListPickupsRequest,
23
+ StartTrackingRequest,
23
24
  } from '../requests';
24
25
 
25
26
  import {
@@ -40,17 +41,27 @@ import {
40
41
  GetServicePointResponse,
41
42
  UpdateSettingsResponse,
42
43
  ListPickupsResponse,
44
+ StartTrackingResponse,
43
45
  } from '../responses';
44
46
 
45
47
  import { CarrierAppMetadata } from './metadata/carrier-app-metadata';
46
48
 
47
49
  import { RequestResponseInfo, Handler } from '@shipengine/connect-runtime';
50
+ import { UploadDocumentsRequest } from '../requests/upload-documents-request';
51
+ import { UploadDocumentsResponse } from '../responses/upload-documents-response';
48
52
 
49
53
  /**
50
54
  * @description This defines a connect carrier app
51
55
  */
52
56
  export interface CarrierAppDefinition {
53
57
  Metadata: CarrierAppMetadata;
58
+ /**
59
+ * @description This method is used to upload documents to carrier
60
+ * @param request Data needed by the provider to upload documents
61
+ */
62
+ UploadDocuments?: (
63
+ request: UploadDocumentsRequest,
64
+ ) => UploadDocumentsResponse | Promise<UploadDocumentsResponse>;
54
65
  /**
55
66
  * @description This method is used to register an account
56
67
  * @param request The information needed to register or initialize a connection with the shipping provider
@@ -183,6 +194,13 @@ export interface CarrierAppDefinition {
183
194
  UpdateSettings?: (
184
195
  request: UpdateSettingsRequest,
185
196
  ) => UpdateSettingsResponse | Promise<UpdateSettingsResponse>;
197
+ /**
198
+ * @description This endpoint is used to subscribe for status updates from the carrier
199
+ * @param request Data needed by the provider to start tracking shipments
200
+ */
201
+ StartTracking?: (
202
+ request: StartTrackingRequest,
203
+ ) => StartTrackingResponse | Promise<StartTrackingResponse>;
186
204
  /**
187
205
  * @description A collection of additional routes that can be used to extend the functionality of the app.
188
206
  * Extension methods are not automatically called by the ShipEngine platform, and require working with Auctane developers to implement.
@@ -18,4 +18,6 @@ export enum ApiEndpoints {
18
18
  ImportTrackingEvents = '/ImportTrackingEvents',
19
19
  UpdateSettings = '/UpdateSettings',
20
20
  ListPickups = '/ListPickups',
21
+ StartTracking = '/StartTracking',
22
+ UploadDocuments = '/UploadDocuments',
21
23
  }
@@ -10,6 +10,7 @@ export const createEndpointMapping = (
10
10
  [Method.POST, ApiEndpoints.CancelNotification, definition.CancelNotification],
11
11
  [Method.POST, ApiEndpoints.CancelPickup, definition.CancelPickup],
12
12
  [Method.POST, ApiEndpoints.CreateLabel, definition.CreateLabel],
13
+ [Method.POST, ApiEndpoints.UploadDocuments, definition.UploadDocuments],
13
14
  [Method.POST, ApiEndpoints.CreateManifest, definition.CreateManifest],
14
15
  [Method.POST, ApiEndpoints.GetManifest, definition.GetManifest],
15
16
  [Method.POST, ApiEndpoints.CreateNotification, definition.CreateNotification],
@@ -26,5 +27,6 @@ export const createEndpointMapping = (
26
27
  [Method.POST, ApiEndpoints.ImportTrackingEvents, definition.ImportTrackingEvents],
27
28
  [Method.POST, ApiEndpoints.UpdateSettings, definition.UpdateSettings],
28
29
  [Method.POST, ApiEndpoints.ListPickups, definition.ListPickups],
30
+ [Method.POST, ApiEndpoints.StartTracking, definition.StartTracking],
29
31
  ...mapExtensions(definition.Extensions),
30
32
  ];
@@ -44,6 +44,7 @@ export enum ShippingOptionEnum {
44
44
  CarrierInsurance = 'carrier-insurance',
45
45
  WindsorFrameworkMovementIndicator = 'windsor-framework-movement-indicator',
46
46
  WindsorFrameworkNotAtRisk = 'windsor-framework-not-at-risk',
47
+ EnableDocumentUpload = 'enable-document-upload',
47
48
  }
48
49
 
49
50
  export const ShippingOptionDictionarySchema = Joi.object(
@@ -9,6 +9,8 @@ import { TransportMeanTypes } from './dangerous-good/transport-mean-types';
9
9
 
10
10
  /** @description Basic structure for shipping options */
11
11
  export class AdvancedOptions {
12
+ /** @description Whether the user will upload documents */
13
+ enable_document_upload?: boolean;
12
14
  /** @description Whether the shipment contains alcohol */
13
15
  contains_alcohol?: boolean;
14
16
  /** @description Whether the shipment does not require postage */
@@ -33,5 +33,6 @@ export * from './time-window-schema';
33
33
  export * from './time-window';
34
34
  export * from './tracking';
35
35
  export * from './units';
36
+ export * from './seller-documents';
36
37
  export * from './bill-to';
37
38
  export * from './labels/paperless-details';
@@ -0,0 +1,2 @@
1
+ export * from './seller-document';
2
+ export * from './seller-documents-schema';
@@ -0,0 +1,12 @@
1
+ import { ShipFrom } from '..';
2
+ import { ShippedShipment } from '../pickup/shipped-shipment';
3
+
4
+ /**
5
+ * Represents a document in the upload request.
6
+ */
7
+ export class SellerDocument {
8
+ document_upload_id!: string;
9
+ type!: string;
10
+ name!: string;
11
+ content!: string;
12
+ }
@@ -0,0 +1,13 @@
1
+ import Joi from 'joi';
2
+
3
+ /**
4
+ * Joi validation schema for SellerDocument
5
+ */
6
+ export const SellerDocumentSchema = Joi.object({
7
+ document_upload_id: Joi.string().required().empty(''),
8
+ type: Joi.string().required().empty(''),
9
+ name: Joi.string().required().empty(''),
10
+ content: Joi.string().required().empty(''),
11
+ ship_from: Joi.object().required(),
12
+ ship_to: Joi.object().required(),
13
+ });
@@ -16,3 +16,5 @@ export * from './update-method-schema';
16
16
  export * from './update-method';
17
17
  export * from './standardized-status-detail-codes';
18
18
  export * from './standardized-status-detail-codes-schema';
19
+ export * from './start-tracking-status';
20
+ export * from './start-tracking-status-schema';
@@ -0,0 +1,6 @@
1
+ import Joi from 'joi';
2
+ import { StartTrackingStatus } from './start-tracking-status';
3
+
4
+ export const SubscriptionStatusSchema = Joi.string()
5
+ .valid(...Object.values(StartTrackingStatus))
6
+ .required();
@@ -0,0 +1,7 @@
1
+ /** Status of subscription results */
2
+ export enum StartTrackingStatus {
3
+ /** @description The tracking subscription was created successfully */
4
+ SUCCESS = 'SUCCESS',
5
+ /** @description The tracking subscription could not be created */
6
+ FAILED = 'FAILED',
7
+ }
@@ -17,3 +17,6 @@ export * from './tracking-request';
17
17
  export * from './validate-inbound-data-request';
18
18
  export * from './void-labels-request';
19
19
  export * from './update-settings-request';
20
+ export * from './start-tracking-request';
21
+ export * from './start-tracking-request-schema';
22
+ export * from './upload-documents-request';
@@ -0,0 +1,7 @@
1
+ import Joi from 'joi';
2
+ import { IdentifierSchema } from '../models/identifier-schema';
3
+ import { BaseRequestSchema } from './base-request-schema';
4
+
5
+ export const StartTrackingRequestSchema = BaseRequestSchema.keys({
6
+ identifiers: Joi.array().required().items(IdentifierSchema),
7
+ });
@@ -0,0 +1,9 @@
1
+ import { BaseRequest } from './base-request';
2
+ import { Identifier } from '../models/identifier';
3
+
4
+ /**
5
+ * @description Request to start tracking shipments using identifiers
6
+ */
7
+ export class StartTrackingRequest extends BaseRequest {
8
+ identifiers!: Identifier[];
9
+ }
@@ -0,0 +1,38 @@
1
+ import { BaseRequest } from './base-request';
2
+ import {
3
+ AdvancedOptions,
4
+ Identifier,
5
+ PudoLocation,
6
+ SellerDocument,
7
+ ShipFrom,
8
+ ShippedPackage,
9
+ ShipTo,
10
+ } from '../models';
11
+
12
+ /**
13
+ * A request to upload documents for a shipment.
14
+ */
15
+ export class UploadDocumentsRequest extends BaseRequest {
16
+ /** @description The list of documents to be uploaded */
17
+ documents!: SellerDocument[];
18
+ /** @description The carrier tracking number for this shipment */
19
+ tracking_number!: string;
20
+ /** @description The shipment sender's address. It may or may not have been validated. */
21
+ ship_from?: ShipFrom;
22
+ /** @description The address that a shipment will be delivered to */
23
+ ship_to?: ShipTo;
24
+ /** @description Non-tracking alternative ids associated with this shipment */
25
+ alternative_identifiers?: Identifier[];
26
+ /** @description The service code used for this shipment */
27
+ service_code?: string;
28
+ /** @description The list of packages associated with this shipment */
29
+ packages?: ShippedPackage[];
30
+ /** @description Advanced shipping options (Contains Alcohol, Non Machinable, etc) */
31
+ advanced_options?: AdvancedOptions;
32
+ /** @description Add pick-up location detail*/
33
+ pickup_location?: PudoLocation;
34
+ /** @description Add drop-off location detail*/
35
+ dropoff_location?: PudoLocation;
36
+ /** @description User specified free form string to identify shipment in their own system */
37
+ reference?: string;
38
+ }
@@ -33,3 +33,9 @@ export * from './void-labels-response-schema';
33
33
  export * from './void-labels-response';
34
34
  export * from './update-settings-response-schema';
35
35
  export * from './update-settings-response';
36
+ export * from './start-tracking-response';
37
+ export * from './start-tracking-response-schema';
38
+ export * from './seller-document-result';
39
+ export * from './upload-document-result-schema';
40
+ export * from './upload-documents-response-schema';
41
+ export * from './upload-documents-response';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Represents the result of uploading a document to the carrier.
3
+ */
4
+ export class SellerDocumentResult {
5
+ document_upload_id!: string;
6
+ carrier_document_id?: string;
7
+ uploaded_to_carrier_at?: Date;
8
+ errors?: string[];
9
+ }
@@ -0,0 +1,14 @@
1
+ import Joi from 'joi';
2
+ import { IdentifierSchema } from '../models/identifier-schema';
3
+ import { BaseResponseSchema } from './base-response-schema';
4
+ import { SubscriptionStatusSchema } from '../models/tracking/start-tracking-status-schema';
5
+
6
+ export const SubscriptionResultSchema = Joi.object({
7
+ identifier: IdentifierSchema.required(),
8
+ status: SubscriptionStatusSchema,
9
+ message: Joi.string().required(),
10
+ });
11
+
12
+ export const StartTrackingResponseSchema = BaseResponseSchema.keys({
13
+ subscription_results: Joi.array().required().items(SubscriptionResultSchema),
14
+ });
@@ -0,0 +1,16 @@
1
+ import { BaseResponse } from './base-response';
2
+ import { Identifier } from '../models';
3
+ import { StartTrackingStatus } from '../models/tracking/start-tracking-status';
4
+
5
+ /**
6
+ * @description Response from start tracking subscriptions
7
+ */
8
+ export class StartTrackingResponse extends BaseResponse {
9
+ subscription_results!: SubscriptionResult[];
10
+ }
11
+
12
+ export interface SubscriptionResult {
13
+ identifier: Identifier;
14
+ status: StartTrackingStatus;
15
+ message: string;
16
+ }