@shipengine/connect-carrier-api 4.17.4 → 4.18.1
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 +7 -0
- package/lib/app/constants.d.ts +2 -1
- package/lib/app/constants.js +1 -0
- package/lib/app/constants.js.map +1 -1
- package/lib/app/create-endpoint-mapping.js +1 -0
- package/lib/app/create-endpoint-mapping.js.map +1 -1
- package/lib/app/metadata/shipping-option.d.ts +2 -1
- package/lib/app/metadata/shipping-option.js +1 -0
- package/lib/app/metadata/shipping-option.js.map +1 -1
- package/lib/models/advanced-options.d.ts +2 -0
- package/lib/models/advanced-options.js +2 -0
- package/lib/models/advanced-options.js.map +1 -1
- package/lib/models/index.d.ts +1 -0
- package/lib/models/index.js +1 -0
- package/lib/models/index.js.map +1 -1
- package/lib/models/limit-identifier-schema.d.ts +2 -0
- package/lib/models/limit-identifier-schema.js +11 -0
- package/lib/models/limit-identifier-schema.js.map +1 -0
- package/lib/models/limit-identifier-type-schema.d.ts +2 -0
- package/lib/models/limit-identifier-type-schema.js +8 -0
- package/lib/models/limit-identifier-type-schema.js.map +1 -0
- package/lib/models/limit-identifier-type.d.ts +3 -0
- package/lib/models/limit-identifier-type.js +8 -0
- package/lib/models/limit-identifier-type.js.map +1 -0
- package/lib/models/limit-identifier.d.ts +5 -0
- package/lib/models/limit-identifier.js +9 -0
- package/lib/models/limit-identifier.js.map +1 -0
- package/lib/models/seller-documents/index.d.ts +2 -0
- package/lib/models/seller-documents/index.js +6 -0
- package/lib/models/seller-documents/index.js.map +1 -0
- package/lib/models/seller-documents/seller-document.d.ts +9 -0
- package/lib/models/seller-documents/seller-document.js +14 -0
- package/lib/models/seller-documents/seller-document.js.map +1 -0
- package/lib/models/seller-documents/seller-documents-schema.d.ts +5 -0
- package/lib/models/seller-documents/seller-documents-schema.js +17 -0
- package/lib/models/seller-documents/seller-documents-schema.js.map +1 -0
- package/lib/requests/index.d.ts +1 -0
- package/lib/requests/index.js +1 -0
- package/lib/requests/index.js.map +1 -1
- package/lib/requests/upload-documents-request.d.ts +29 -0
- package/lib/requests/upload-documents-request.js +33 -0
- package/lib/requests/upload-documents-request.js.map +1 -0
- package/lib/responses/create-label-response-schema.js +2 -0
- package/lib/responses/create-label-response-schema.js.map +1 -1
- package/lib/responses/create-label-response.d.ts +2 -0
- package/lib/responses/create-label-response.js +1 -0
- package/lib/responses/create-label-response.js.map +1 -1
- package/lib/responses/index.d.ts +4 -0
- package/lib/responses/index.js +4 -0
- package/lib/responses/index.js.map +1 -1
- package/lib/responses/seller-document-result.d.ts +9 -0
- package/lib/responses/seller-document-result.js +14 -0
- package/lib/responses/seller-document-result.js.map +1 -0
- package/lib/responses/start-tracking-response-schema.js +1 -1
- package/lib/responses/start-tracking-response-schema.js.map +1 -1
- package/lib/responses/start-tracking-response.d.ts +1 -1
- package/lib/responses/upload-document-result-schema.d.ts +2 -0
- package/lib/responses/upload-document-result-schema.js +12 -0
- package/lib/responses/upload-document-result-schema.js.map +1 -0
- package/lib/responses/upload-documents-response-schema.d.ts +2 -0
- package/lib/responses/upload-documents-response-schema.js +11 -0
- package/lib/responses/upload-documents-response-schema.js.map +1 -0
- package/lib/responses/upload-documents-response.d.ts +8 -0
- package/lib/responses/upload-documents-response.js +12 -0
- package/lib/responses/upload-documents-response.js.map +1 -0
- package/package.json +1 -1
- package/spec.json +212 -11
- package/src/app/carrier-app-definition.ts +9 -0
- package/src/app/constants.ts +1 -0
- package/src/app/create-endpoint-mapping.ts +1 -0
- package/src/app/metadata/shipping-option.ts +1 -0
- package/src/models/advanced-options.ts +2 -0
- package/src/models/index.ts +1 -0
- package/src/models/limit-identifier-schema.ts +7 -0
- package/src/models/limit-identifier-type-schema.ts +4 -0
- package/src/models/limit-identifier-type.ts +3 -0
- package/src/models/limit-identifier.ts +6 -0
- package/src/models/seller-documents/index.ts +2 -0
- package/src/models/seller-documents/seller-document.ts +12 -0
- package/src/models/seller-documents/seller-documents-schema.ts +13 -0
- package/src/requests/index.ts +1 -0
- package/src/requests/upload-documents-request.ts +38 -0
- package/src/responses/create-label-response-schema.ts +2 -0
- package/src/responses/create-label-response.ts +2 -0
- package/src/responses/index.ts +4 -0
- package/src/responses/seller-document-result.ts +9 -0
- package/src/responses/start-tracking-response-schema.ts +1 -1
- package/src/responses/start-tracking-response.ts +1 -1
- package/src/responses/upload-document-result-schema.ts +8 -0
- package/src/responses/upload-documents-response-schema.ts +7 -0
- package/src/responses/upload-documents-response.ts +9 -0
- package/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
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.
|
|
6
|
+
"version": "1.30.1"
|
|
7
7
|
},
|
|
8
8
|
"paths": {
|
|
9
9
|
"/Register": {
|
|
@@ -949,7 +949,9 @@
|
|
|
949
949
|
},
|
|
950
950
|
"/StartTracking": {
|
|
951
951
|
"post": {
|
|
952
|
-
"tags": [
|
|
952
|
+
"tags": [
|
|
953
|
+
"Tracking"
|
|
954
|
+
],
|
|
953
955
|
"description": "This method subscribes to tracking events for one or more identifiers. This endpoint initiate the subscription with the carrier's system.",
|
|
954
956
|
"operationId": "StartTracking",
|
|
955
957
|
"requestBody": {
|
|
@@ -961,8 +963,14 @@
|
|
|
961
963
|
},
|
|
962
964
|
"example": {
|
|
963
965
|
"identifiers": [
|
|
964
|
-
{
|
|
965
|
-
|
|
966
|
+
{
|
|
967
|
+
"type": "tracking_number",
|
|
968
|
+
"value": "PL1234567890"
|
|
969
|
+
},
|
|
970
|
+
{
|
|
971
|
+
"type": "tracking_number",
|
|
972
|
+
"value": "PL0987654321"
|
|
973
|
+
}
|
|
966
974
|
],
|
|
967
975
|
"transaction_id": "771323cb-75eb-4e2a-bc11-fda608c6ade8",
|
|
968
976
|
"authorization": {},
|
|
@@ -1248,6 +1256,10 @@
|
|
|
1248
1256
|
},
|
|
1249
1257
|
"transport_mean": {
|
|
1250
1258
|
"$ref": "#/components/schemas/TransportMeanEnum"
|
|
1259
|
+
},
|
|
1260
|
+
"enable_document_upload": {
|
|
1261
|
+
"type": "boolean",
|
|
1262
|
+
"description": "Indicates whether document upload is enabled for the shipment."
|
|
1251
1263
|
}
|
|
1252
1264
|
},
|
|
1253
1265
|
"additionalProperties": {},
|
|
@@ -1858,6 +1870,14 @@
|
|
|
1858
1870
|
"description": "Alternative identifiers associated with this shipment.",
|
|
1859
1871
|
"nullable": true
|
|
1860
1872
|
},
|
|
1873
|
+
"limit_identifiers": {
|
|
1874
|
+
"type": "array",
|
|
1875
|
+
"items": {
|
|
1876
|
+
"$ref": "#/components/schemas/LimitIdentifier"
|
|
1877
|
+
},
|
|
1878
|
+
"description": "An array that defines rate/usage limit identifiers applicable to specific functionalities within the integration. Each entry represents a unique limit configuration tied to a functionality (e.g., \"track,\" \"createLabel\").",
|
|
1879
|
+
"nullable": true
|
|
1880
|
+
},
|
|
1861
1881
|
"estimated_delivery_datetime": {
|
|
1862
1882
|
"type": "string",
|
|
1863
1883
|
"description": "The estimated date and time for when the shipment will be delivered. Formatted per the\r\nhttps://tools.ietf.org/html/rfc3339 spec.",
|
|
@@ -3111,6 +3131,29 @@
|
|
|
3111
3131
|
"additionalProperties": false,
|
|
3112
3132
|
"description": "A key value pair, allowing custom properties to be stored."
|
|
3113
3133
|
},
|
|
3134
|
+
"LimitIdentifier": {
|
|
3135
|
+
"required": [
|
|
3136
|
+
"type",
|
|
3137
|
+
"value"
|
|
3138
|
+
],
|
|
3139
|
+
"type": "object",
|
|
3140
|
+
"properties": {
|
|
3141
|
+
"type": {
|
|
3142
|
+
"$ref": "#/components/schemas/LimitIdentifierType"
|
|
3143
|
+
},
|
|
3144
|
+
"value": {
|
|
3145
|
+
"type": "string",
|
|
3146
|
+
"description": "A unique identifier referencing the specific rate/usage limit configuration in the Rate Limiter."
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3149
|
+
},
|
|
3150
|
+
"LimitIdentifierType": {
|
|
3151
|
+
"type": "string",
|
|
3152
|
+
"description": "The name of the functionality associated with this limit (e.g., \"track\").",
|
|
3153
|
+
"enum": [
|
|
3154
|
+
"track"
|
|
3155
|
+
]
|
|
3156
|
+
},
|
|
3114
3157
|
"ImportTrackingEventsRequest": {
|
|
3115
3158
|
"required": [
|
|
3116
3159
|
"transaction_id"
|
|
@@ -3837,7 +3880,7 @@
|
|
|
3837
3880
|
"items": {
|
|
3838
3881
|
"$ref": "#/components/schemas/DisplayScheme"
|
|
3839
3882
|
},
|
|
3840
|
-
"description": "
|
|
3883
|
+
"description": "Display schemes for shipments.",
|
|
3841
3884
|
"nullable": true
|
|
3842
3885
|
}
|
|
3843
3886
|
},
|
|
@@ -4419,6 +4462,62 @@
|
|
|
4419
4462
|
],
|
|
4420
4463
|
"type": "string"
|
|
4421
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
|
+
},
|
|
4422
4521
|
"Service": {
|
|
4423
4522
|
"type": "object",
|
|
4424
4523
|
"properties": {
|
|
@@ -5392,7 +5491,10 @@
|
|
|
5392
5491
|
"description": "This model represents the successful response from a tracking request."
|
|
5393
5492
|
},
|
|
5394
5493
|
"StartTrackingRequest": {
|
|
5395
|
-
"required": [
|
|
5494
|
+
"required": [
|
|
5495
|
+
"identifiers",
|
|
5496
|
+
"transaction_id"
|
|
5497
|
+
],
|
|
5396
5498
|
"type": "object",
|
|
5397
5499
|
"allOf": [
|
|
5398
5500
|
{
|
|
@@ -5413,7 +5515,9 @@
|
|
|
5413
5515
|
"description": "This model represents the request payload for subscribing to tracking events for one or more identifiers."
|
|
5414
5516
|
},
|
|
5415
5517
|
"StartTrackingResponse": {
|
|
5416
|
-
"required": [
|
|
5518
|
+
"required": [
|
|
5519
|
+
"subscription_results"
|
|
5520
|
+
],
|
|
5417
5521
|
"type": "object",
|
|
5418
5522
|
"allOf": [
|
|
5419
5523
|
{
|
|
@@ -5434,7 +5538,10 @@
|
|
|
5434
5538
|
"description": "This model represents the response from a start tracking subscription request."
|
|
5435
5539
|
},
|
|
5436
5540
|
"SubscriptionResult": {
|
|
5437
|
-
"required": [
|
|
5541
|
+
"required": [
|
|
5542
|
+
"identifier",
|
|
5543
|
+
"status"
|
|
5544
|
+
],
|
|
5438
5545
|
"type": "object",
|
|
5439
5546
|
"properties": {
|
|
5440
5547
|
"identifier": {
|
|
@@ -5443,7 +5550,7 @@
|
|
|
5443
5550
|
"status": {
|
|
5444
5551
|
"$ref": "#/components/schemas/SubscriptionStatus"
|
|
5445
5552
|
},
|
|
5446
|
-
"
|
|
5553
|
+
"error_message": {
|
|
5447
5554
|
"type": "string",
|
|
5448
5555
|
"description": "Optional message providing additional details about the subscription result.",
|
|
5449
5556
|
"nullable": true
|
|
@@ -5453,7 +5560,10 @@
|
|
|
5453
5560
|
"description": "This model represents the result of a tracking subscription attempt for a single identifier."
|
|
5454
5561
|
},
|
|
5455
5562
|
"SubscriptionStatus": {
|
|
5456
|
-
"enum": [
|
|
5563
|
+
"enum": [
|
|
5564
|
+
"success",
|
|
5565
|
+
"failed"
|
|
5566
|
+
],
|
|
5457
5567
|
"type": "string",
|
|
5458
5568
|
"description": "Status of the tracking subscription attempt.\nsuccess - Subscription was successful\nfailed - Subscription failed"
|
|
5459
5569
|
},
|
|
@@ -5553,6 +5663,97 @@
|
|
|
5553
5663
|
"additionalProperties": false,
|
|
5554
5664
|
"description": "This model represents the successful response for updating carrier settings request."
|
|
5555
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
|
+
},
|
|
5556
5757
|
"ValidateInboundDataRequest": {
|
|
5557
5758
|
"required": [
|
|
5558
5759
|
"transaction_id"
|
|
@@ -5943,4 +6144,4 @@
|
|
|
5943
6144
|
"description": "Given inbound data, such as a webhook with tracking updates, return normalized information."
|
|
5944
6145
|
}
|
|
5945
6146
|
]
|
|
5946
|
-
}
|
|
6147
|
+
}
|
|
@@ -47,12 +47,21 @@ import {
|
|
|
47
47
|
import { CarrierAppMetadata } from './metadata/carrier-app-metadata';
|
|
48
48
|
|
|
49
49
|
import { RequestResponseInfo, Handler } from '@shipengine/connect-runtime';
|
|
50
|
+
import { UploadDocumentsRequest } from '../requests/upload-documents-request';
|
|
51
|
+
import { UploadDocumentsResponse } from '../responses/upload-documents-response';
|
|
50
52
|
|
|
51
53
|
/**
|
|
52
54
|
* @description This defines a connect carrier app
|
|
53
55
|
*/
|
|
54
56
|
export interface CarrierAppDefinition {
|
|
55
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>;
|
|
56
65
|
/**
|
|
57
66
|
* @description This method is used to register an account
|
|
58
67
|
* @param request The information needed to register or initialize a connection with the shipping provider
|
package/src/app/constants.ts
CHANGED
|
@@ -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],
|
|
@@ -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 */
|
package/src/models/index.ts
CHANGED
|
@@ -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
|
+
});
|
package/src/requests/index.ts
CHANGED
|
@@ -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
|
+
}
|
|
@@ -10,6 +10,7 @@ import { RelayPointDetailsSchema } from '../models/relay-points/relay-point-deta
|
|
|
10
10
|
import { TimeWindowSchema } from '../models/time-window-schema';
|
|
11
11
|
import { PaperlessDetailsSchema } from '../models/labels/paperless-details-schema';
|
|
12
12
|
import { PudoLocationSchema } from '../models/addresses/pudo-location-schema';
|
|
13
|
+
import { LimitIdentifierSchema } from '../models/limit-identifier-schema';
|
|
13
14
|
|
|
14
15
|
export const CreateLabelResponseSchema = BaseResponseSchema.keys({
|
|
15
16
|
transaction_id: Joi.string().required(),
|
|
@@ -30,4 +31,5 @@ export const CreateLabelResponseSchema = BaseResponseSchema.keys({
|
|
|
30
31
|
relay_points: RelayPointDetailsSchema.optional(),
|
|
31
32
|
dropoff_location: PudoLocationSchema.optional(),
|
|
32
33
|
pickup_location: PudoLocationSchema.optional(),
|
|
34
|
+
limit_identifiers: Joi.array().optional().items(LimitIdentifierSchema),
|
|
33
35
|
});
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
PudoLocation,
|
|
13
13
|
} from '../models';
|
|
14
14
|
import { CarrierWeight } from '../models/units/carrier-weight';
|
|
15
|
+
import { LimitIdentifier } from '../models/limit-identifier';
|
|
15
16
|
|
|
16
17
|
/** @description Basic structure for a response to create a label */
|
|
17
18
|
export class CreateLabelResponse extends BaseResponse {
|
|
@@ -36,4 +37,5 @@ export class CreateLabelResponse extends BaseResponse {
|
|
|
36
37
|
dropoff_location?: PudoLocation;
|
|
37
38
|
pickup_location?: PudoLocation;
|
|
38
39
|
carrier_weight?: CarrierWeight;
|
|
40
|
+
limit_identifiers?: LimitIdentifier[];
|
|
39
41
|
}
|
package/src/responses/index.ts
CHANGED
|
@@ -35,3 +35,7 @@ export * from './update-settings-response-schema';
|
|
|
35
35
|
export * from './update-settings-response';
|
|
36
36
|
export * from './start-tracking-response';
|
|
37
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';
|
|
@@ -6,7 +6,7 @@ import { SubscriptionStatusSchema } from '../models/tracking/start-tracking-stat
|
|
|
6
6
|
export const SubscriptionResultSchema = Joi.object({
|
|
7
7
|
identifier: IdentifierSchema.required(),
|
|
8
8
|
status: SubscriptionStatusSchema,
|
|
9
|
-
|
|
9
|
+
error_message: Joi.string().allow('').optional(),
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
export const StartTrackingResponseSchema = BaseResponseSchema.keys({
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
|
|
3
|
+
export const UploadDocumentResultSchema = Joi.object({
|
|
4
|
+
document_upload_id: Joi.string().required().empty(''),
|
|
5
|
+
carrier_document_id: Joi.string().optional().empty(''),
|
|
6
|
+
uploaded_to_carrier_at: Joi.string().optional().isoDate(),
|
|
7
|
+
errors: Joi.array().items(Joi.string()).optional(),
|
|
8
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { UploadDocumentResultSchema } from './upload-document-result-schema';
|
|
3
|
+
|
|
4
|
+
export const UploadDocumentsResponseSchema = Joi.object({
|
|
5
|
+
metadata: Joi.object().pattern(/.*/, [Joi.any()]).required(),
|
|
6
|
+
documents: Joi.array().required().min(1).items(UploadDocumentResultSchema),
|
|
7
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseResponse } from './base-response';
|
|
2
|
+
import { SellerDocumentResult } from './seller-document-result';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Response for uploading documents to a carrier.
|
|
6
|
+
*/
|
|
7
|
+
export class UploadDocumentsResponse extends BaseResponse {
|
|
8
|
+
documents?: SellerDocumentResult[];
|
|
9
|
+
}
|