From 7eb32ce9263bd4ee5e2cd73de84e10b8d7d6230d Mon Sep 17 00:00:00 2001 From: panxl6 Date: Fri, 10 Jan 2025 13:38:34 +0800 Subject: [PATCH] feat: supported 2025-01 version. --- .gitignore | 2 + LICENSE.txt | 22 ++ README.md | 286 ++++++++++++++- package.json | 36 ++ src/aftership.ts | 163 +++++++++ src/api/Courier.ts | 66 ++++ src/api/EstimatedDeliveryDate.ts | 53 +++ src/api/Tracking.ts | 182 ++++++++++ src/error/code.ts | 32 ++ src/error/index.ts | 34 ++ src/error/meta_code.ts | 33 ++ src/lib/authentication.ts | 127 +++++++ src/lib/rate_limit.ts | 27 ++ src/lib/request.ts | 197 ++++++++++ src/model/AdditionalFieldsV1.ts | 14 + ...matedDeliveryDateCreateTrackingResponse.ts | 23 ++ ...dDeliveryDateDeleteTrackingByIdResponse.ts | 23 ++ ...atedDeliveryDateGetTrackingByIdResponse.ts | 23 ++ ...ryDateMarkTrackingCompletedByIdResponse.ts | 23 ++ ...DeliveryDateRetrackTrackingByIdResponse.ts | 23 ++ .../AftershipEstimatedDeliveryDateTracking.ts | 23 ++ ...dDeliveryDateUpdateTrackingByIdResponse.ts | 23 ++ .../CarbonEmissionsCreateTrackingResponse.ts | 15 + ...rbonEmissionsDeleteTrackingByIdResponse.ts | 15 + .../CarbonEmissionsGetTrackingByIdResponse.ts | 15 + ...ssionsMarkTrackingCompletedByIdResponse.ts | 15 + ...bonEmissionsRetrackTrackingByIdResponse.ts | 15 + src/model/CarbonEmissionsTracking.ts | 15 + ...rbonEmissionsUpdateTrackingByIdResponse.ts | 15 + src/model/Checkpoint.ts | 78 ++++ src/model/CoordinateCheckpoint.ts | 15 + src/model/Courier.ts | 47 +++ ...matedDeliveryDateCreateTrackingResponse.ts | 19 + ...dDeliveryDateDeleteTrackingByIdResponse.ts | 19 + ...atedDeliveryDateGetTrackingByIdResponse.ts | 19 + ...ryDateMarkTrackingCompletedByIdResponse.ts | 19 + ...DeliveryDateRetrackTrackingByIdResponse.ts | 19 + .../CourierEstimatedDeliveryDateTracking.ts | 19 + ...dDeliveryDateUpdateTrackingByIdResponse.ts | 19 + src/model/CourierResponseV1.ts | 17 + src/model/CreateTrackingRequest.ts | 166 +++++++++ src/model/CreateTrackingResponse.ts | 335 ++++++++++++++++++ ...matedDeliveryDateCreateTrackingResponse.ts | 23 ++ ...dDeliveryDateDeleteTrackingByIdResponse.ts | 23 ++ ...atedDeliveryDateGetTrackingByIdResponse.ts | 23 ++ ...ryDateMarkTrackingCompletedByIdResponse.ts | 23 ++ ...DeliveryDateRetrackTrackingByIdResponse.ts | 23 ++ .../CustomEstimatedDeliveryDateTracking.ts | 23 ++ ...dDeliveryDateUpdateTrackingByIdResponse.ts | 23 ++ src/model/CustomersCreateTrackingRequest.ts | 27 ++ src/model/CustomersCreateTrackingResponse.ts | 27 ++ .../CustomersDeleteTrackingByIdResponse.ts | 27 ++ src/model/CustomersGetTrackingByIdResponse.ts | 27 ++ ...tomersMarkTrackingCompletedByIdResponse.ts | 27 ++ .../CustomersRetrackTrackingByIdResponse.ts | 27 ++ src/model/CustomersTracking.ts | 27 ++ .../CustomersUpdateTrackingByIdRequest.ts | 27 ++ .../CustomersUpdateTrackingByIdResponse.ts | 27 ++ src/model/DataCourierResponseV1.ts | 16 + .../DataTrackingResponseGetMultipleV1.ts | 17 + src/model/DeleteTrackingByIdResponse.ts | 335 ++++++++++++++++++ ...tionAddressEstimatedDeliveryDateRequest.ts | 27 ++ ...ionAddressEstimatedDeliveryDateResponse.ts | 27 ++ src/model/DestinationAddressPredictRequest.ts | 27 ++ .../DestinationAddressPredictResponse.ts | 27 ++ src/model/DetectCourierRequest.ts | 56 +++ src/model/DetectCourierResponse.ts | 16 + src/model/EstimatedDeliveryDateRequest.ts | 43 +++ src/model/EstimatedDeliveryDateResponse.ts | 63 ++++ ...matedPickupEstimatedDeliveryDateRequest.ts | 24 ++ ...atedPickupEstimatedDeliveryDateResponse.ts | 28 ++ src/model/EstimatedPickupPredictRequest.ts | 24 ++ src/model/EstimatedPickupPredictResponse.ts | 28 ++ src/model/EventsCheckpoint.ts | 16 + ...EstimatedDeliveryCreateTrackingResponse.ts | 27 ++ ...matedDeliveryDeleteTrackingByIdResponse.ts | 27 ++ ...stimatedDeliveryGetTrackingByIdResponse.ts | 27 ++ ...liveryMarkTrackingCompletedByIdResponse.ts | 27 ++ ...atedDeliveryRetrackTrackingByIdResponse.ts | 27 ++ src/model/FirstEstimatedDeliveryTracking.ts | 27 ++ ...matedDeliveryUpdateTrackingByIdResponse.ts | 27 ++ src/model/FirstMileCreateTrackingResponse.ts | 27 ++ .../FirstMileDeleteTrackingByIdResponse.ts | 27 ++ src/model/FirstMileGetTrackingByIdResponse.ts | 27 ++ ...stMileMarkTrackingCompletedByIdResponse.ts | 27 ++ .../FirstMileRetrackTrackingByIdResponse.ts | 27 ++ src/model/FirstMileTracking.ts | 27 ++ .../FirstMileUpdateTrackingByIdResponse.ts | 27 ++ src/model/GetAllCouriersResponse.ts | 16 + src/model/GetTrackingByIdQuery.ts | 8 + src/model/GetTrackingByIdResponse.ts | 335 ++++++++++++++++++ src/model/GetTrackingsQuery.ts | 24 ++ src/model/GetTrackingsResponse.ts | 17 + src/model/GetUserCouriersResponse.ts | 16 + src/model/LastMileCreateTrackingRequest.ts | 15 + src/model/LastMileCreateTrackingResponse.ts | 31 ++ .../LastMileDeleteTrackingByIdResponse.ts | 31 ++ src/model/LastMileGetTrackingByIdResponse.ts | 31 ++ ...stMileMarkTrackingCompletedByIdResponse.ts | 31 ++ .../LastMileRetrackTrackingByIdResponse.ts | 31 ++ src/model/LastMileTracking.ts | 31 ++ .../LastMileUpdateTrackingByIdResponse.ts | 31 ++ ...EstimatedDeliveryCreateTrackingResponse.ts | 27 ++ ...matedDeliveryDeleteTrackingByIdResponse.ts | 27 ++ ...stimatedDeliveryGetTrackingByIdResponse.ts | 27 ++ ...liveryMarkTrackingCompletedByIdResponse.ts | 27 ++ ...atedDeliveryRetrackTrackingByIdResponse.ts | 27 ++ src/model/LatestEstimatedDeliveryTracking.ts | 27 ++ ...matedDeliveryUpdateTrackingByIdResponse.ts | 27 ++ src/model/MarkTrackingCompletedByIdRequest.ts | 11 + .../MarkTrackingCompletedByIdResponse.ts | 335 ++++++++++++++++++ src/model/MetaV1.ts | 19 + ...matedPickupEstimatedDeliveryDateRequest.ts | 15 + ...atedPickupEstimatedDeliveryDateResponse.ts | 15 + ...essingTimeEstimatedPickupPredictRequest.ts | 15 + ...ssingTimeEstimatedPickupPredictResponse.ts | 15 + ...iginAddressEstimatedDeliveryDateRequest.ts | 27 ++ ...ginAddressEstimatedDeliveryDateResponse.ts | 27 ++ src/model/OriginAddressPredictRequest.ts | 27 ++ src/model/OriginAddressPredictResponse.ts | 27 ++ src/model/Pagination.ts | 9 + ...nationDataTrackingResponseGetMultipleV1.ts | 19 + src/model/PaginationGetTrackingsResponse.ts | 19 + src/model/PredictBatchRequest.ts | 12 + src/model/PredictBatchResponse.ts | 12 + src/model/PredictRequest.ts | 43 +++ src/model/PredictResponse.ts | 63 ++++ src/model/ReasonEventsCheckpoint.ts | 11 + src/model/RetrackTrackingByIdResponse.ts | 335 ++++++++++++++++++ .../ShipmentWeightCreateTrackingResponse.ts | 15 + ...hipmentWeightDeleteTrackingByIdResponse.ts | 15 + .../ShipmentWeightGetTrackingByIdResponse.ts | 15 + ...WeightMarkTrackingCompletedByIdResponse.ts | 15 + ...ipmentWeightRetrackTrackingByIdResponse.ts | 15 + src/model/ShipmentWeightTracking.ts | 15 + ...hipmentWeightUpdateTrackingByIdResponse.ts | 15 + src/model/SlugGroupV1.ts | 19 + src/model/TagV1.ts | 16 + src/model/Tracking.ts | 335 ++++++++++++++++++ src/model/TrackingResponseGetMultipleV1.ts | 17 + src/model/TrackingResponseV1.ts | 17 + src/model/UpdateTrackingByIdRequest.ts | 144 ++++++++ src/model/UpdateTrackingByIdResponse.ts | 335 ++++++++++++++++++ .../WeightEstimatedDeliveryDateRequest.ts | 15 + .../WeightEstimatedDeliveryDateResponse.ts | 15 + src/model/WeightPredictRequest.ts | 15 + src/model/WeightPredictResponse.ts | 15 + src/utils/parse_proxy.ts | 81 +++++ test.ts | 89 +++++ tsconfig.json | 24 ++ yarn.lock | 77 ++++ 151 files changed, 7098 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 LICENSE.txt create mode 100644 package.json create mode 100644 src/aftership.ts create mode 100644 src/api/Courier.ts create mode 100644 src/api/EstimatedDeliveryDate.ts create mode 100644 src/api/Tracking.ts create mode 100644 src/error/code.ts create mode 100644 src/error/index.ts create mode 100644 src/error/meta_code.ts create mode 100644 src/lib/authentication.ts create mode 100644 src/lib/rate_limit.ts create mode 100644 src/lib/request.ts create mode 100644 src/model/AdditionalFieldsV1.ts create mode 100644 src/model/AftershipEstimatedDeliveryDateCreateTrackingResponse.ts create mode 100644 src/model/AftershipEstimatedDeliveryDateDeleteTrackingByIdResponse.ts create mode 100644 src/model/AftershipEstimatedDeliveryDateGetTrackingByIdResponse.ts create mode 100644 src/model/AftershipEstimatedDeliveryDateMarkTrackingCompletedByIdResponse.ts create mode 100644 src/model/AftershipEstimatedDeliveryDateRetrackTrackingByIdResponse.ts create mode 100644 src/model/AftershipEstimatedDeliveryDateTracking.ts create mode 100644 src/model/AftershipEstimatedDeliveryDateUpdateTrackingByIdResponse.ts create mode 100644 src/model/CarbonEmissionsCreateTrackingResponse.ts create mode 100644 src/model/CarbonEmissionsDeleteTrackingByIdResponse.ts create mode 100644 src/model/CarbonEmissionsGetTrackingByIdResponse.ts create mode 100644 src/model/CarbonEmissionsMarkTrackingCompletedByIdResponse.ts create mode 100644 src/model/CarbonEmissionsRetrackTrackingByIdResponse.ts create mode 100644 src/model/CarbonEmissionsTracking.ts create mode 100644 src/model/CarbonEmissionsUpdateTrackingByIdResponse.ts create mode 100644 src/model/Checkpoint.ts create mode 100644 src/model/CoordinateCheckpoint.ts create mode 100644 src/model/Courier.ts create mode 100644 src/model/CourierEstimatedDeliveryDateCreateTrackingResponse.ts create mode 100644 src/model/CourierEstimatedDeliveryDateDeleteTrackingByIdResponse.ts create mode 100644 src/model/CourierEstimatedDeliveryDateGetTrackingByIdResponse.ts create mode 100644 src/model/CourierEstimatedDeliveryDateMarkTrackingCompletedByIdResponse.ts create mode 100644 src/model/CourierEstimatedDeliveryDateRetrackTrackingByIdResponse.ts create mode 100644 src/model/CourierEstimatedDeliveryDateTracking.ts create mode 100644 src/model/CourierEstimatedDeliveryDateUpdateTrackingByIdResponse.ts create mode 100644 src/model/CourierResponseV1.ts create mode 100644 src/model/CreateTrackingRequest.ts create mode 100644 src/model/CreateTrackingResponse.ts create mode 100644 src/model/CustomEstimatedDeliveryDateCreateTrackingResponse.ts create mode 100644 src/model/CustomEstimatedDeliveryDateDeleteTrackingByIdResponse.ts create mode 100644 src/model/CustomEstimatedDeliveryDateGetTrackingByIdResponse.ts create mode 100644 src/model/CustomEstimatedDeliveryDateMarkTrackingCompletedByIdResponse.ts create mode 100644 src/model/CustomEstimatedDeliveryDateRetrackTrackingByIdResponse.ts create mode 100644 src/model/CustomEstimatedDeliveryDateTracking.ts create mode 100644 src/model/CustomEstimatedDeliveryDateUpdateTrackingByIdResponse.ts create mode 100644 src/model/CustomersCreateTrackingRequest.ts create mode 100644 src/model/CustomersCreateTrackingResponse.ts create mode 100644 src/model/CustomersDeleteTrackingByIdResponse.ts create mode 100644 src/model/CustomersGetTrackingByIdResponse.ts create mode 100644 src/model/CustomersMarkTrackingCompletedByIdResponse.ts create mode 100644 src/model/CustomersRetrackTrackingByIdResponse.ts create mode 100644 src/model/CustomersTracking.ts create mode 100644 src/model/CustomersUpdateTrackingByIdRequest.ts create mode 100644 src/model/CustomersUpdateTrackingByIdResponse.ts create mode 100644 src/model/DataCourierResponseV1.ts create mode 100644 src/model/DataTrackingResponseGetMultipleV1.ts create mode 100644 src/model/DeleteTrackingByIdResponse.ts create mode 100644 src/model/DestinationAddressEstimatedDeliveryDateRequest.ts create mode 100644 src/model/DestinationAddressEstimatedDeliveryDateResponse.ts create mode 100644 src/model/DestinationAddressPredictRequest.ts create mode 100644 src/model/DestinationAddressPredictResponse.ts create mode 100644 src/model/DetectCourierRequest.ts create mode 100644 src/model/DetectCourierResponse.ts create mode 100644 src/model/EstimatedDeliveryDateRequest.ts create mode 100644 src/model/EstimatedDeliveryDateResponse.ts create mode 100644 src/model/EstimatedPickupEstimatedDeliveryDateRequest.ts create mode 100644 src/model/EstimatedPickupEstimatedDeliveryDateResponse.ts create mode 100644 src/model/EstimatedPickupPredictRequest.ts create mode 100644 src/model/EstimatedPickupPredictResponse.ts create mode 100644 src/model/EventsCheckpoint.ts create mode 100644 src/model/FirstEstimatedDeliveryCreateTrackingResponse.ts create mode 100644 src/model/FirstEstimatedDeliveryDeleteTrackingByIdResponse.ts create mode 100644 src/model/FirstEstimatedDeliveryGetTrackingByIdResponse.ts create mode 100644 src/model/FirstEstimatedDeliveryMarkTrackingCompletedByIdResponse.ts create mode 100644 src/model/FirstEstimatedDeliveryRetrackTrackingByIdResponse.ts create mode 100644 src/model/FirstEstimatedDeliveryTracking.ts create mode 100644 src/model/FirstEstimatedDeliveryUpdateTrackingByIdResponse.ts create mode 100644 src/model/FirstMileCreateTrackingResponse.ts create mode 100644 src/model/FirstMileDeleteTrackingByIdResponse.ts create mode 100644 src/model/FirstMileGetTrackingByIdResponse.ts create mode 100644 src/model/FirstMileMarkTrackingCompletedByIdResponse.ts create mode 100644 src/model/FirstMileRetrackTrackingByIdResponse.ts create mode 100644 src/model/FirstMileTracking.ts create mode 100644 src/model/FirstMileUpdateTrackingByIdResponse.ts create mode 100644 src/model/GetAllCouriersResponse.ts create mode 100644 src/model/GetTrackingByIdQuery.ts create mode 100644 src/model/GetTrackingByIdResponse.ts create mode 100644 src/model/GetTrackingsQuery.ts create mode 100644 src/model/GetTrackingsResponse.ts create mode 100644 src/model/GetUserCouriersResponse.ts create mode 100644 src/model/LastMileCreateTrackingRequest.ts create mode 100644 src/model/LastMileCreateTrackingResponse.ts create mode 100644 src/model/LastMileDeleteTrackingByIdResponse.ts create mode 100644 src/model/LastMileGetTrackingByIdResponse.ts create mode 100644 src/model/LastMileMarkTrackingCompletedByIdResponse.ts create mode 100644 src/model/LastMileRetrackTrackingByIdResponse.ts create mode 100644 src/model/LastMileTracking.ts create mode 100644 src/model/LastMileUpdateTrackingByIdResponse.ts create mode 100644 src/model/LatestEstimatedDeliveryCreateTrackingResponse.ts create mode 100644 src/model/LatestEstimatedDeliveryDeleteTrackingByIdResponse.ts create mode 100644 src/model/LatestEstimatedDeliveryGetTrackingByIdResponse.ts create mode 100644 src/model/LatestEstimatedDeliveryMarkTrackingCompletedByIdResponse.ts create mode 100644 src/model/LatestEstimatedDeliveryRetrackTrackingByIdResponse.ts create mode 100644 src/model/LatestEstimatedDeliveryTracking.ts create mode 100644 src/model/LatestEstimatedDeliveryUpdateTrackingByIdResponse.ts create mode 100644 src/model/MarkTrackingCompletedByIdRequest.ts create mode 100644 src/model/MarkTrackingCompletedByIdResponse.ts create mode 100644 src/model/MetaV1.ts create mode 100644 src/model/OrderProcessingTimeEstimatedPickupEstimatedDeliveryDateRequest.ts create mode 100644 src/model/OrderProcessingTimeEstimatedPickupEstimatedDeliveryDateResponse.ts create mode 100644 src/model/OrderProcessingTimeEstimatedPickupPredictRequest.ts create mode 100644 src/model/OrderProcessingTimeEstimatedPickupPredictResponse.ts create mode 100644 src/model/OriginAddressEstimatedDeliveryDateRequest.ts create mode 100644 src/model/OriginAddressEstimatedDeliveryDateResponse.ts create mode 100644 src/model/OriginAddressPredictRequest.ts create mode 100644 src/model/OriginAddressPredictResponse.ts create mode 100644 src/model/Pagination.ts create mode 100644 src/model/PaginationDataTrackingResponseGetMultipleV1.ts create mode 100644 src/model/PaginationGetTrackingsResponse.ts create mode 100644 src/model/PredictBatchRequest.ts create mode 100644 src/model/PredictBatchResponse.ts create mode 100644 src/model/PredictRequest.ts create mode 100644 src/model/PredictResponse.ts create mode 100644 src/model/ReasonEventsCheckpoint.ts create mode 100644 src/model/RetrackTrackingByIdResponse.ts create mode 100644 src/model/ShipmentWeightCreateTrackingResponse.ts create mode 100644 src/model/ShipmentWeightDeleteTrackingByIdResponse.ts create mode 100644 src/model/ShipmentWeightGetTrackingByIdResponse.ts create mode 100644 src/model/ShipmentWeightMarkTrackingCompletedByIdResponse.ts create mode 100644 src/model/ShipmentWeightRetrackTrackingByIdResponse.ts create mode 100644 src/model/ShipmentWeightTracking.ts create mode 100644 src/model/ShipmentWeightUpdateTrackingByIdResponse.ts create mode 100644 src/model/SlugGroupV1.ts create mode 100644 src/model/TagV1.ts create mode 100644 src/model/Tracking.ts create mode 100644 src/model/TrackingResponseGetMultipleV1.ts create mode 100644 src/model/TrackingResponseV1.ts create mode 100644 src/model/UpdateTrackingByIdRequest.ts create mode 100644 src/model/UpdateTrackingByIdResponse.ts create mode 100644 src/model/WeightEstimatedDeliveryDateRequest.ts create mode 100644 src/model/WeightEstimatedDeliveryDateResponse.ts create mode 100644 src/model/WeightPredictRequest.ts create mode 100644 src/model/WeightPredictResponse.ts create mode 100644 src/utils/parse_proxy.ts create mode 100644 test.ts create mode 100644 tsconfig.json create mode 100644 yarn.lock diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..76add87 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..3568640 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright (c) 2025 AfterShip + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index fc48dc4..848383b 100644 --- a/README.md +++ b/README.md @@ -1 +1,285 @@ -# tracking-sdk-nodejs \ No newline at end of file +# AfterShip Tracking API library for Node.js + +This library allows you to quickly and easily use the AfterShip Tracking API via Node.js. + +For updates to this library, see our [GitHub release page](https://github.com/AfterShip/tracking-sdk-nodejs/releases). + +If you need support using AfterShip products, please contact support@aftership.com. + +## Table of Contents + +- [AfterShip Tracking API library for Node.js](#aftership-tracking-api-library-for-nodejs) + - [Table of Contents](#table-of-contents) + - [Before you begin](#before-you-begin) + - [API and SDK Version](#api-and-sdk-version) + - [Quick Start](#quick-start) + - [Installation](#installation) + - [Constructor](#constructor) + - [Example](#example) + - [Rate Limiter](#rate-limiter) + - [Error Handling](#error-handling) + - [Error List](#error-list) + - [Endpoints](#endpoints) + - [/trackings](#trackings) + - [/couriers](#couriers) + - [/estimated-delivery-date](#estimated-delivery-date) + - [Help](#help) + - [License](#license) + +## Before you begin + +Before you begin to integrate: + +- [Create an AfterShip account](https://admin.aftership.com/). +- [Create an API key](https://organization.automizely.com/api-keys). +- [Install Node.js](https://nodejs.org/en/download/) version 16 or later. + +### API and SDK Version + +Each SDK version is designed to work with a specific API version. Please refer to the table below to identify the supported API versions for each SDK version, ensuring you select the appropriate SDK version for the API version you intend to use. + +| SDK Version | Supported API Version | Branch | +| ----------- | --------------------- | ------------------------------------------------------------- | +| 11.x.x | 2024-10 | https://github.com/AfterShip/tracking-sdk-nodejs/tree/2024-10 | +| 10.x.x | 2024-07 | https://github.com/AfterShip/tracking-sdk-nodejs/tree/2024-07 | +| 9.x.x | 2024-04 | https://github.com/AfterShip/tracking-sdk-nodejs/tree/2024-04 | +| 8.x.x | 2023-10 | https://github.com/AfterShip/aftership-sdk-nodejs | +| <=7.x.x | Legacy API | https://github.com/AfterShip/aftership-sdk-nodejs | + +## Quick Start + +### Installation + +```bash +npm install --save @aftership/tracking-sdk +``` + +## Constructor + +Create AfterShip instance with options + +| Name | Type | Required | Description | +| ---------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------- | +| api_key | string | ✔ | Your AfterShip API key | +| auth_type | enum | | Default value: `AuthType.API_KEY`
AES authentication: `AuthType.AES`
RSA authentication: `AuthType.RSA` | +| api_secret | string | | Required if the authentication type is `AuthType.AES` or `AuthType.RSA` | +| domain | string | | AfterShip API domain. Default value: https://api.aftership.com | +| user_agent | string | | User-defined user-agent string, please follow [RFC9110](https://www.rfc-editor.org/rfc/rfc9110#field.user-agent) format standard. | +| proxy | string | | HTTP proxy URL to use for requests.
Default value: `null`
Example: `http://192.168.0.100:8888` | +| max_retry | number | | Number of retries for each request. Default value: 2. Min is 0, Max is 10. | +| timeout | number | | Timeout for each request in milliseconds. | + +### Example + +```javascript +// Step 1: Require the AfterShip client +import { AfterShip } from "@aftership/tracking-sdk"; +// or +// const {AfterShip} = require('@aftership/tracking-sdk'); + +// Step 2: Initialize the client object +const aftership = new AfterShip({ api_key: "YOUR_API_KEY" }); + +// Step 3: Create the request object +const createTrackingRequestBody = { + tracking_number: "", + slug: "", +}; + +// Step 4: Make the request +aftership.tracking + .createTracking(createTrackingRequestBody) + .then((tracking) => console.log(tracking)) + .catch((error) => console.log(error)); +``` + +## Rate Limiter + +See the [Rate Limit](https://www.aftership.com/docs/tracking/2024-10/quickstart/rate-limit) to understand the AfterShip rate limit policy. + +## Error Handling + +The SDK will return an error object when there is any error during the request, with the following specification: + +| Name | Type | Description | +| ---------------- | ------ | ------------------------------ | +| message | string | Detail message of the error | +| code | enum | Error code enum for API Error. | +| meta_code | number | API response meta code. | +| status_code | number | HTTP status code. | +| response_body | string | API response body. | +| response_headers | object | API response header. | + +### Error List + +| code | meta_code | status_code | message | +| --------------------------------- | --------------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| INVALID_REQUEST | 400 | 400 | The request was invalid or cannot be otherwise served. | +| INVALID_JSON | 4001 | 400 | Invalid JSON data. | +| TRACKING_ALREADY_EXIST | 4003 | 400 | Tracking already exists. | +| TRACKING_DOES_NOT_EXIST | 4004 | 404 | Tracking does not exist. | +| TRACKING_NUMBER_INVALID | 4005 | 400 | The value of tracking_number is invalid. | +| TRACKING_REQUIRED | 4006 | 400 | tracking object is required. | +| TRACKING_NUMBER_REQUIRED | 4007 | 400 | tracking_number is required. | +| VALUE_INVALID | 4008 | 400 | The value of [field_name] is invalid. | +| VALUE_REQUIRED | 4009 | 400 | [field_name] is required. | +| SLUG_INVALID | 4010 | 400 | The value of slug is invalid. | +| MISSING_OR_INVALID_REQUIRED_FIELD | 4011 | 400 | Missing or invalid value of the required fields for this courier. Besides tracking_number, also required: [field_name] | +| BAD_COURIER | 4012 | 400 | The error message will be one of the following:
1. Unable to import shipment as the carrier is not on your approved list for carrier auto-detection. Add the carrier here: https://admin.aftership.com/settings/couriers
2. Unable to import shipment as we don’t recognize the carrier from this tracking number.
3. Unable to import shipment as the tracking number has an invalid format.
4. Unable to import shipment as this carrier is no longer supported.
5. Unable to import shipment as the tracking number does not belong to a carrier in that group. | +| INACTIVE_RETRACK_NOT_ALLOWED | 4013 | 400 | Retrack is not allowed. You can only retrack an inactive tracking. | +| NOTIFICATION_REUQIRED | 4014 | 400 | notification object is required. | +| ID_INVALID | 4015 | 400 | The value of id is invalid. | +| RETRACK_ONCE_ALLOWED | 4016 | 400 | Retrack is not allowed. You can only retrack each shipment once. | +| TRACKING_NUMBER_FORMAT_INVALID | 4017 | 400 | The format of tracking_number is invalid. | +| API_KEY_INVALID | 401 | 401 | The API key is invalid. | +| REQUEST_NOT_ALLOWED | 403 | 403 | The request is understood, but it has been refused or access is not allowed. | +| NOT_FOUND | 404 | 404 | The URI requested is invalid or the resource requested does not exist. | +| TOO_MANY_REQUEST | 429 | 429 | You have exceeded the API call rate limit. The default limit is 10 requests per second. | +| INTERNAL_ERROR | 500 502 503 504 | 500 502 503 504 | Something went wrong on AfterShip's end. | + +## Endpoints + +The AfterShip instance has the following properties which are exactly the same as the API endpoints: + +- courier - Get a list of our supported couriers. +- tracking - Create trackings, update trackings, and get tracking results. +- estimated-delivery-date - Get estimated delivery date for your order. + +### /trackings + +**POST** /trackings + +```javascript +const payload = { + slug: "", + tracking_number: "", + title: "Title Name", + order_id: "ID 1234", + order_id_path: "http://www.aftership.com/order_id=1234", + custom_fields: { + product_name: "iPhone Case", + product_price: "USD19.99", + }, +}; + +aftership.tracking + .createTracking(payload) + .then((result) => console.log(result)) + .catch((e) => console.log(e)); +``` + +**DELETE** /trackings/:id + +```javascript +aftership.tracking + .deleteTrackingById("") + .then((result) => console.log(result)) + .catch((e) => console.log(e)); +``` + +**GET** /trackings + +```javascript +aftership.tracking + .getTrackings({ limit: 10, fields: "slug,tracking_number" }) + .then((result) => console.log(result)) + .catch((e) => console.log(e)); +``` + +**GET** /trackings/:id + +```javascript +aftership.tracking + .getTrackingById("") + .then((result) => console.log(result)) + .catch((e) => console.log(e)); +``` + +**PUT** /trackings/:id + +```javascript +aftership.tracking + .updateTrackingById("", { title: "New Title123" }) + .then((result) => console.log(result)) + .catch((e) => console.log(e)); +``` + +**POST** /trackings/:id/retrack + +```javascript +aftership.tracking + .retrackTrackingById("") + .then((result) => console.log(result)) + .catch((e) => console.log(e)); +``` + +**POST** /trackings/:id/mark-as-completed + +```javascript +aftership.tracking + .markTrackingCompletedById("", { reason: "DELIVERED" }) + .then((result) => console.log(result)) + .catch((e) => console.log(e)); +``` + +### /couriers + +**GET** /couriers + +```javascript +aftership.courier + .getUserCouriers() + .then((result) => console.log(result)) + .catch((e) => console.log(e)); +``` + +**GET** /couriers/all + +```javascript +aftership.courier + .getAllCouriers() + .then((result) => console.log(result)) + .catch((e) => console.log(e)); +``` + +**POST** /couriers/detect + +```js +aftership.courier + .detectCourier({ tracking_number: "" }) + .then((result) => console.log(result)) + .catch((e) => console.log(e)); +``` + +### /estimated-delivery-date + +**POST** /estimated-delivery-date/predict-batch + +```javascript +const payload = { + estimated_delivery_dates: [ + { + slug: "", + origin_address: { country: "" }, + destination_address: { country: "" }, + }, + ], +}; +aftership.estimatedDeliveryDate + .predictBatch(payload) + .then((result) => console.log(result)) + .catch((e) => console.log(e)); +``` + +## Help + +If you get stuck, we're here to help: + +- [Issue Tracker](https://github.com/AfterShip/tracking-sdk-nodejs/issues) for questions, feature requests, bug reports and general discussion related to this package. Try searching before you create a new issue. +- Contact AfterShip official support via support@aftership.com + +## License + +Copyright (c) 2025 AfterShip + +Licensed under the MIT license. diff --git a/package.json b/package.json new file mode 100644 index 0000000..afd65fe --- /dev/null +++ b/package.json @@ -0,0 +1,36 @@ +{ + "name": "@aftership/tracking-sdk", + "version": "12.0.0", + "description": "Tracking NodeJS SDK", + "main": "dist/aftership.js", + "types": "dist/aftership.d.ts", + "engines": { + "node": ">=16.20.0" + }, + "scripts": { + "build": "npm run build:clean && tsc", + "build:clean": "rm -rf ./dist ./coverage", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/aftership/tracking-sdk-nodejs" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/AfterShip/tracking-sdk-nodejs/issues" + }, + "homepage": "https://github.com/aftership/tracking-sdk-nodejs/README.md", + "dependencies": { + "axios": "^1.7.2" + }, + "keywords": [ + "aftership", + "tracking" + ], + "devDependencies": { + "@types/node": "^20.11.25", + "typescript": "^4.9.5" + } +} diff --git a/src/aftership.ts b/src/aftership.ts new file mode 100644 index 0000000..30ca668 --- /dev/null +++ b/src/aftership.ts @@ -0,0 +1,163 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { TrackingApi } from "./api/Tracking"; +import { EstimatedDeliveryDateApi } from "./api/EstimatedDeliveryDate"; +import { CourierApi } from "./api/Courier"; +import { AftershipError, AfterShipErrorCodes } from "./error"; +import { AuthType } from "./lib/authentication"; +import { + DEFAULT_DOMAIN, + DEFAULT_MAX_RETRY, + DEFAULT_TIMEOUT, + DEFAULT_USER_AGENT, + MAX_MAX_RETRY, + MIN_MAX_RETRY, + Request, +} from "./lib/request"; +import { parseProxy } from "./utils/parse_proxy"; + +export interface Options { + auth_type?: AuthType; + api_key?: string; + api_secret?: string; + domain?: string; + max_retry?: number; + timeout?: number; + user_agent?: string; + proxy?: string; +} + +const SDK_ENV_PREFIX = "AFTERSHIP_TRACKING_SDK"; + +export class AfterShip { + public readonly tracking: TrackingApi; + public readonly estimatedDeliveryDate: EstimatedDeliveryDateApi; + public readonly courier: CourierApi; + private readonly options: Options; + + constructor(options?: Options) { + this.options = options === undefined ? {} : options; + + if (this.options.api_key === undefined) { + this.options.api_key = process.env[`${SDK_ENV_PREFIX}_API_KEY`]; + } + if (this.options.api_secret === undefined) { + this.options.api_secret = process.env[`${SDK_ENV_PREFIX}_API_SECRET`]; + } + if (this.options.user_agent === undefined) { + this.options.user_agent = process.env[`${SDK_ENV_PREFIX}_USER_AGENT`]; + if (this.options.user_agent === undefined) { + this.options.user_agent = DEFAULT_USER_AGENT; + } + } + if (this.options.auth_type === undefined) { + this.options.auth_type = process.env[ + `${SDK_ENV_PREFIX}_AUTHENTICATION_TYPE` + ] as AuthType; + if (this.options.auth_type === undefined) { + this.options.auth_type = AuthType.API_KEY; + } + } + if (this.options.domain === undefined) { + this.options.domain = process.env[`${SDK_ENV_PREFIX}_DOMAIN`]; + if (this.options.domain === undefined) { + this.options.domain = DEFAULT_DOMAIN; + } + } + if (this.options.proxy === undefined) { + this.options.proxy = process.env[`${SDK_ENV_PREFIX}_PROXY`]; + } + if (this.options.max_retry === undefined) { + const env_max_retry = process.env[`${SDK_ENV_PREFIX}_MAX_RETRY`]; + if (env_max_retry === undefined) { + this.options.max_retry = DEFAULT_MAX_RETRY; + } else { + this.options.max_retry = parseInt(env_max_retry); + } + } + if (this.options.timeout === undefined) { + const env_timeout = process.env[`${SDK_ENV_PREFIX}_TIMEOUT`]; + if (env_timeout === undefined) { + this.options.timeout = DEFAULT_TIMEOUT; + } else { + this.options.timeout = parseInt(env_timeout); + } + } + + this.validateOptions(); + + const request = new Request({ + auth_type: this.options.auth_type, + api_key: this.options.api_key, + api_secret: this.options.api_secret, + domain: this.options.domain, + max_retry: this.options.max_retry, + timeout: this.options.timeout, + user_agent: this.options.user_agent, + proxy: parseProxy(this.options.proxy), + }); + this.tracking = new TrackingApi(request); + this.estimatedDeliveryDate = new EstimatedDeliveryDateApi(request); + this.courier = new CourierApi(request); + } + + private validateOptions() { + if (this.options.api_key === undefined || this.options.api_key === "") { + throw new AftershipError( + "Invalid API key", + AfterShipErrorCodes.INVALID_API_KEY, + ); + } + if ( + (this.options.auth_type === AuthType.AES || + this.options.auth_type === AuthType.RSA) && + (this.options.api_secret === undefined || this.options.api_secret === "") + ) { + throw new AftershipError( + `Invalid option: auth_type`, + AfterShipErrorCodes.INVALID_OPTION, + ); + } + if ( + this.options.domain && + ((this.options.domain.indexOf("http") < 0 && + this.options.domain.indexOf("https") < 0) || + this.options.domain.endsWith("/")) + ) { + throw new AftershipError( + `Invalid option: domain`, + AfterShipErrorCodes.INVALID_OPTION, + ); + } + if ( + this.options.max_retry !== undefined && + (isNaN(this.options.max_retry) || + this.options.max_retry > MAX_MAX_RETRY || + this.options.max_retry < MIN_MAX_RETRY) + ) { + throw new AftershipError( + `Invalid option: max_retry`, + AfterShipErrorCodes.INVALID_OPTION, + ); + } + if ( + this.options.timeout !== undefined && + (isNaN(this.options.timeout) || this.options.timeout < 0) + ) { + throw new AftershipError( + `Invalid option: timeout`, + AfterShipErrorCodes.INVALID_OPTION, + ); + } + if (this.options.proxy !== undefined && this.options.proxy.length === 0) { + throw new AftershipError( + `Invalid option: proxy`, + AfterShipErrorCodes.INVALID_OPTION, + ); + } + } +} + +export { AuthType, AfterShipErrorCodes, AftershipError }; diff --git a/src/api/Courier.ts b/src/api/Courier.ts new file mode 100644 index 0000000..1fd9fab --- /dev/null +++ b/src/api/Courier.ts @@ -0,0 +1,66 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { Request } from "../lib/request"; +import { AftershipError, AfterShipErrorCodes } from "../error"; +import { GetUserCouriersResponse } from "../model/GetUserCouriersResponse"; +import { DetectCourierRequest } from "../model/DetectCourierRequest"; +import { DetectCourierResponse } from "../model/DetectCourierResponse"; +import { GetAllCouriersResponse } from "../model/GetAllCouriersResponse"; + +export class CourierApi { + private readonly request: Request; + + constructor(request: Request) { + this.request = request; + } + + /** + * Return a list of . + */ + public async getUserCouriers(headers?: { + [key: string]: any; + }): Promise { + return this.request.makeRequest({ + url: `/tracking/2025-01/couriers`, + method: "GET", + headers, + request_legacy_tag: "", + response_legacy_tag: "", + is_paging: false, + }); + } + /** + * Return a list of matched couriers based on tracking number format and or a list of couriers. + */ + public async detectCourier( + body: DetectCourierRequest, + headers?: { [key: string]: any }, + ): Promise { + return this.request.makeRequest({ + url: `/tracking/2025-01/couriers/detect`, + method: "POST", + body, + headers, + request_legacy_tag: "", + response_legacy_tag: "", + is_paging: false, + }); + } + /** + * Return a list of all couriers. + */ + public async getAllCouriers(headers?: { + [key: string]: any; + }): Promise { + return this.request.makeRequest({ + url: `/tracking/2025-01/couriers/all`, + method: "GET", + headers, + request_legacy_tag: "", + response_legacy_tag: "", + is_paging: false, + }); + } +} diff --git a/src/api/EstimatedDeliveryDate.ts b/src/api/EstimatedDeliveryDate.ts new file mode 100644 index 0000000..654f910 --- /dev/null +++ b/src/api/EstimatedDeliveryDate.ts @@ -0,0 +1,53 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { Request } from "../lib/request"; +import { AftershipError, AfterShipErrorCodes } from "../error"; +import { PredictRequest } from "../model/PredictRequest"; +import { PredictResponse } from "../model/PredictResponse"; +import { PredictBatchRequest } from "../model/PredictBatchRequest"; +import { PredictBatchResponse } from "../model/PredictBatchResponse"; + +export class EstimatedDeliveryDateApi { + private readonly request: Request; + + constructor(request: Request) { + this.request = request; + } + + /** + * > The estimated delivery date is provided by AfterShip, based on its AI-predictive model. You can display the EDD on the product page, cart, and order checkout page. It indicates when a customer will receive the order.You can use to activate this feature. + */ + public async predict( + body: PredictRequest, + headers?: { [key: string]: any }, + ): Promise { + return this.request.makeRequest({ + url: `/tracking/2025-01/estimated-delivery-date/predict`, + method: "POST", + body, + headers, + request_legacy_tag: "", + response_legacy_tag: "", + is_paging: false, + }); + } + /** + * > The estimated delivery date is provided by AfterShip, based on its AI-predictive model. You can display the EDD on the product page, cart, and order checkout page. It indicates when a customer will receive the order.You can use to activate this feature.Supported functionalities require:1. One `EstimatedDeliveryDate` object for one prediction result.2. Maximum 5 `EstimatedDeliveryDate` objects are allowed.3. API call will fail if any of the requests `EstimatedDeliveryDate` objects do not meet the specification requirement. + */ + public async predictBatch( + body: PredictBatchRequest, + headers?: { [key: string]: any }, + ): Promise { + return this.request.makeRequest({ + url: `/tracking/2025-01/estimated-delivery-date/predict-batch`, + method: "POST", + body, + headers, + request_legacy_tag: "", + response_legacy_tag: "", + is_paging: false, + }); + } +} diff --git a/src/api/Tracking.ts b/src/api/Tracking.ts new file mode 100644 index 0000000..ff9248a --- /dev/null +++ b/src/api/Tracking.ts @@ -0,0 +1,182 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { Request } from "../lib/request"; +import { AftershipError, AfterShipErrorCodes } from "../error"; +import { GetTrackingByIdQuery } from "../model/GetTrackingByIdQuery"; +import { GetTrackingByIdResponse } from "../model/GetTrackingByIdResponse"; +import { UpdateTrackingByIdRequest } from "../model/UpdateTrackingByIdRequest"; +import { UpdateTrackingByIdResponse } from "../model/UpdateTrackingByIdResponse"; +import { RetrackTrackingByIdResponse } from "../model/RetrackTrackingByIdResponse"; +import { MarkTrackingCompletedByIdRequest } from "../model/MarkTrackingCompletedByIdRequest"; +import { MarkTrackingCompletedByIdResponse } from "../model/MarkTrackingCompletedByIdResponse"; +import { GetTrackingsQuery } from "../model/GetTrackingsQuery"; +import { GetTrackingsResponse } from "../model/GetTrackingsResponse"; +import { CreateTrackingRequest } from "../model/CreateTrackingRequest"; +import { CreateTrackingResponse } from "../model/CreateTrackingResponse"; +import { DeleteTrackingByIdResponse } from "../model/DeleteTrackingByIdResponse"; + +export class TrackingApi { + private readonly request: Request; + + constructor(request: Request) { + this.request = request; + } + + /** + * Get tracking results of a single tracking. + */ + public async getTrackingById( + id: string, + query?: GetTrackingByIdQuery, + headers?: { [key: string]: any }, + ): Promise { + if (!id) { + throw new AftershipError( + "Invalid params: id", + AfterShipErrorCodes.VALUE_INVALID, + ); + } + + return this.request.makeRequest({ + url: `/tracking/2025-01/trackings/${id}`, + method: "GET", + query, + headers, + request_legacy_tag: "", + response_legacy_tag: "", + is_paging: false, + }); + } + /** + * Update a tracking. + */ + public async updateTrackingById( + id: string, + body: UpdateTrackingByIdRequest, + headers?: { [key: string]: any }, + ): Promise { + if (!id) { + throw new AftershipError( + "Invalid params: id", + AfterShipErrorCodes.VALUE_INVALID, + ); + } + + return this.request.makeRequest({ + url: `/tracking/2025-01/trackings/${id}`, + method: "PUT", + body, + headers, + request_legacy_tag: "", + response_legacy_tag: "", + is_paging: false, + }); + } + /** + * Retrack an expired tracking. Max 3 times per tracking. + */ + public async retrackTrackingById( + id: string, + headers?: { [key: string]: any }, + ): Promise { + if (!id) { + throw new AftershipError( + "Invalid params: id", + AfterShipErrorCodes.VALUE_INVALID, + ); + } + + return this.request.makeRequest({ + url: `/tracking/2025-01/trackings/${id}/retrack`, + method: "POST", + headers, + request_legacy_tag: "", + response_legacy_tag: "", + is_paging: false, + }); + } + /** + * Mark a tracking as completed. The tracking won't auto update until retrack it. + */ + public async markTrackingCompletedById( + id: string, + body: MarkTrackingCompletedByIdRequest, + headers?: { [key: string]: any }, + ): Promise { + if (!id) { + throw new AftershipError( + "Invalid params: id", + AfterShipErrorCodes.VALUE_INVALID, + ); + } + + return this.request.makeRequest({ + url: `/tracking/2025-01/trackings/${id}/mark-as-completed`, + method: "POST", + body, + headers, + request_legacy_tag: "", + response_legacy_tag: "", + is_paging: false, + }); + } + /** + * Get tracking results of multiple trackings.<div style="visibility:hidden; height: 0"></div> + */ + public async getTrackings( + query?: GetTrackingsQuery, + headers?: { [key: string]: any }, + ): Promise { + return this.request.makeRequest({ + url: `/tracking/2025-01/trackings`, + method: "GET", + query, + headers, + request_legacy_tag: "", + response_legacy_tag: "trackings", + is_paging: true, + }); + } + /** + * Create a tracking.<div style="visibility:hidden; height: 0"></div> + */ + public async createTracking( + body: CreateTrackingRequest, + headers?: { [key: string]: any }, + ): Promise { + return this.request.makeRequest({ + url: `/tracking/2025-01/trackings`, + method: "POST", + body, + headers, + request_legacy_tag: "", + response_legacy_tag: "", + is_paging: false, + }); + } + /** + * Delete a tracking. + */ + public async deleteTrackingById( + id: string, + headers?: { [key: string]: any }, + ): Promise { + if (!id) { + throw new AftershipError( + "Invalid params: id", + AfterShipErrorCodes.VALUE_INVALID, + ); + } + + return this.request.makeRequest({ + url: `/tracking/2025-01/trackings/${id}`, + method: "DELETE", + headers, + request_legacy_tag: "", + response_legacy_tag: "", + is_paging: false, + }); + } +} diff --git a/src/error/code.ts b/src/error/code.ts new file mode 100644 index 0000000..6d4909b --- /dev/null +++ b/src/error/code.ts @@ -0,0 +1,32 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +export enum AfterShipErrorCodes { + INVALID_API_KEY = "INVALID_API_KEY", + INVALID_OPTION = "INVALID_OPTION", + RATE_LIMIT_EXCEED = "RATE_LIMIT_EXCEED", + TIMED_OUT = "TIMED_OUT", + INVALID_REQUEST = "INVALID_REQUEST", + INVALID_JSON = "INVALID_JSON", + TRACKING_ALREADY_EXIST = "TRACKING_ALREADY_EXIST", + TRACKING_DOES_NOT_EXIST = "TRACKING_DOES_NOT_EXIST", + TRACKING_NUMBER_INVALID = "TRACKING_NUMBER_INVALID", + TRACKING_REQUIRED = "TRACKING_REQUIRED", + TRACKING_NUMBER_REQUIRED = "TRACKING_NUMBER_REQUIRED", + VALUE_INVALID = "VALUE_INVALID", + VALUE_REQUIRED = "VALUE_REQUIRED", + SLUG_INVALID = "SLUG_INVALID", + MISSING_OR_INVALID_REQUIRED_FIELD = "MISSING_OR_INVALID_REQUIRED_FIELD", + BAD_COURIER = "BAD_COURIER", + INACTIVE_RETRACK_NOT_ALLOWED = "INACTIVE_RETRACK_NOT_ALLOWED", + NOTIFICATION_REUQIRED = "NOTIFICATION_REUQIRED", + ID_INVALID = "ID_INVALID", + RETRACK_ONCE_ALLOWED = "RETRACK_ONCE_ALLOWED", + TRACKING_NUMBER_FORMAT_INVALID = "TRACKING_NUMBER_FORMAT_INVALID", + API_KEY_INVALID = "API_KEY_INVALID", + REQUEST_NOT_ALLOWED = "REQUEST_NOT_ALLOWED", + NOT_FOUND = "NOT_FOUND", + TOO_MANY_REQUEST = "TOO_MANY_REQUEST", + INTERNAL_ERROR = "INTERNAL_ERROR", +} diff --git a/src/error/index.ts b/src/error/index.ts new file mode 100644 index 0000000..84f45a6 --- /dev/null +++ b/src/error/index.ts @@ -0,0 +1,34 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { AfterShipErrorCodes } from "./code"; + +export class AftershipError extends Error { + public readonly meta_code: number | null; + public readonly message: string; + public readonly code: AfterShipErrorCodes | null; + public readonly status_code: string | null; + public readonly response_body: any | null; + public readonly response_headers: any | null; + + constructor( + message: string, + code: AfterShipErrorCodes, + meta_code?: number, + status_code?: string, + response_body?: any, + response_headers?: any, + ) { + super(message); + this.message = message; + this.code = code; + this.meta_code = meta_code || null; + this.status_code = status_code || null; + this.response_body = response_body || null; + this.response_headers = response_headers || null; + } +} + +export * from "./code"; +export * from "./meta_code"; diff --git a/src/error/meta_code.ts b/src/error/meta_code.ts new file mode 100644 index 0000000..f57c9f9 --- /dev/null +++ b/src/error/meta_code.ts @@ -0,0 +1,33 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { AfterShipErrorCodes } from "./code"; + +export const AfterShipMetaCodeMap: { [key: string]: AfterShipErrorCodes } = { + "400": AfterShipErrorCodes.INVALID_REQUEST, + "4001": AfterShipErrorCodes.INVALID_JSON, + "4003": AfterShipErrorCodes.TRACKING_ALREADY_EXIST, + "4004": AfterShipErrorCodes.TRACKING_DOES_NOT_EXIST, + "4005": AfterShipErrorCodes.TRACKING_NUMBER_INVALID, + "4006": AfterShipErrorCodes.TRACKING_REQUIRED, + "4007": AfterShipErrorCodes.TRACKING_NUMBER_REQUIRED, + "4008": AfterShipErrorCodes.VALUE_INVALID, + "4009": AfterShipErrorCodes.VALUE_REQUIRED, + "4010": AfterShipErrorCodes.SLUG_INVALID, + "4011": AfterShipErrorCodes.MISSING_OR_INVALID_REQUIRED_FIELD, + "4012": AfterShipErrorCodes.BAD_COURIER, + "4013": AfterShipErrorCodes.INACTIVE_RETRACK_NOT_ALLOWED, + "4014": AfterShipErrorCodes.NOTIFICATION_REUQIRED, + "4015": AfterShipErrorCodes.ID_INVALID, + "4016": AfterShipErrorCodes.RETRACK_ONCE_ALLOWED, + "4017": AfterShipErrorCodes.TRACKING_NUMBER_FORMAT_INVALID, + "401": AfterShipErrorCodes.API_KEY_INVALID, + "403": AfterShipErrorCodes.REQUEST_NOT_ALLOWED, + "404": AfterShipErrorCodes.NOT_FOUND, + "429": AfterShipErrorCodes.TOO_MANY_REQUEST, + "500": AfterShipErrorCodes.INTERNAL_ERROR, + "502": AfterShipErrorCodes.INTERNAL_ERROR, + "503": AfterShipErrorCodes.INTERNAL_ERROR, + "504": AfterShipErrorCodes.INTERNAL_ERROR, +}; diff --git a/src/lib/authentication.ts b/src/lib/authentication.ts new file mode 100644 index 0000000..d073580 --- /dev/null +++ b/src/lib/authentication.ts @@ -0,0 +1,127 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import crypto from "crypto"; +import querystring from "querystring"; + +const SEPERATOR = "\n"; + +export enum AuthType { + API_KEY = "API_KEY", + AES = "AES", + RSA = "RSA", +} + +interface SignParams { + url: string; + method: string; + body?: string; + content_type?: string; + date: string; + headers: { [key: string]: any }; + query?: any; + private_key?: string; + auth_type: string; +} + +export class Authentication { + public static sign(params: SignParams): string { + const canonicalized_headers = this.canonicalizedHeaders(params.headers); + const canonicalized_resource = this.canonicalizedResource( + params.url, + params.query, + ); + const sign_message = this.signMessage( + params.method, + params.date, + canonicalized_headers, + canonicalized_resource, + params.body, + params.content_type, + ); + if (params.auth_type === AuthType.AES) { + return this.signAES(sign_message, params.private_key); + } else if (params.auth_type === AuthType.RSA) { + return this.signRSA(sign_message, params.private_key); + } + return ""; + } + + private static signAES(message: any, private_key: string = ""): string { + const hmac = crypto.createHmac("sha256", private_key); + hmac.update(message); + + const signature = hmac.digest("base64"); + return signature; + } + + private static signRSA(message: any, private_key: string = ""): string { + const signer = crypto.createSign("RSA-SHA256"); + signer.update(message); + + const signature = signer.sign({ + key: private_key, + padding: crypto.constants.RSA_PKCS1_PSS_PADDING, + saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST, + }); + + return signature.toString("base64"); + } + + public static signMessage( + method: string, + date: string, + canonicalized_headers: string, + canonicalized_resource: string, + body?: string, + content_type?: string, + ): string { + let result: string = method + SEPERATOR; + let md5_body = ""; + let _content_type = content_type; + if (body === undefined || body === null || body.length === 0) { + _content_type = ""; + } else { + const md5 = crypto.createHash("md5"); + md5_body = md5.update(body).digest("hex").toUpperCase(); + } + result += md5_body + SEPERATOR; + result += _content_type + SEPERATOR; + result += date + SEPERATOR; + result += canonicalized_headers + SEPERATOR; + result += canonicalized_resource; + return result; + } + + private static canonicalizedHeaders(headers: { [key: string]: any }): string { + const concatenate_headers: string[] = []; + const all_header_keys = Object.keys(headers).sort(); + for (const k of all_header_keys) { + if (k.startsWith("as")) { + const header_value = headers[k]; + concatenate_headers.push( + `${k.trim()}:${header_value ? header_value.toString().trim() : ""}`, + ); + } + } + return concatenate_headers.join("\n"); + } + + private static canonicalizedResource(url: string, query: any): string { + if (query) { + const query_keys = Object.keys(query).sort(); + const concatenate_querys: string[] = []; + if (query_keys.length) { + for (const k of query_keys) { + let qeury_value = query[k]; + qeury_value = qeury_value ? qeury_value.toString().trim() : ""; + qeury_value = querystring.escape(qeury_value); + concatenate_querys.push(`${k.trim()}=${qeury_value}`); + } + } + return `${url}?${concatenate_querys.join("&")}`; + } + return url; + } +} diff --git a/src/lib/rate_limit.ts b/src/lib/rate_limit.ts new file mode 100644 index 0000000..00df4f9 --- /dev/null +++ b/src/lib/rate_limit.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +interface _RateLimit { + x_ratelimit_reset: string; + x_ratelimit_limit: string; + x_ratelimit_remaining: string; +} + +export class RateLimit { + protected _ratelimit?: _RateLimit; + + set ratelimit(r: _RateLimit) { + this._ratelimit = r; + } + + public isExceeded(): boolean { + if (!this._ratelimit) { + return false; + } + return ( + this._ratelimit.x_ratelimit_remaining === "0" && + this._ratelimit.x_ratelimit_reset >= new Date().valueOf().toString() + ); + } +} diff --git a/src/lib/request.ts b/src/lib/request.ts new file mode 100644 index 0000000..2d63075 --- /dev/null +++ b/src/lib/request.ts @@ -0,0 +1,197 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import axios, { AxiosRequestConfig } from "axios"; +import { AuthType, Authentication } from "./authentication"; +import { AftershipError } from "../error"; +import { AfterShipErrorCodes } from "../error/code"; +import { AfterShipMetaCodeMap } from "../error/meta_code"; +import { Proxy } from "../utils/parse_proxy"; + +export const DEFAULT_DOMAIN = "https://api.aftership.com"; +export const DEFAULT_TIMEOUT = 10000; +export const DEFAULT_MAX_RETRY = 3; +export const MAX_MAX_RETRY = 10; +export const MIN_MAX_RETRY = 0; +export const DEFAULT_USER_AGENT = + "tracking-sdk-nodejs/12.0.0 (https://www.aftership.com) axios/1.7.2"; + +type ResponseData = { + meta: { + code: number; + message: number; + type: string; + }; + data: any; +}; + +export interface RequestConfig { + url: string; + method: string; + body?: any; + query?: any; + headers?: { [key: string]: any }; + request_legacy_tag: string; + response_legacy_tag: string; + is_paging: boolean; +} + +export interface RequestOptions { + auth_type: string; + api_key?: string; + api_secret?: string; + domain: string; + max_retry: number; + timeout: number; + user_agent?: string; + proxy?: Proxy; +} + +export class Request { + private readonly options: RequestOptions; + + private readonly DELAY_BASE = 3000; + + constructor(options: RequestOptions) { + this.options = options; + } + + private getHeaders(config: RequestConfig): { [key: string]: any } { + const content_type = "application/json"; + const headers: { [key: string]: any } = { + "as-api-key": this.options.api_key, + "Content-Type": content_type, + "User-Agent": this.options.user_agent || DEFAULT_USER_AGENT, + "aftership-client": DEFAULT_USER_AGENT, + ...config.headers, + }; + + if ( + this.options.auth_type === AuthType.AES || + this.options.auth_type === AuthType.RSA + ) { + const header_keys = + this.options.auth_type === AuthType.AES + ? "as-signature-hmac-sha256" + : "as-signature-rsa-sha256"; + const date_now = new Date().toUTCString(); + headers[header_keys] = Authentication.sign({ + method: config.method, + url: config.url, + body: JSON.stringify(config.body), + content_type, + query: config.query, + auth_type: this.options.auth_type, + date: date_now, + private_key: this.options.api_secret, + headers, + }); + headers["date"] = date_now; + } + return headers; + } + + private shouldRetry(error: any): boolean { + if (error.code === "ECONNABORTED") { + return true; + } + if (error.response && error.response.status >= 500) { + return true; + } + return false; + } + + private delayWithJitter(retry_attempt: number): Promise { + const delay = (this.DELAY_BASE * 2) ^ (retry_attempt - 1); + + // jitter between -halfOfTheDelay seconds and halfOfTheDelay seconds + const jitter = delay * (Math.random() - 0.5); + + // to ensure the delay would not be less than 1 second even if the delayBase is smaller than 2 + const totalDelay = Math.max(1, delay + jitter); + + return new Promise((resolve) => { + setTimeout(resolve, totalDelay); + }); + } + + private async withRetry( + requestConfig: AxiosRequestConfig, + retry: number = 0, + ): Promise { + try { + const response = await axios(requestConfig); + return response.data; + } catch (error: any) { + if (this.shouldRetry(error) && retry < this.options.max_retry) { + await this.delayWithJitter(retry); + retry++; + return this.withRetry(requestConfig, retry); + } + throw error; + } + } + + public async makeRequest(config: RequestConfig): Promise { + config.body = this.handleRequestData( + config.request_legacy_tag, + config.body, + ); + const headers = this.getHeaders(config); + try { + const response = await this.withRetry({ + url: config.url, + method: config.method, + headers, + params: config.query, + validateStatus: (status) => status >= 200 && status < 400, + baseURL: this.options.domain, + data: config.body, + timeout: this.options.timeout, + proxy: this.options.proxy, + }); + return response.data; + } catch (error) { + throw this.handleError(error); + } + } + + private handleError(e: any): Error { + if (e.code === "ECONNABORTED") { + return new AftershipError( + "Request timed out.", + AfterShipErrorCodes.TIMED_OUT, + ); + } else if (e instanceof AftershipError) { + return e; + } else if (e.response && e.response.status >= 500) { + return new AftershipError( + e.response?.data?.meta?.message || e.message, + AfterShipErrorCodes.INTERNAL_ERROR, + e.response.status, + e.response.status, + JSON.stringify(e.response?.data), + e.response.headers, + ); + } else { + return new AftershipError( + e.response?.data?.meta?.message, + AfterShipMetaCodeMap[e.response?.data?.meta?.code?.toString()], + e.response?.data?.meta?.code, + e.response?.status, + JSON.stringify(e.response?.data), + e.response.headers, + ); + } + } + + private handleRequestData(request_legacy_tag: string, data: any): any { + if (!request_legacy_tag) { + return data; + } + return { + [request_legacy_tag]: data, + }; + } +} diff --git a/src/model/AdditionalFieldsV1.ts b/src/model/AdditionalFieldsV1.ts new file mode 100644 index 0000000..44b1037 --- /dev/null +++ b/src/model/AdditionalFieldsV1.ts @@ -0,0 +1,14 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export enum AdditionalFieldsV1 { + "tracking_account_number" = "tracking_account_number", + "tracking_postal_code" = "tracking_postal_code", + "tracking_ship_date" = "tracking_ship_date", + "tracking_key" = "tracking_key", + "tracking_origin_country_region" = "tracking_origin_country_region", + "tracking_destination_country_region" = "tracking_destination_country_region", + "tracking_state" = "tracking_state", +} diff --git a/src/model/AftershipEstimatedDeliveryDateCreateTrackingResponse.ts b/src/model/AftershipEstimatedDeliveryDateCreateTrackingResponse.ts new file mode 100644 index 0000000..02bcd54 --- /dev/null +++ b/src/model/AftershipEstimatedDeliveryDateCreateTrackingResponse.ts @@ -0,0 +1,23 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface AftershipEstimatedDeliveryDateCreateTrackingResponse { + /** + * The estimated arrival date of the shipment. + */ + estimated_delivery_date?: string; + /** + * Indicates the confidence level and associated reason for an AI EDD prediction request. For a comprehensive list of confidence codes, refer to . + */ + confidence_code?: number; + /** + * Earliest estimated delivery date of the shipment. + */ + estimated_delivery_date_min?: string; + /** + * Latest estimated delivery date of the shipment. + */ + estimated_delivery_date_max?: string; +} diff --git a/src/model/AftershipEstimatedDeliveryDateDeleteTrackingByIdResponse.ts b/src/model/AftershipEstimatedDeliveryDateDeleteTrackingByIdResponse.ts new file mode 100644 index 0000000..c865a51 --- /dev/null +++ b/src/model/AftershipEstimatedDeliveryDateDeleteTrackingByIdResponse.ts @@ -0,0 +1,23 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface AftershipEstimatedDeliveryDateDeleteTrackingByIdResponse { + /** + * The estimated arrival date of the shipment. + */ + estimated_delivery_date?: string; + /** + * Indicates the confidence level and associated reason for an AI EDD prediction request. For a comprehensive list of confidence codes, refer to . + */ + confidence_code?: number; + /** + * Earliest estimated delivery date of the shipment. + */ + estimated_delivery_date_min?: string; + /** + * Latest estimated delivery date of the shipment. + */ + estimated_delivery_date_max?: string; +} diff --git a/src/model/AftershipEstimatedDeliveryDateGetTrackingByIdResponse.ts b/src/model/AftershipEstimatedDeliveryDateGetTrackingByIdResponse.ts new file mode 100644 index 0000000..d4c62df --- /dev/null +++ b/src/model/AftershipEstimatedDeliveryDateGetTrackingByIdResponse.ts @@ -0,0 +1,23 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface AftershipEstimatedDeliveryDateGetTrackingByIdResponse { + /** + * The estimated arrival date of the shipment. + */ + estimated_delivery_date?: string; + /** + * Indicates the confidence level and associated reason for an AI EDD prediction request. For a comprehensive list of confidence codes, refer to . + */ + confidence_code?: number; + /** + * Earliest estimated delivery date of the shipment. + */ + estimated_delivery_date_min?: string; + /** + * Latest estimated delivery date of the shipment. + */ + estimated_delivery_date_max?: string; +} diff --git a/src/model/AftershipEstimatedDeliveryDateMarkTrackingCompletedByIdResponse.ts b/src/model/AftershipEstimatedDeliveryDateMarkTrackingCompletedByIdResponse.ts new file mode 100644 index 0000000..5441706 --- /dev/null +++ b/src/model/AftershipEstimatedDeliveryDateMarkTrackingCompletedByIdResponse.ts @@ -0,0 +1,23 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface AftershipEstimatedDeliveryDateMarkTrackingCompletedByIdResponse { + /** + * The estimated arrival date of the shipment. + */ + estimated_delivery_date?: string; + /** + * Indicates the confidence level and associated reason for an AI EDD prediction request. For a comprehensive list of confidence codes, refer to . + */ + confidence_code?: number; + /** + * Earliest estimated delivery date of the shipment. + */ + estimated_delivery_date_min?: string; + /** + * Latest estimated delivery date of the shipment. + */ + estimated_delivery_date_max?: string; +} diff --git a/src/model/AftershipEstimatedDeliveryDateRetrackTrackingByIdResponse.ts b/src/model/AftershipEstimatedDeliveryDateRetrackTrackingByIdResponse.ts new file mode 100644 index 0000000..6b1325a --- /dev/null +++ b/src/model/AftershipEstimatedDeliveryDateRetrackTrackingByIdResponse.ts @@ -0,0 +1,23 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface AftershipEstimatedDeliveryDateRetrackTrackingByIdResponse { + /** + * The estimated arrival date of the shipment. + */ + estimated_delivery_date?: string; + /** + * Indicates the confidence level and associated reason for an AI EDD prediction request. For a comprehensive list of confidence codes, refer to . + */ + confidence_code?: number; + /** + * Earliest estimated delivery date of the shipment. + */ + estimated_delivery_date_min?: string; + /** + * Latest estimated delivery date of the shipment. + */ + estimated_delivery_date_max?: string; +} diff --git a/src/model/AftershipEstimatedDeliveryDateTracking.ts b/src/model/AftershipEstimatedDeliveryDateTracking.ts new file mode 100644 index 0000000..7c5678f --- /dev/null +++ b/src/model/AftershipEstimatedDeliveryDateTracking.ts @@ -0,0 +1,23 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface AftershipEstimatedDeliveryDateTracking { + /** + * The estimated arrival date of the shipment. + */ + estimated_delivery_date?: string; + /** + * Indicates the confidence level and associated reason for an AI EDD prediction request. For a comprehensive list of confidence codes, refer to . + */ + confidence_code?: number; + /** + * Earliest estimated delivery date of the shipment. + */ + estimated_delivery_date_min?: string; + /** + * Latest estimated delivery date of the shipment. + */ + estimated_delivery_date_max?: string; +} diff --git a/src/model/AftershipEstimatedDeliveryDateUpdateTrackingByIdResponse.ts b/src/model/AftershipEstimatedDeliveryDateUpdateTrackingByIdResponse.ts new file mode 100644 index 0000000..cbae590 --- /dev/null +++ b/src/model/AftershipEstimatedDeliveryDateUpdateTrackingByIdResponse.ts @@ -0,0 +1,23 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface AftershipEstimatedDeliveryDateUpdateTrackingByIdResponse { + /** + * The estimated arrival date of the shipment. + */ + estimated_delivery_date?: string; + /** + * Indicates the confidence level and associated reason for an AI EDD prediction request. For a comprehensive list of confidence codes, refer to . + */ + confidence_code?: number; + /** + * Earliest estimated delivery date of the shipment. + */ + estimated_delivery_date_min?: string; + /** + * Latest estimated delivery date of the shipment. + */ + estimated_delivery_date_max?: string; +} diff --git a/src/model/CarbonEmissionsCreateTrackingResponse.ts b/src/model/CarbonEmissionsCreateTrackingResponse.ts new file mode 100644 index 0000000..9ece8a5 --- /dev/null +++ b/src/model/CarbonEmissionsCreateTrackingResponse.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CarbonEmissionsCreateTrackingResponse { + /** + * The unit in which the value field is expressed. Allowed values: kg + */ + unit?: string; + /** + * The total amount of carbon emissions + */ + value?: number; +} diff --git a/src/model/CarbonEmissionsDeleteTrackingByIdResponse.ts b/src/model/CarbonEmissionsDeleteTrackingByIdResponse.ts new file mode 100644 index 0000000..c87f840 --- /dev/null +++ b/src/model/CarbonEmissionsDeleteTrackingByIdResponse.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CarbonEmissionsDeleteTrackingByIdResponse { + /** + * The unit in which the value field is expressed. Allowed values: kg + */ + unit?: string; + /** + * The total amount of carbon emissions + */ + value?: number; +} diff --git a/src/model/CarbonEmissionsGetTrackingByIdResponse.ts b/src/model/CarbonEmissionsGetTrackingByIdResponse.ts new file mode 100644 index 0000000..e98698a --- /dev/null +++ b/src/model/CarbonEmissionsGetTrackingByIdResponse.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CarbonEmissionsGetTrackingByIdResponse { + /** + * The unit in which the value field is expressed. Allowed values: kg + */ + unit?: string; + /** + * The total amount of carbon emissions + */ + value?: number; +} diff --git a/src/model/CarbonEmissionsMarkTrackingCompletedByIdResponse.ts b/src/model/CarbonEmissionsMarkTrackingCompletedByIdResponse.ts new file mode 100644 index 0000000..d9ef9f3 --- /dev/null +++ b/src/model/CarbonEmissionsMarkTrackingCompletedByIdResponse.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CarbonEmissionsMarkTrackingCompletedByIdResponse { + /** + * The unit in which the value field is expressed. Allowed values: kg + */ + unit?: string; + /** + * The total amount of carbon emissions + */ + value?: number; +} diff --git a/src/model/CarbonEmissionsRetrackTrackingByIdResponse.ts b/src/model/CarbonEmissionsRetrackTrackingByIdResponse.ts new file mode 100644 index 0000000..479442e --- /dev/null +++ b/src/model/CarbonEmissionsRetrackTrackingByIdResponse.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CarbonEmissionsRetrackTrackingByIdResponse { + /** + * The unit in which the value field is expressed. Allowed values: kg + */ + unit?: string; + /** + * The total amount of carbon emissions + */ + value?: number; +} diff --git a/src/model/CarbonEmissionsTracking.ts b/src/model/CarbonEmissionsTracking.ts new file mode 100644 index 0000000..2439d55 --- /dev/null +++ b/src/model/CarbonEmissionsTracking.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CarbonEmissionsTracking { + /** + * The unit in which the value field is expressed. Allowed values: kg + */ + unit?: string; + /** + * The total amount of carbon emissions + */ + value?: number; +} diff --git a/src/model/CarbonEmissionsUpdateTrackingByIdResponse.ts b/src/model/CarbonEmissionsUpdateTrackingByIdResponse.ts new file mode 100644 index 0000000..b829743 --- /dev/null +++ b/src/model/CarbonEmissionsUpdateTrackingByIdResponse.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CarbonEmissionsUpdateTrackingByIdResponse { + /** + * The unit in which the value field is expressed. Allowed values: kg + */ + unit?: string; + /** + * The total amount of carbon emissions + */ + value?: number; +} diff --git a/src/model/Checkpoint.ts b/src/model/Checkpoint.ts new file mode 100644 index 0000000..96ee60a --- /dev/null +++ b/src/model/Checkpoint.ts @@ -0,0 +1,78 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { CoordinateCheckpoint } from "./CoordinateCheckpoint"; +import { TagV1 } from "./TagV1"; +import { EventsCheckpoint } from "./EventsCheckpoint"; + +export interface Checkpoint { + /** + * The date and time of the checkpoint event was added to AfterShip. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0. + */ + created_at?: string; + /** + * The unique code of courier for this checkpoint. Get courier slug + */ + slug?: string; + /** + * The date and time of the checkpoint event, provided by the carrier. It uses the timezone of the checkpoint. The format may differ depending on how the carrier provides it:- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + checkpoint_time?: string; + /** + * Location info provided by carrier + */ + location?: string; + /** + * City info provided by carrier + */ + city?: string; + /** + * State info provided by carrier + */ + state?: string; + /** + * Postal code info provided by carrier + */ + zip?: string; + /** + * The latitude and longitude coordinates indicate the precise location of the shipments that are currently in transit. + */ + coordinate?: CoordinateCheckpoint; + /** + * Country/Region ISO Alpha-3 (three letters) of the checkpoint + */ + country_region?: string; + /** + * Country/Region name of the checkpoint, may also contain other location info. + */ + country_region_name?: string; + /** + * Checkpoint message + */ + message?: string; + /** + * Current status of tracking. ( + */ + tag?: TagV1; + /** + * Current subtag of checkpoint. ( + */ + subtag?: string; + /** + * Normalized checkpoint message. ( + */ + subtag_message?: string; + /** + * Checkpoint raw status provided by courier + */ + raw_tag?: string; + /** + * The array provides details about specific event(s) that occurred to a shipment, such as "returned_to_sender". You can find the full list of events and reasons </span>- The events' value for the same checkpoint message is subject to change as we consistently strive to enhance the performance of this feature. + */ + events?: EventsCheckpoint[]; + /** + * The source of the checkpoint, which can either be from the carrier or when the user marks the tracking as completed. + */ + source?: string; +} diff --git a/src/model/CoordinateCheckpoint.ts b/src/model/CoordinateCheckpoint.ts new file mode 100644 index 0000000..a5debdd --- /dev/null +++ b/src/model/CoordinateCheckpoint.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CoordinateCheckpoint { + /** + * Represents the latitude. + */ + latitude?: number; + /** + * Represents the longitude. + */ + longitude?: number; +} diff --git a/src/model/Courier.ts b/src/model/Courier.ts new file mode 100644 index 0000000..7199aef --- /dev/null +++ b/src/model/Courier.ts @@ -0,0 +1,47 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface Courier { + /** + * Unique code of courier. Get the slugs from . + */ + slug?: string; + /** + * Name of courier + */ + name?: string; + /** + * Contact phone number of courier + */ + phone?: string; + /** + * Other name of courier + */ + other_name?: string; + /** + * Website link of courier + */ + web_url?: string; + /** + * The extra fields need for tracking, such as `tracking_account_number`, `tracking_postal_code`, `tracking_ship_date`, `tracking_key`, `tracking_destination_country_region` + */ + required_fields?: string[]; + /** + * The extra fields which are optional for tracking. Basically it's the same as required_fields, but the difference is that only some of the tracking numbers require these fields. + */ + optional_fields?: string[]; + /** + * Default language of tracking results + */ + default_language?: string; + /** + * Other supported languages + */ + support_languages?: string[]; + /** + * Country/Region code (ISO Alpha-3) where the courier provides service + */ + service_from_country_regions?: string[]; +} diff --git a/src/model/CourierEstimatedDeliveryDateCreateTrackingResponse.ts b/src/model/CourierEstimatedDeliveryDateCreateTrackingResponse.ts new file mode 100644 index 0000000..7735795 --- /dev/null +++ b/src/model/CourierEstimatedDeliveryDateCreateTrackingResponse.ts @@ -0,0 +1,19 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CourierEstimatedDeliveryDateCreateTrackingResponse { + /** + * The estimated arrival date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date?: string; + /** + * The earliest estimated delivery date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date_min?: string; + /** + * The Latest estimated delivery date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date_max?: string; +} diff --git a/src/model/CourierEstimatedDeliveryDateDeleteTrackingByIdResponse.ts b/src/model/CourierEstimatedDeliveryDateDeleteTrackingByIdResponse.ts new file mode 100644 index 0000000..61c5b22 --- /dev/null +++ b/src/model/CourierEstimatedDeliveryDateDeleteTrackingByIdResponse.ts @@ -0,0 +1,19 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CourierEstimatedDeliveryDateDeleteTrackingByIdResponse { + /** + * The estimated arrival date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date?: string; + /** + * The earliest estimated delivery date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date_min?: string; + /** + * The Latest estimated delivery date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date_max?: string; +} diff --git a/src/model/CourierEstimatedDeliveryDateGetTrackingByIdResponse.ts b/src/model/CourierEstimatedDeliveryDateGetTrackingByIdResponse.ts new file mode 100644 index 0000000..fdf5bc8 --- /dev/null +++ b/src/model/CourierEstimatedDeliveryDateGetTrackingByIdResponse.ts @@ -0,0 +1,19 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CourierEstimatedDeliveryDateGetTrackingByIdResponse { + /** + * The estimated arrival date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date?: string; + /** + * The earliest estimated delivery date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date_min?: string; + /** + * The Latest estimated delivery date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date_max?: string; +} diff --git a/src/model/CourierEstimatedDeliveryDateMarkTrackingCompletedByIdResponse.ts b/src/model/CourierEstimatedDeliveryDateMarkTrackingCompletedByIdResponse.ts new file mode 100644 index 0000000..ba59fce --- /dev/null +++ b/src/model/CourierEstimatedDeliveryDateMarkTrackingCompletedByIdResponse.ts @@ -0,0 +1,19 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CourierEstimatedDeliveryDateMarkTrackingCompletedByIdResponse { + /** + * The estimated arrival date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date?: string; + /** + * The earliest estimated delivery date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date_min?: string; + /** + * The Latest estimated delivery date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date_max?: string; +} diff --git a/src/model/CourierEstimatedDeliveryDateRetrackTrackingByIdResponse.ts b/src/model/CourierEstimatedDeliveryDateRetrackTrackingByIdResponse.ts new file mode 100644 index 0000000..e70672e --- /dev/null +++ b/src/model/CourierEstimatedDeliveryDateRetrackTrackingByIdResponse.ts @@ -0,0 +1,19 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CourierEstimatedDeliveryDateRetrackTrackingByIdResponse { + /** + * The estimated arrival date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date?: string; + /** + * The earliest estimated delivery date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date_min?: string; + /** + * The Latest estimated delivery date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date_max?: string; +} diff --git a/src/model/CourierEstimatedDeliveryDateTracking.ts b/src/model/CourierEstimatedDeliveryDateTracking.ts new file mode 100644 index 0000000..344883f --- /dev/null +++ b/src/model/CourierEstimatedDeliveryDateTracking.ts @@ -0,0 +1,19 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CourierEstimatedDeliveryDateTracking { + /** + * The estimated arrival date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date?: string; + /** + * The earliest estimated delivery date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date_min?: string; + /** + * The Latest estimated delivery date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date_max?: string; +} diff --git a/src/model/CourierEstimatedDeliveryDateUpdateTrackingByIdResponse.ts b/src/model/CourierEstimatedDeliveryDateUpdateTrackingByIdResponse.ts new file mode 100644 index 0000000..c0aaae1 --- /dev/null +++ b/src/model/CourierEstimatedDeliveryDateUpdateTrackingByIdResponse.ts @@ -0,0 +1,19 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CourierEstimatedDeliveryDateUpdateTrackingByIdResponse { + /** + * The estimated arrival date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date?: string; + /** + * The earliest estimated delivery date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date_min?: string; + /** + * The Latest estimated delivery date of the shipment. It reflects the shipment recipient’s timezone and the format may vary based on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + estimated_delivery_date_max?: string; +} diff --git a/src/model/CourierResponseV1.ts b/src/model/CourierResponseV1.ts new file mode 100644 index 0000000..4eedb42 --- /dev/null +++ b/src/model/CourierResponseV1.ts @@ -0,0 +1,17 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { MetaV1 } from "./MetaV1"; +import { DataCourierResponseV1 } from "./DataCourierResponseV1"; + +export interface CourierResponseV1 { + /** + * Meta data + */ + meta: MetaV1; + /** + * + */ + data: DataCourierResponseV1; +} diff --git a/src/model/CreateTrackingRequest.ts b/src/model/CreateTrackingRequest.ts new file mode 100644 index 0000000..1d49cae --- /dev/null +++ b/src/model/CreateTrackingRequest.ts @@ -0,0 +1,166 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { SlugGroupV1 } from "./SlugGroupV1"; +import { LastMileCreateTrackingRequest } from "./LastMileCreateTrackingRequest"; +import { CustomersCreateTrackingRequest } from "./CustomersCreateTrackingRequest"; + +export interface CreateTrackingRequest { + /** + * Tracking number of a shipment.Duplicated tracking numbers, tracking numbers with invalid tracking number format will not be accepted.We only accept tracking numbers with length from 4 to 100We currently support the following characters in a tracking number:- A - Z- 0 - 9- `-` (Hyphen)- . (Period)- _ (Underscore)- / (Slash) + */ + tracking_number: string; + /** + * Unique courier code. Get courier codes . + */ + slug?: string; + /** + * By default this field shows the `tracking_number`, but you can customize it as you wish with any info (e.g. the order number). + */ + title?: string; + /** + * A globally-unique identifier for the order. + */ + order_id?: string; + /** + * The URL for the order in your system or store. + */ + order_id_path?: string; + /** + * Custom fields that accept an object with string field. In order to protect the privacy of your customers, do not include any + */ + custom_fields?: { [key: string]: any }; + /** + * The recipient’s language. If you set up AfterShip notifications in different languages, we use this to send the recipient tracking updates in their preferred language. Use an to specify the language. + */ + language?: string; + /** + * The promised delivery date of the order. It uses the formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + order_promised_delivery_date?: string; + /** + * Shipment delivery type- pickup_at_store- pickup_at_courier- door_to_door + */ + delivery_type?: string; + /** + * Shipment pickup location for receiver + */ + pickup_location?: string; + /** + * Shipment pickup note for receiver + */ + pickup_note?: string; + /** + * Additional field required by some carriers to retrieve the tracking info. The shipper’s carrier account number. Refer to our article on for more details. + */ + tracking_account_number?: string; + /** + * Additional field required by some carriers to retrieve the tracking info. A type of tracking credential required by some carriers. Refer to our article on for more details. + */ + tracking_key?: string; + /** + * The date and time when the shipment is shipped by the merchant and ready for pickup by the carrier. The field supports the following formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZThe field serves two key purposes:- Calculate processing time metrics in the Order-to-delivery Analytics dashboard. To ensure accurate analytics, it's recommended to include timezone information when configuring this value- Required by certain carriers to retrieve tracking information as an additional tracking field. + */ + tracking_ship_date?: string; + /** + * The for more details. + */ + origin_country_region?: string; + /** + * The state of the sender’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. + */ + origin_state?: string; + /** + * The city of the sender’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. + */ + origin_city?: string; + /** + * The postal of the sender’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. + */ + origin_postal_code?: string; + /** + * The sender address that the shipment is shipping from. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. + */ + origin_raw_location?: string; + /** + * The for more details. + */ + destination_country_region?: string; + /** + * The state of the recipient’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. Also the additional field required by some carriers to retrieve the tracking info. The state/province of the recipient’s address. Refer to our article on for more details. + */ + destination_state?: string; + /** + * The city of the recipient’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. + */ + destination_city?: string; + /** + * The postal of the recipient’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. Also the additional field required by some carriers to retrieve the tracking info. The postal code of the recipient’s address. Refer to our article on for more details. + */ + destination_postal_code?: string; + /** + * The shipping address that the shipment is shipping to. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. + */ + destination_raw_location?: string; + /** + * Text field for the note + */ + note?: string; + /** + * Slug group is a group of slugs which belong to same courier. For example, when you inpit "fedex-group" as slug_group, AfterShip will detect the tracking with "fedex-uk", "fedex-fims", and other slugs which belong to "fedex". It cannot be used with slug at the same time. ( + */ + slug_group?: SlugGroupV1; + /** + * Order date in YYYY-MM-DDTHH:mm:ssZ format. e.g. 2021-07-26T11:23:51-05:00 + */ + order_date?: string; + /** + * A unique, human-readable identifier for the order. + */ + order_number?: string; + /** + * The carrier service type for the shipment. If you provide info for this field, AfterShip will not update it with info from the carrier. + */ + shipment_type?: string; + /** + * Used to add tags to your shipments to help categorize and filter them easily. + */ + shipment_tags?: string[]; + /** + * If you’ve connected multiple accounts for a single carrier on AfterShip, you can now use the courier_connection_id field to tell AfterShip which carrier account you’ve used to handle a shipment so we can track it. ( + */ + courier_connection_id?: string; + /** + * (Legacy) Replaced by `origin_country_region`. Additional field required by some carriers to retrieve the tracking info. The origin country/region of the shipment. Refer to our article on for more details. + */ + tracking_origin_country_region?: string; + /** + * (Legacy) Replaced by `destination_country_region`. Additional field required by some carriers to retrieve the tracking info. The destination country/region of the shipment. Refer to our article on for more details. + */ + tracking_destination_country_region?: string; + /** + * (Legacy) Replaced by `destination_postal_code`. Additional field required by some carriers to retrieve the tracking info. The postal code of the recipient’s address. Refer to our article on for more details. + */ + tracking_postal_code?: string; + /** + * (Legacy) Replaced by `destination_state`. Additional field required by some carriers to retrieve the tracking info. The state/province of the recipient’s address. Refer to our article on for more details. + */ + tracking_state?: string; + /** + * The location_id refers to the place where you fulfilled the items. - If you provide a location_id, the system will automatically use it as the tracking's origin address. However, passing both location_id and any origin address information simultaneously is not allowed.- Please make sure you add your locations . + */ + location_id?: string; + /** + * The shipping_method string refers to the chosen method for delivering the package. Merchants typically offer various shipping methods to consumers during the checkout process, such as, Local Delivery, Free Express Worldwide Shipping, etc + */ + shipping_method?: string; + /** + * This field contains information about the last leg of the shipment, starting from the carrier who hands it over to the last-mile carrier, all the way to delivery. Once AfterShip detects that the shipment involves multiple legs and identifies the last-mile carrier, we will populate the last-mile carrier information in this object. Alternatively, the user can provide this information in this field to specify the last-mile carrier, which is helpful if AfterShip is unable to detect it automatically. + */ + last_mile?: LastMileCreateTrackingRequest; + /** + * The field contains the customer information associated with the tracking. A maximum of three customer objects are allowed. + */ + customers?: CustomersCreateTrackingRequest[]; +} diff --git a/src/model/CreateTrackingResponse.ts b/src/model/CreateTrackingResponse.ts new file mode 100644 index 0000000..0d7cc79 --- /dev/null +++ b/src/model/CreateTrackingResponse.ts @@ -0,0 +1,335 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { CourierEstimatedDeliveryDateCreateTrackingResponse } from "./CourierEstimatedDeliveryDateCreateTrackingResponse"; +import { ShipmentWeightCreateTrackingResponse } from "./ShipmentWeightCreateTrackingResponse"; +import { TagV1 } from "./TagV1"; +import { Checkpoint } from "./Checkpoint"; +import { AftershipEstimatedDeliveryDateCreateTrackingResponse } from "./AftershipEstimatedDeliveryDateCreateTrackingResponse"; +import { CustomEstimatedDeliveryDateCreateTrackingResponse } from "./CustomEstimatedDeliveryDateCreateTrackingResponse"; +import { FirstEstimatedDeliveryCreateTrackingResponse } from "./FirstEstimatedDeliveryCreateTrackingResponse"; +import { LatestEstimatedDeliveryCreateTrackingResponse } from "./LatestEstimatedDeliveryCreateTrackingResponse"; +import { CarbonEmissionsCreateTrackingResponse } from "./CarbonEmissionsCreateTrackingResponse"; +import { FirstMileCreateTrackingResponse } from "./FirstMileCreateTrackingResponse"; +import { LastMileCreateTrackingResponse } from "./LastMileCreateTrackingResponse"; +import { CustomersCreateTrackingResponse } from "./CustomersCreateTrackingResponse"; + +export interface CreateTrackingResponse { + /** + * Tracking ID. + */ + id?: string; + /** + * The length of the tracking ID has been increased from 24 characters to 32 characters. We will use the legacy_id field to store the original 24-character tracking ID to maintain compatibility with existing data. Therefore, all tracking endpoints will continue to work with the legacy_id field as before. + */ + legacy_id?: string; + /** + * The date and time the shipment was imported or added to AfterShip. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0. + */ + created_at?: string; + /** + * The date and time the shipment was updated. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0. + */ + updated_at?: string; + /** + * Tracking number. + */ + tracking_number?: string; + /** + * Unique courier code. When importing a shipment with no courier slug and the tracking number can’t be recognized, the courier will be marked as `unrecognized`. Get courier codes . + */ + slug?: string; + /** + * Whether or not AfterShip will continue tracking the shipments. Value is `false` when tag (status) is `Delivered`, `Expired`, or further updates for 30 days since last update. + */ + active?: boolean; + /** + * Custom fields that accept an object with string field. In order to protect the privacy of your customers, do not include any in custom fields. + */ + custom_fields?: { [key: string]: any }; + /** + * Total transit time in days.- For delivered shipments: Transit time (in days) = Delivered date - Pick-up date- For undelivered shipments: Transit time (in days) = Current date - Pick-up dateValue as `null` for the shipment without pick-up date. + */ + transit_time?: number; + /** + * The for the origin country/region. E.g. USA for the United States. + */ + origin_country_region?: string; + /** + * The state of the sender’s address. + */ + origin_state?: string; + /** + * The city of the sender’s address. + */ + origin_city?: string; + /** + * The postal code of the sender’s address. + */ + origin_postal_code?: string; + /** + * The sender address that the shipment is shipping from. + */ + origin_raw_location?: string; + /** + * The for the destination country/region. E.g. USA for the United States. + */ + destination_country_region?: string; + /** + * The state of the recipient’s address. + */ + destination_state?: string; + /** + * The city of the recipient’s address. + */ + destination_city?: string; + /** + * The postal code of the recipient’s address. + */ + destination_postal_code?: string; + /** + * The shipping address that the shipment is shipping to. + */ + destination_raw_location?: string; + /** + * Destination country/region of the tracking detected from the courier. ISO Alpha-3 (three letters). Value will be `null` if the courier doesn't provide the destination country. + */ + courier_destination_country_region?: string; + /** + * The field contains the estimated delivery date provided by the carrier. + */ + courier_estimated_delivery_date?: CourierEstimatedDeliveryDateCreateTrackingResponse; + /** + * Text field for the note. + */ + note?: string; + /** + * A globally-unique identifier for the order. + */ + order_id?: string; + /** + * The URL for the order in your system or store. + */ + order_id_path?: string; + /** + * The date and time the order was created in your system or store. It uses the format: `YYYY-MM-DDTHH:mm:ssZ` based on whichever timezone you provide. + */ + order_date?: string; + /** + * Number of packages under the tracking. + */ + shipment_package_count?: number; + /** + * The date and time the shipment was picked up by the carrier. It uses the timezone where the pickup occured. The format may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + shipment_pickup_date?: string; + /** + * The date and time the shipment was delivered. It uses the shipment recipient’s timezone. The format may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + shipment_delivery_date?: string; + /** + * The carrier service type for the shipment. + */ + shipment_type?: string; + /** + * The shipment_weight field represents the total weight of the shipment. In scenarios where the carrier does not provide this information, you can provide the weight to AfterShip. We will prioritize the data provided by the carrier, if available. The shipment weight will be included in the Response and accessed through the GET API, Webhook, and CSV export. It will also be displayed on the AfterShip Tracking admin. Additionally, it plays a significant role in error-free shipment handling and carbon emission calculations, ensuring accurate and informed decision-making + */ + shipment_weight?: ShipmentWeightCreateTrackingResponse; + /** + * Signed by information for delivered shipment. + */ + signed_by?: string; + /** + * Source of how this tracking is added. + */ + source?: string; + /** + * Current status of tracking. ( + */ + tag?: TagV1; + /** + * Current subtag of tracking. ( + */ + subtag?: string; + /** + * Normalized tracking message. ( + */ + subtag_message?: string; + /** + * By default this field shows the `tracking_number`, but you can customize it as you wish with any info (e.g. the order number). + */ + title?: string; + /** + * Number of attempts AfterShip tracks at courier's system. + */ + tracked_count?: number; + /** + * Indicates if the shipment is trackable till the final destination.Three possible values:- true- false- null + */ + last_mile_tracking_supported?: boolean; + /** + * The recipient’s language. If you set up AfterShip notifications in different languages, we use this to send the recipient tracking updates in their preferred language. + */ + language?: string; + /** + * Deprecated + */ + unique_token?: string; + /** + * Array of checkpoint object describes the checkpoint information. + */ + checkpoints?: Checkpoint[]; + /** + * Phone number(s) subscribed to receive sms notifications. + */ + subscribed_smses?: string[]; + /** + * Email address(es) subscribed to receive email notifications. + */ + subscribed_emails?: string[]; + /** + * Whether or not the shipment is returned to sender. Value is `true` when any of its checkpoints has subtag `Exception_010` (returning to sender) or `Exception_011` (returned to sender). Otherwise value is `false`. + */ + return_to_sender?: boolean; + /** + * The promised delivery date of the order. It uses the formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + order_promised_delivery_date?: string; + /** + * Shipment delivery type- pickup_at_store- pickup_at_courier- door_to_door + */ + delivery_type?: string; + /** + * Shipment pickup location for receiver + */ + pickup_location?: string; + /** + * Shipment pickup note for receiver + */ + pickup_note?: string; + /** + * Official tracking URL of the courier (if any). The language parameter of this link relies on the destination country/region and the language associated with the shipment, if the data regarding the destination country/region and language of the shipment is not available, AfterShip will set the language parameter of the link to "US" by default. + */ + courier_tracking_link?: string; + /** + * The date and time of the carrier’s first attempt to deliver the package to the recipient. It uses the shipment recipient’s timezone. The format may differ depending on how the carrier provides it:- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + first_attempted_at?: string; + /** + * Delivery instructions (delivery date or address) can be modified by visiting the link if supported by a carrier. The language parameter of this link relies on the destination country/region and the language associated with the shipment, if the data regarding the destination country/region and language of the shipment is not available, AfterShip will set the language parameter of the link to "US" by default. + */ + courier_redirect_link?: string; + /** + * Additional field required by some carriers to retrieve the tracking info. The shipper’s carrier account number. Refer to our article on for more details. + */ + tracking_account_number?: string; + /** + * Additional field required by some carriers to retrieve the tracking info. A type of tracking credential required by some carriers. Refer to our article on for more details. + */ + tracking_key?: string; + /** + * The date and time when the shipment is shipped by the merchant and ready for pickup by the carrier. The field supports the following formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZThe field serves two key purposes:- Calculate processing time metrics in the Order-to-delivery Analytics dashboard. To ensure accurate analytics, it's recommended to include timezone information when configuring this value- Required by certain carriers to retrieve tracking information as an additional tracking field. + */ + tracking_ship_date?: string; + /** + * Whether the tracking is delivered on time or not. + */ + on_time_status?: string; + /** + * The difference days of the on time. + */ + on_time_difference?: number; + /** + * The tags of the order. + */ + order_tags?: string[]; + /** + * The estimated delivery date of the shipment provided by AfterShip’s AI and shown to the recipients. It uses the format `YYYY-MM-DD` based on the shipment recipient’s timezone. + */ + aftership_estimated_delivery_date?: AftershipEstimatedDeliveryDateCreateTrackingResponse; + /** + * Estimated delivery time of the shipment based on your . It uses the format `YYYY-MM-DD` based on the shipment recipient’s timezone. + */ + custom_estimated_delivery_date?: CustomEstimatedDeliveryDateCreateTrackingResponse; + /** + * A unique, human-readable identifier for the order. + */ + order_number?: string; + /** + * The shipment’s original estimated delivery date. It could be provided by the carrier, AfterShip AI, or based on your custom settings. The format of carrier EDDs may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ AfterShip AI and custom EDDs always use the format `YYYY-MM-DD`. All EDDs use the shipment recipient’s timezone. + */ + first_estimated_delivery?: FirstEstimatedDeliveryCreateTrackingResponse; + /** + * The most recently calculated estimated delivery date. It could be provided by the carrier, AfterShip AI, or based on your custom settings. The format of carrier EDDs may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ AfterShip AI and custom EDDs always use the format `YYYY-MM-DD`. All EDDs use the shipment recipient’s timezone. + */ + latest_estimated_delivery?: LatestEstimatedDeliveryCreateTrackingResponse; + /** + * Used to add tags to your shipments to help categorize and filter them easily. + */ + shipment_tags?: string[]; + /** + * If you have multiple accounts connected for a single carrier on AfterShip, we have introduced the courier_connection_id field to allow you to specify the carrier account associated with each shipment. By providing this information, you enable us to accurately track and monitor your shipments based on the correct carrier account.(</br>In the event that you do not specify the courier_connection_id, we will handle your shipment using the connection that was created earliest among your connected accounts. + */ + courier_connection_id?: string; + /** + * (Legacy) Replaced by `origin_country_region`. Additional field required by some carriers to retrieve the tracking info. The origin country/region of the shipment. Refer to our article on for more details. + */ + tracking_origin_country_region?: string; + /** + * (Legacy) Replaced by `destination_country_region`. Additional field required by some carriers to retrieve the tracking info. The destination country/region of the shipment. Refer to our article on for more details. + */ + tracking_destination_country_region?: string; + /** + * (Legacy) Replaced by `destination_postal_code`. Additional field required by some carriers to retrieve the tracking info. The postal code of the recipient’s address. Refer to our article on for more details. + */ + tracking_postal_code?: string; + /** + * (Legacy) Replaced by `destination_state`. Additional field required by some carriers to retrieve the tracking info. The state/province of the recipient’s address. Refer to our article on for more details. + */ + tracking_state?: string; + /** + * The model contains the total amount of carbon emissions generated by the shipment. - AfterShip will provide this data only when it is available, and its availability is contingent upon the location and weight information that AfterShip can obtain.- The values will be accessible solely for shipments that have been successfully delivered. However, in the event of a shipping update after the delivery status has been achieved, the value may change.- It’s a paid service and only for Tracking Enterprise users, please contact your customer success manager if you want to know more. + */ + carbon_emissions?: CarbonEmissionsCreateTrackingResponse; + /** + * The location_id refers to the place where you fulfilled the items. - If you provide a location_id, the system will automatically use it as the tracking's origin address. However, passing both location_id and any origin address information simultaneously is not allowed.- Please make sure you add your locations . + */ + location_id?: string; + /** + * The shipping_method string refers to the chosen method for delivering the package. Merchants typically offer various shipping methods to consumers during the checkout process, such as, Local Delivery, Free Express Worldwide Shipping, etc. + */ + shipping_method?: string; + /** + * By dynamically tracking failed delivery attempts during shipment, this field allows you to pinpoint carriers accountable for the most failures. Analyzing the root cause of these failures enables you to improve carriers' delivery standard operating procedures (SOP), leading to an overall enhancement in delivery service quality. + */ + failed_delivery_attempts?: number; + /** + * The signature_requirement field serves the purpose of validating the service option type, specifically proof of delivery. By collecting the recipient's signature upon delivery, it ensures the package reaches the intended recipient and prevents disputes related to non-delivery or lost packages.</br> + */ + signature_requirement?: string; + /** + * The delivery location type represents the secure area where the carrier leaves the package, such as a safe place, locker, mailbox, front porch, etc. This information helps ensure the shipment reaches the intended recipient efficiently, minimizing the risk of theft or damage. + */ + delivery_location_type?: string; + /** + * The tracking URL directs your customers to the shipment tracking page which can display either the default or a customized page based on segmentation rules.- The universal URL is used by default, but you can opt for a custom domain if you have one. Learn how to set up a custom domain .The field is not automatically enabled in API & Webhook. Please contact support if you’d like to enable it. + */ + aftership_tracking_url?: string; + /** + * The order URL directs your customers to the order tracking page, which includes all shipments. It can display either the default or a customized page based on segmentation rules.- The universal URL is used by default, but you can opt for a custom domain if you have one. Learn how to set up a custom domain .The field is not automatically enabled in API & Webhook. Please contact support if you’d like to enable it. + */ + aftership_tracking_order_url?: string; + /** + * The field contains information about the first leg of the shipping starting from the carrier picking up the shipment from the shipper to the point where they hand it over to the last-mile carrier. Once AfterShip detects the shipment is multi-leg, we will populate the first-mile information under this object. + */ + first_mile?: FirstMileCreateTrackingResponse; + /** + * This field contains information about the last leg of the shipment, starting from the carrier who hands it over to the last-mile carrier, all the way to delivery. Once AfterShip detects that the shipment involves multiple legs and identifies the last-mile carrier, we will populate the last-mile carrier information in this object. Alternatively, the user can provide this information in this field to specify the last-mile carrier, which is helpful if AfterShip is unable to detect it automatically. + */ + last_mile?: LastMileCreateTrackingResponse; + /** + * The field contains the customer information associated with the tracking. A maximum of three customer objects are allowed. + */ + customers?: CustomersCreateTrackingResponse[]; +} diff --git a/src/model/CustomEstimatedDeliveryDateCreateTrackingResponse.ts b/src/model/CustomEstimatedDeliveryDateCreateTrackingResponse.ts new file mode 100644 index 0000000..8a82a11 --- /dev/null +++ b/src/model/CustomEstimatedDeliveryDateCreateTrackingResponse.ts @@ -0,0 +1,23 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CustomEstimatedDeliveryDateCreateTrackingResponse { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The specific EDD date. + */ + datetime?: string; + /** + * For a date range EDD format, the date for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/CustomEstimatedDeliveryDateDeleteTrackingByIdResponse.ts b/src/model/CustomEstimatedDeliveryDateDeleteTrackingByIdResponse.ts new file mode 100644 index 0000000..8be8afd --- /dev/null +++ b/src/model/CustomEstimatedDeliveryDateDeleteTrackingByIdResponse.ts @@ -0,0 +1,23 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CustomEstimatedDeliveryDateDeleteTrackingByIdResponse { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The specific EDD date. + */ + datetime?: string; + /** + * For a date range EDD format, the date for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/CustomEstimatedDeliveryDateGetTrackingByIdResponse.ts b/src/model/CustomEstimatedDeliveryDateGetTrackingByIdResponse.ts new file mode 100644 index 0000000..636b028 --- /dev/null +++ b/src/model/CustomEstimatedDeliveryDateGetTrackingByIdResponse.ts @@ -0,0 +1,23 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CustomEstimatedDeliveryDateGetTrackingByIdResponse { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The specific EDD date. + */ + datetime?: string; + /** + * For a date range EDD format, the date for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/CustomEstimatedDeliveryDateMarkTrackingCompletedByIdResponse.ts b/src/model/CustomEstimatedDeliveryDateMarkTrackingCompletedByIdResponse.ts new file mode 100644 index 0000000..467cbf7 --- /dev/null +++ b/src/model/CustomEstimatedDeliveryDateMarkTrackingCompletedByIdResponse.ts @@ -0,0 +1,23 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CustomEstimatedDeliveryDateMarkTrackingCompletedByIdResponse { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The specific EDD date. + */ + datetime?: string; + /** + * For a date range EDD format, the date for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/CustomEstimatedDeliveryDateRetrackTrackingByIdResponse.ts b/src/model/CustomEstimatedDeliveryDateRetrackTrackingByIdResponse.ts new file mode 100644 index 0000000..85dbd3a --- /dev/null +++ b/src/model/CustomEstimatedDeliveryDateRetrackTrackingByIdResponse.ts @@ -0,0 +1,23 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CustomEstimatedDeliveryDateRetrackTrackingByIdResponse { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The specific EDD date. + */ + datetime?: string; + /** + * For a date range EDD format, the date for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/CustomEstimatedDeliveryDateTracking.ts b/src/model/CustomEstimatedDeliveryDateTracking.ts new file mode 100644 index 0000000..97fd7e1 --- /dev/null +++ b/src/model/CustomEstimatedDeliveryDateTracking.ts @@ -0,0 +1,23 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CustomEstimatedDeliveryDateTracking { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The specific EDD date. + */ + datetime?: string; + /** + * For a date range EDD format, the date for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/CustomEstimatedDeliveryDateUpdateTrackingByIdResponse.ts b/src/model/CustomEstimatedDeliveryDateUpdateTrackingByIdResponse.ts new file mode 100644 index 0000000..acbefee --- /dev/null +++ b/src/model/CustomEstimatedDeliveryDateUpdateTrackingByIdResponse.ts @@ -0,0 +1,23 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CustomEstimatedDeliveryDateUpdateTrackingByIdResponse { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The specific EDD date. + */ + datetime?: string; + /** + * For a date range EDD format, the date for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/CustomersCreateTrackingRequest.ts b/src/model/CustomersCreateTrackingRequest.ts new file mode 100644 index 0000000..bca8a2d --- /dev/null +++ b/src/model/CustomersCreateTrackingRequest.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CustomersCreateTrackingRequest { + /** + * The role of the customer, indicating whether the customer is an individual or a company. + */ + role?: string; + /** + * Customer name associated with the tracking. + */ + name?: string; + /** + * The phone number(s) to receive SMS notifications. Phone numbers should begin with a `+` sign and include the area code. + */ + phone_number?: string; + /** + * Email address(es) to receive email notifications. + */ + email?: string; + /** + * The preferred language of the customer. If you have set up AfterShip notifications in different languages, we use this to send the tracking updates to the customer in their preferred language. + */ + language?: string; +} diff --git a/src/model/CustomersCreateTrackingResponse.ts b/src/model/CustomersCreateTrackingResponse.ts new file mode 100644 index 0000000..29bd71f --- /dev/null +++ b/src/model/CustomersCreateTrackingResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CustomersCreateTrackingResponse { + /** + * The role of the customer, indicating whether the customer is an individual or a company. + */ + role?: string; + /** + * Customer name associated with the tracking. + */ + name?: string; + /** + * The phone number(s) to receive SMS notifications. Phone numbers should begin with a `+` sign and include the area code. + */ + phone_number?: string; + /** + * Email address(es) to receive email notifications. + */ + email?: string; + /** + * The preferred language of the customer. If you have set up AfterShip notifications in different languages, we use this to send the tracking updates to the customer in their preferred language. + */ + language?: string; +} diff --git a/src/model/CustomersDeleteTrackingByIdResponse.ts b/src/model/CustomersDeleteTrackingByIdResponse.ts new file mode 100644 index 0000000..4e8b38c --- /dev/null +++ b/src/model/CustomersDeleteTrackingByIdResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CustomersDeleteTrackingByIdResponse { + /** + * The role of the customer, indicating whether the customer is an individual or a company. + */ + role?: string; + /** + * Customer name associated with the tracking. + */ + name?: string; + /** + * The phone number(s) to receive SMS notifications. Phone numbers should begin with a `+` sign and include the area code. + */ + phone_number?: string; + /** + * Email address(es) to receive email notifications. + */ + email?: string; + /** + * The preferred language of the customer. If you have set up AfterShip notifications in different languages, we use this to send the tracking updates to the customer in their preferred language. + */ + language?: string; +} diff --git a/src/model/CustomersGetTrackingByIdResponse.ts b/src/model/CustomersGetTrackingByIdResponse.ts new file mode 100644 index 0000000..ed83037 --- /dev/null +++ b/src/model/CustomersGetTrackingByIdResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CustomersGetTrackingByIdResponse { + /** + * The role of the customer, indicating whether the customer is an individual or a company. + */ + role?: string; + /** + * Customer name associated with the tracking. + */ + name?: string; + /** + * The phone number(s) to receive SMS notifications. Phone numbers should begin with a `+` sign and include the area code. + */ + phone_number?: string; + /** + * Email address(es) to receive email notifications. + */ + email?: string; + /** + * The preferred language of the customer. If you have set up AfterShip notifications in different languages, we use this to send the tracking updates to the customer in their preferred language. + */ + language?: string; +} diff --git a/src/model/CustomersMarkTrackingCompletedByIdResponse.ts b/src/model/CustomersMarkTrackingCompletedByIdResponse.ts new file mode 100644 index 0000000..7a73e8c --- /dev/null +++ b/src/model/CustomersMarkTrackingCompletedByIdResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CustomersMarkTrackingCompletedByIdResponse { + /** + * The role of the customer, indicating whether the customer is an individual or a company. + */ + role?: string; + /** + * Customer name associated with the tracking. + */ + name?: string; + /** + * The phone number(s) to receive SMS notifications. Phone numbers should begin with a `+` sign and include the area code. + */ + phone_number?: string; + /** + * Email address(es) to receive email notifications. + */ + email?: string; + /** + * The preferred language of the customer. If you have set up AfterShip notifications in different languages, we use this to send the tracking updates to the customer in their preferred language. + */ + language?: string; +} diff --git a/src/model/CustomersRetrackTrackingByIdResponse.ts b/src/model/CustomersRetrackTrackingByIdResponse.ts new file mode 100644 index 0000000..9f21ce1 --- /dev/null +++ b/src/model/CustomersRetrackTrackingByIdResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CustomersRetrackTrackingByIdResponse { + /** + * The role of the customer, indicating whether the customer is an individual or a company. + */ + role?: string; + /** + * Customer name associated with the tracking. + */ + name?: string; + /** + * The phone number(s) to receive SMS notifications. Phone numbers should begin with a `+` sign and include the area code. + */ + phone_number?: string; + /** + * Email address(es) to receive email notifications. + */ + email?: string; + /** + * The preferred language of the customer. If you have set up AfterShip notifications in different languages, we use this to send the tracking updates to the customer in their preferred language. + */ + language?: string; +} diff --git a/src/model/CustomersTracking.ts b/src/model/CustomersTracking.ts new file mode 100644 index 0000000..0a0fcfa --- /dev/null +++ b/src/model/CustomersTracking.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CustomersTracking { + /** + * The role of the customer, indicating whether the customer is an individual or a company. + */ + role?: string; + /** + * Customer name associated with the tracking. + */ + name?: string; + /** + * The phone number(s) to receive SMS notifications. Phone numbers should begin with a `+` sign and include the area code. + */ + phone_number?: string; + /** + * Email address(es) to receive email notifications. + */ + email?: string; + /** + * The preferred language of the customer. If you have set up AfterShip notifications in different languages, we use this to send the tracking updates to the customer in their preferred language. + */ + language?: string; +} diff --git a/src/model/CustomersUpdateTrackingByIdRequest.ts b/src/model/CustomersUpdateTrackingByIdRequest.ts new file mode 100644 index 0000000..b228ab6 --- /dev/null +++ b/src/model/CustomersUpdateTrackingByIdRequest.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CustomersUpdateTrackingByIdRequest { + /** + * The role of the customer, indicating whether the customer is an individual or a company. + */ + role?: string; + /** + * Customer name associated with the tracking. + */ + name?: string; + /** + * The phone number(s) to receive SMS notifications. Phone numbers should begin with a `+` sign and include the area code. + */ + phone_number?: string; + /** + * Email address(es) to receive email notifications. + */ + email?: string; + /** + * The preferred language of the customer. If you have set up AfterShip notifications in different languages, we use this to send the tracking updates to the customer in their preferred language. + */ + language?: string; +} diff --git a/src/model/CustomersUpdateTrackingByIdResponse.ts b/src/model/CustomersUpdateTrackingByIdResponse.ts new file mode 100644 index 0000000..fb83da7 --- /dev/null +++ b/src/model/CustomersUpdateTrackingByIdResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface CustomersUpdateTrackingByIdResponse { + /** + * The role of the customer, indicating whether the customer is an individual or a company. + */ + role?: string; + /** + * Customer name associated with the tracking. + */ + name?: string; + /** + * The phone number(s) to receive SMS notifications. Phone numbers should begin with a `+` sign and include the area code. + */ + phone_number?: string; + /** + * Email address(es) to receive email notifications. + */ + email?: string; + /** + * The preferred language of the customer. If you have set up AfterShip notifications in different languages, we use this to send the tracking updates to the customer in their preferred language. + */ + language?: string; +} diff --git a/src/model/DataCourierResponseV1.ts b/src/model/DataCourierResponseV1.ts new file mode 100644 index 0000000..844ffef --- /dev/null +++ b/src/model/DataCourierResponseV1.ts @@ -0,0 +1,16 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { Courier } from "./Courier"; + +export interface DataCourierResponseV1 { + /** + * Total count of courier objects + */ + total?: number; + /** + * Array of object. + */ + couriers?: Courier[]; +} diff --git a/src/model/DataTrackingResponseGetMultipleV1.ts b/src/model/DataTrackingResponseGetMultipleV1.ts new file mode 100644 index 0000000..7f1c4b6 --- /dev/null +++ b/src/model/DataTrackingResponseGetMultipleV1.ts @@ -0,0 +1,17 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { PaginationDataTrackingResponseGetMultipleV1 } from "./PaginationDataTrackingResponseGetMultipleV1"; +import { Tracking } from "./Tracking"; + +export interface DataTrackingResponseGetMultipleV1 { + /** + * The Pagination holds the information for the pagination when the response contains multiple objects. + */ + pagination?: PaginationDataTrackingResponseGetMultipleV1; + /** + * Array of + */ + trackings?: Tracking[]; +} diff --git a/src/model/DeleteTrackingByIdResponse.ts b/src/model/DeleteTrackingByIdResponse.ts new file mode 100644 index 0000000..d52beec --- /dev/null +++ b/src/model/DeleteTrackingByIdResponse.ts @@ -0,0 +1,335 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { CourierEstimatedDeliveryDateDeleteTrackingByIdResponse } from "./CourierEstimatedDeliveryDateDeleteTrackingByIdResponse"; +import { ShipmentWeightDeleteTrackingByIdResponse } from "./ShipmentWeightDeleteTrackingByIdResponse"; +import { TagV1 } from "./TagV1"; +import { Checkpoint } from "./Checkpoint"; +import { AftershipEstimatedDeliveryDateDeleteTrackingByIdResponse } from "./AftershipEstimatedDeliveryDateDeleteTrackingByIdResponse"; +import { CustomEstimatedDeliveryDateDeleteTrackingByIdResponse } from "./CustomEstimatedDeliveryDateDeleteTrackingByIdResponse"; +import { FirstEstimatedDeliveryDeleteTrackingByIdResponse } from "./FirstEstimatedDeliveryDeleteTrackingByIdResponse"; +import { LatestEstimatedDeliveryDeleteTrackingByIdResponse } from "./LatestEstimatedDeliveryDeleteTrackingByIdResponse"; +import { CarbonEmissionsDeleteTrackingByIdResponse } from "./CarbonEmissionsDeleteTrackingByIdResponse"; +import { FirstMileDeleteTrackingByIdResponse } from "./FirstMileDeleteTrackingByIdResponse"; +import { LastMileDeleteTrackingByIdResponse } from "./LastMileDeleteTrackingByIdResponse"; +import { CustomersDeleteTrackingByIdResponse } from "./CustomersDeleteTrackingByIdResponse"; + +export interface DeleteTrackingByIdResponse { + /** + * Tracking ID. + */ + id?: string; + /** + * The length of the tracking ID has been increased from 24 characters to 32 characters. We will use the legacy_id field to store the original 24-character tracking ID to maintain compatibility with existing data. Therefore, all tracking endpoints will continue to work with the legacy_id field as before. + */ + legacy_id?: string; + /** + * The date and time the shipment was imported or added to AfterShip. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0. + */ + created_at?: string; + /** + * The date and time the shipment was updated. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0. + */ + updated_at?: string; + /** + * Tracking number. + */ + tracking_number?: string; + /** + * Unique courier code. When importing a shipment with no courier slug and the tracking number can’t be recognized, the courier will be marked as `unrecognized`. Get courier codes . + */ + slug?: string; + /** + * Whether or not AfterShip will continue tracking the shipments. Value is `false` when tag (status) is `Delivered`, `Expired`, or further updates for 30 days since last update. + */ + active?: boolean; + /** + * Custom fields that accept an object with string field. In order to protect the privacy of your customers, do not include any in custom fields. + */ + custom_fields?: { [key: string]: any }; + /** + * Total transit time in days.- For delivered shipments: Transit time (in days) = Delivered date - Pick-up date- For undelivered shipments: Transit time (in days) = Current date - Pick-up dateValue as `null` for the shipment without pick-up date. + */ + transit_time?: number; + /** + * The for the origin country/region. E.g. USA for the United States. + */ + origin_country_region?: string; + /** + * The state of the sender’s address. + */ + origin_state?: string; + /** + * The city of the sender’s address. + */ + origin_city?: string; + /** + * The postal code of the sender’s address. + */ + origin_postal_code?: string; + /** + * The sender address that the shipment is shipping from. + */ + origin_raw_location?: string; + /** + * The for the destination country/region. E.g. USA for the United States. + */ + destination_country_region?: string; + /** + * The state of the recipient’s address. + */ + destination_state?: string; + /** + * The city of the recipient’s address. + */ + destination_city?: string; + /** + * The postal code of the recipient’s address. + */ + destination_postal_code?: string; + /** + * The shipping address that the shipment is shipping to. + */ + destination_raw_location?: string; + /** + * Destination country/region of the tracking detected from the courier. ISO Alpha-3 (three letters). Value will be `null` if the courier doesn't provide the destination country. + */ + courier_destination_country_region?: string; + /** + * The field contains the estimated delivery date provided by the carrier. + */ + courier_estimated_delivery_date?: CourierEstimatedDeliveryDateDeleteTrackingByIdResponse; + /** + * Text field for the note. + */ + note?: string; + /** + * A globally-unique identifier for the order. + */ + order_id?: string; + /** + * The URL for the order in your system or store. + */ + order_id_path?: string; + /** + * The date and time the order was created in your system or store. It uses the format: `YYYY-MM-DDTHH:mm:ssZ` based on whichever timezone you provide. + */ + order_date?: string; + /** + * Number of packages under the tracking. + */ + shipment_package_count?: number; + /** + * The date and time the shipment was picked up by the carrier. It uses the timezone where the pickup occured. The format may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + shipment_pickup_date?: string; + /** + * The date and time the shipment was delivered. It uses the shipment recipient’s timezone. The format may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + shipment_delivery_date?: string; + /** + * The carrier service type for the shipment. + */ + shipment_type?: string; + /** + * The shipment_weight field represents the total weight of the shipment. In scenarios where the carrier does not provide this information, you can provide the weight to AfterShip. We will prioritize the data provided by the carrier, if available. The shipment weight will be included in the Response and accessed through the GET API, Webhook, and CSV export. It will also be displayed on the AfterShip Tracking admin. Additionally, it plays a significant role in error-free shipment handling and carbon emission calculations, ensuring accurate and informed decision-making + */ + shipment_weight?: ShipmentWeightDeleteTrackingByIdResponse; + /** + * Signed by information for delivered shipment. + */ + signed_by?: string; + /** + * Source of how this tracking is added. + */ + source?: string; + /** + * Current status of tracking. ( + */ + tag?: TagV1; + /** + * Current subtag of tracking. ( + */ + subtag?: string; + /** + * Normalized tracking message. ( + */ + subtag_message?: string; + /** + * By default this field shows the `tracking_number`, but you can customize it as you wish with any info (e.g. the order number). + */ + title?: string; + /** + * Number of attempts AfterShip tracks at courier's system. + */ + tracked_count?: number; + /** + * Indicates if the shipment is trackable till the final destination.Three possible values:- true- false- null + */ + last_mile_tracking_supported?: boolean; + /** + * The recipient’s language. If you set up AfterShip notifications in different languages, we use this to send the recipient tracking updates in their preferred language. + */ + language?: string; + /** + * Deprecated + */ + unique_token?: string; + /** + * Array of checkpoint object describes the checkpoint information. + */ + checkpoints?: Checkpoint[]; + /** + * Phone number(s) subscribed to receive sms notifications. + */ + subscribed_smses?: string[]; + /** + * Email address(es) subscribed to receive email notifications. + */ + subscribed_emails?: string[]; + /** + * Whether or not the shipment is returned to sender. Value is `true` when any of its checkpoints has subtag `Exception_010` (returning to sender) or `Exception_011` (returned to sender). Otherwise value is `false`. + */ + return_to_sender?: boolean; + /** + * The promised delivery date of the order. It uses the formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + order_promised_delivery_date?: string; + /** + * Shipment delivery type- pickup_at_store- pickup_at_courier- door_to_door + */ + delivery_type?: string; + /** + * Shipment pickup location for receiver + */ + pickup_location?: string; + /** + * Shipment pickup note for receiver + */ + pickup_note?: string; + /** + * Official tracking URL of the courier (if any). The language parameter of this link relies on the destination country/region and the language associated with the shipment, if the data regarding the destination country/region and language of the shipment is not available, AfterShip will set the language parameter of the link to "US" by default. + */ + courier_tracking_link?: string; + /** + * The date and time of the carrier’s first attempt to deliver the package to the recipient. It uses the shipment recipient’s timezone. The format may differ depending on how the carrier provides it:- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + first_attempted_at?: string; + /** + * Delivery instructions (delivery date or address) can be modified by visiting the link if supported by a carrier. The language parameter of this link relies on the destination country/region and the language associated with the shipment, if the data regarding the destination country/region and language of the shipment is not available, AfterShip will set the language parameter of the link to "US" by default. + */ + courier_redirect_link?: string; + /** + * Additional field required by some carriers to retrieve the tracking info. The shipper’s carrier account number. Refer to our article on for more details. + */ + tracking_account_number?: string; + /** + * Additional field required by some carriers to retrieve the tracking info. A type of tracking credential required by some carriers. Refer to our article on for more details. + */ + tracking_key?: string; + /** + * The date and time when the shipment is shipped by the merchant and ready for pickup by the carrier. The field supports the following formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZThe field serves two key purposes:- Calculate processing time metrics in the Order-to-delivery Analytics dashboard. To ensure accurate analytics, it's recommended to include timezone information when configuring this value- Required by certain carriers to retrieve tracking information as an additional tracking field. + */ + tracking_ship_date?: string; + /** + * Whether the tracking is delivered on time or not. + */ + on_time_status?: string; + /** + * The difference days of the on time. + */ + on_time_difference?: number; + /** + * The tags of the order. + */ + order_tags?: string[]; + /** + * The estimated delivery date of the shipment provided by AfterShip’s AI and shown to the recipients. It uses the format `YYYY-MM-DD` based on the shipment recipient’s timezone. + */ + aftership_estimated_delivery_date?: AftershipEstimatedDeliveryDateDeleteTrackingByIdResponse; + /** + * Estimated delivery time of the shipment based on your . It uses the format `YYYY-MM-DD` based on the shipment recipient’s timezone. + */ + custom_estimated_delivery_date?: CustomEstimatedDeliveryDateDeleteTrackingByIdResponse; + /** + * A unique, human-readable identifier for the order. + */ + order_number?: string; + /** + * The shipment’s original estimated delivery date. It could be provided by the carrier, AfterShip AI, or based on your custom settings. The format of carrier EDDs may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ AfterShip AI and custom EDDs always use the format `YYYY-MM-DD`. All EDDs use the shipment recipient’s timezone. + */ + first_estimated_delivery?: FirstEstimatedDeliveryDeleteTrackingByIdResponse; + /** + * The most recently calculated estimated delivery date. It could be provided by the carrier, AfterShip AI, or based on your custom settings. The format of carrier EDDs may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ AfterShip AI and custom EDDs always use the format `YYYY-MM-DD`. All EDDs use the shipment recipient’s timezone. + */ + latest_estimated_delivery?: LatestEstimatedDeliveryDeleteTrackingByIdResponse; + /** + * Used to add tags to your shipments to help categorize and filter them easily. + */ + shipment_tags?: string[]; + /** + * If you have multiple accounts connected for a single carrier on AfterShip, we have introduced the courier_connection_id field to allow you to specify the carrier account associated with each shipment. By providing this information, you enable us to accurately track and monitor your shipments based on the correct carrier account.(</br>In the event that you do not specify the courier_connection_id, we will handle your shipment using the connection that was created earliest among your connected accounts. + */ + courier_connection_id?: string; + /** + * (Legacy) Replaced by `origin_country_region`. Additional field required by some carriers to retrieve the tracking info. The origin country/region of the shipment. Refer to our article on for more details. + */ + tracking_origin_country_region?: string; + /** + * (Legacy) Replaced by `destination_country_region`. Additional field required by some carriers to retrieve the tracking info. The destination country/region of the shipment. Refer to our article on for more details. + */ + tracking_destination_country_region?: string; + /** + * (Legacy) Replaced by `destination_postal_code`. Additional field required by some carriers to retrieve the tracking info. The postal code of the recipient’s address. Refer to our article on for more details. + */ + tracking_postal_code?: string; + /** + * (Legacy) Replaced by `destination_state`. Additional field required by some carriers to retrieve the tracking info. The state/province of the recipient’s address. Refer to our article on for more details. + */ + tracking_state?: string; + /** + * The model contains the total amount of carbon emissions generated by the shipment. - AfterShip will provide this data only when it is available, and its availability is contingent upon the location and weight information that AfterShip can obtain.- The values will be accessible solely for shipments that have been successfully delivered. However, in the event of a shipping update after the delivery status has been achieved, the value may change.- It’s a paid service and only for Tracking Enterprise users, please contact your customer success manager if you want to know more. + */ + carbon_emissions?: CarbonEmissionsDeleteTrackingByIdResponse; + /** + * The location_id refers to the place where you fulfilled the items. - If you provide a location_id, the system will automatically use it as the tracking's origin address. However, passing both location_id and any origin address information simultaneously is not allowed.- Please make sure you add your locations . + */ + location_id?: string; + /** + * The shipping_method string refers to the chosen method for delivering the package. Merchants typically offer various shipping methods to consumers during the checkout process, such as, Local Delivery, Free Express Worldwide Shipping, etc. + */ + shipping_method?: string; + /** + * By dynamically tracking failed delivery attempts during shipment, this field allows you to pinpoint carriers accountable for the most failures. Analyzing the root cause of these failures enables you to improve carriers' delivery standard operating procedures (SOP), leading to an overall enhancement in delivery service quality. + */ + failed_delivery_attempts?: number; + /** + * The signature_requirement field serves the purpose of validating the service option type, specifically proof of delivery. By collecting the recipient's signature upon delivery, it ensures the package reaches the intended recipient and prevents disputes related to non-delivery or lost packages.</br> + */ + signature_requirement?: string; + /** + * The delivery location type represents the secure area where the carrier leaves the package, such as a safe place, locker, mailbox, front porch, etc. This information helps ensure the shipment reaches the intended recipient efficiently, minimizing the risk of theft or damage. + */ + delivery_location_type?: string; + /** + * The tracking URL directs your customers to the shipment tracking page which can display either the default or a customized page based on segmentation rules.- The universal URL is used by default, but you can opt for a custom domain if you have one. Learn how to set up a custom domain .The field is not automatically enabled in API & Webhook. Please contact support if you’d like to enable it. + */ + aftership_tracking_url?: string; + /** + * The order URL directs your customers to the order tracking page, which includes all shipments. It can display either the default or a customized page based on segmentation rules.- The universal URL is used by default, but you can opt for a custom domain if you have one. Learn how to set up a custom domain .The field is not automatically enabled in API & Webhook. Please contact support if you’d like to enable it. + */ + aftership_tracking_order_url?: string; + /** + * The field contains information about the first leg of the shipping starting from the carrier picking up the shipment from the shipper to the point where they hand it over to the last-mile carrier. Once AfterShip detects the shipment is multi-leg, we will populate the first-mile information under this object. + */ + first_mile?: FirstMileDeleteTrackingByIdResponse; + /** + * This field contains information about the last leg of the shipment, starting from the carrier who hands it over to the last-mile carrier, all the way to delivery. Once AfterShip detects that the shipment involves multiple legs and identifies the last-mile carrier, we will populate the last-mile carrier information in this object. Alternatively, the user can provide this information in this field to specify the last-mile carrier, which is helpful if AfterShip is unable to detect it automatically. + */ + last_mile?: LastMileDeleteTrackingByIdResponse; + /** + * The field contains the customer information associated with the tracking. A maximum of three customer objects are allowed. + */ + customers?: CustomersDeleteTrackingByIdResponse[]; +} diff --git a/src/model/DestinationAddressEstimatedDeliveryDateRequest.ts b/src/model/DestinationAddressEstimatedDeliveryDateRequest.ts new file mode 100644 index 0000000..0a39b78 --- /dev/null +++ b/src/model/DestinationAddressEstimatedDeliveryDateRequest.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface DestinationAddressEstimatedDeliveryDateRequest { + /** + * The country/region of the destination location where the package will be delivered. Use 3 letters of ISO 3166-1 country code. + */ + country_region: string; + /** + * State, province, or the equivalent location of the destination address where the package will be delivered.Either `destination_address.state` or `destination_address.postal_code` is required. + */ + state?: string; + /** + * City of the destination address where the package will be delivered. + */ + city?: string; + /** + * Postal code of the destination address.Either `destination_address.state` or `destination_address.postal_code` is required. + */ + postal_code?: string; + /** + * Raw location of the destination address. A raw address will help AI to identify the accurate location of the destination address. + */ + raw_location?: string; +} diff --git a/src/model/DestinationAddressEstimatedDeliveryDateResponse.ts b/src/model/DestinationAddressEstimatedDeliveryDateResponse.ts new file mode 100644 index 0000000..20c174b --- /dev/null +++ b/src/model/DestinationAddressEstimatedDeliveryDateResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface DestinationAddressEstimatedDeliveryDateResponse { + /** + * The country/region of the destination location where the package will be delivered. Use 3 letters of ISO 3166-1 country code. + */ + country_region: string; + /** + * State, province, or the equivalent location of the destination address where the package will be delivered.Either `destination_address.state` or `destination_address.postal_code` is required. + */ + state?: string; + /** + * City of the destination address where the package will be delivered. + */ + city?: string; + /** + * Postal code of the destination address.Either `destination_address.state` or `destination_address.postal_code` is required. + */ + postal_code?: string; + /** + * Raw location of the destination address. A raw address will help AI to identify the accurate location of the destination address. + */ + raw_location?: string; +} diff --git a/src/model/DestinationAddressPredictRequest.ts b/src/model/DestinationAddressPredictRequest.ts new file mode 100644 index 0000000..c8ddb0d --- /dev/null +++ b/src/model/DestinationAddressPredictRequest.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface DestinationAddressPredictRequest { + /** + * The country/region of the destination location where the package will be delivered. Use 3 letters of ISO 3166-1 country code. + */ + country_region: string; + /** + * State, province, or the equivalent location of the destination address where the package will be delivered.Either `destination_address.state` or `destination_address.postal_code` is required. + */ + state?: string; + /** + * City of the destination address where the package will be delivered. + */ + city?: string; + /** + * Postal code of the destination address.Either `destination_address.state` or `destination_address.postal_code` is required. + */ + postal_code?: string; + /** + * Raw location of the destination address. A raw address will help AI to identify the accurate location of the destination address. + */ + raw_location?: string; +} diff --git a/src/model/DestinationAddressPredictResponse.ts b/src/model/DestinationAddressPredictResponse.ts new file mode 100644 index 0000000..dc155ad --- /dev/null +++ b/src/model/DestinationAddressPredictResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface DestinationAddressPredictResponse { + /** + * The country/region of the destination location where the package will be delivered. Use 3 letters of ISO 3166-1 country code. + */ + country_region: string; + /** + * State, province, or the equivalent location of the destination address where the package will be delivered.Either `destination_address.state` or `destination_address.postal_code` is required. + */ + state?: string; + /** + * City of the destination address where the package will be delivered. + */ + city?: string; + /** + * Postal code of the destination address.Either `destination_address.state` or `destination_address.postal_code` is required. + */ + postal_code?: string; + /** + * Raw location of the destination address. A raw address will help AI to identify the accurate location of the destination address. + */ + raw_location?: string; +} diff --git a/src/model/DetectCourierRequest.ts b/src/model/DetectCourierRequest.ts new file mode 100644 index 0000000..4292da5 --- /dev/null +++ b/src/model/DetectCourierRequest.ts @@ -0,0 +1,56 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { SlugGroupV1 } from "./SlugGroupV1"; + +export interface DetectCourierRequest { + /** + * Tracking number of a shipment. + */ + tracking_number: string; + /** + * If not specified, Aftership will automatically detect the courier based on the tracking number format and your . Use array to input a list of couriers for auto detect. Cannot be used with slug_group at the same time. + */ + slug?: string[]; + /** + * The postal code of receiver's address. Required by some couriers. Refer to for more details + */ + tracking_postal_code?: string; + /** + * Shipping date in `YYYYMMDD` format. Required by some couriers. Refer to for more details + */ + tracking_ship_date?: string; + /** + * Account number of the shipper for a specific courier. Required by some couriers. Refer to for more details + */ + tracking_account_number?: string; + /** + * Key of the shipment for a specific courier. Required by some couriers. Refer to for more details + */ + tracking_key?: string; + /** + * Origin Country/Region of the shipment for a specific courier. Required by some couriers. + */ + tracking_origin_country_region?: string; + /** + * Destination Country/Region of the shipment for a specific courier. Required by some couriers. Refer to for more details + */ + tracking_destination_country_region?: string; + /** + * State of the destination shipping address of the shipment. Required by some couriers. + */ + tracking_state?: string; + /** + * Slug group is a group of slugs which belong to same courier. For example, when you inpit "fedex-group" as slug_group, AfterShip will detect the tracking with "fedex-uk", "fedex-fims", and other slugs which belong to "fedex". It cannot be used with slug at the same time. ( + */ + slug_group?: SlugGroupV1; + /** + * Enter . + */ + origin_country_region?: string; + /** + * Enter . + */ + destination_country_region?: string; +} diff --git a/src/model/DetectCourierResponse.ts b/src/model/DetectCourierResponse.ts new file mode 100644 index 0000000..2787db9 --- /dev/null +++ b/src/model/DetectCourierResponse.ts @@ -0,0 +1,16 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { Courier } from "./Courier"; + +export interface DetectCourierResponse { + /** + * Total count of courier objects + */ + total?: number; + /** + * Array of object. + */ + couriers?: Courier[]; +} diff --git a/src/model/EstimatedDeliveryDateRequest.ts b/src/model/EstimatedDeliveryDateRequest.ts new file mode 100644 index 0000000..4219589 --- /dev/null +++ b/src/model/EstimatedDeliveryDateRequest.ts @@ -0,0 +1,43 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { OriginAddressEstimatedDeliveryDateRequest } from "./OriginAddressEstimatedDeliveryDateRequest"; +import { DestinationAddressEstimatedDeliveryDateRequest } from "./DestinationAddressEstimatedDeliveryDateRequest"; +import { WeightEstimatedDeliveryDateRequest } from "./WeightEstimatedDeliveryDateRequest"; +import { EstimatedPickupEstimatedDeliveryDateRequest } from "./EstimatedPickupEstimatedDeliveryDateRequest"; + +export interface EstimatedDeliveryDateRequest { + /** + * AfterShip's unique code of courier. Please refer to https://track.aftership.com/couriers/download. + */ + slug: string; + /** + * AfterShip’s unique code represents carrier’s shipping and delivery options. Refer to . + */ + service_type_name?: string; + /** + * The location from where the package is picked up by the carrier to be delivered to the final destination. + */ + origin_address: OriginAddressEstimatedDeliveryDateRequest; + /** + * The final destination of the customer where the delivery will be made. + */ + destination_address: DestinationAddressEstimatedDeliveryDateRequest; + /** + * AfterShip uses this object to calculate the total weight of the order. + */ + weight?: WeightEstimatedDeliveryDateRequest; + /** + * The number of packages. + */ + package_count?: number; + /** + * The local pickup time in the origin address time zone of the package.Either `pickup_time` or `estimated_pickup` is required. + */ + pickup_time?: string; + /** + * The local pickup time of the package.Either `pickup_time` or `estimated_pickup` is required. + */ + estimated_pickup?: EstimatedPickupEstimatedDeliveryDateRequest; +} diff --git a/src/model/EstimatedDeliveryDateResponse.ts b/src/model/EstimatedDeliveryDateResponse.ts new file mode 100644 index 0000000..4b639d0 --- /dev/null +++ b/src/model/EstimatedDeliveryDateResponse.ts @@ -0,0 +1,63 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { OriginAddressEstimatedDeliveryDateResponse } from "./OriginAddressEstimatedDeliveryDateResponse"; +import { DestinationAddressEstimatedDeliveryDateResponse } from "./DestinationAddressEstimatedDeliveryDateResponse"; +import { WeightEstimatedDeliveryDateResponse } from "./WeightEstimatedDeliveryDateResponse"; +import { EstimatedPickupEstimatedDeliveryDateResponse } from "./EstimatedPickupEstimatedDeliveryDateResponse"; + +export interface EstimatedDeliveryDateResponse { + /** + * A string that acts as a unique identifier for the estimated delivery date value generated by AfterShip Predict API + */ + id: string; + /** + * AfterShip's unique code of courier. Please refer to https://track.aftership.com/couriers/download. + */ + slug: string; + /** + * AfterShip’s unique code represents carrier’s shipping and delivery options. Refer to . + */ + service_type_name?: string; + /** + * The location from where the package is picked up by the carrier to be delivered to the final destination. + */ + origin_address: OriginAddressEstimatedDeliveryDateResponse; + /** + * The final destination of the customer where the delivery will be made. + */ + destination_address: DestinationAddressEstimatedDeliveryDateResponse; + /** + * AfterShip uses this object to calculate the total weight of the order. + */ + weight?: WeightEstimatedDeliveryDateResponse; + /** + * The number of packages. + */ + package_count?: number; + /** + * The local pickup time in the origin address time zone of the package.Either `pickup_time` or `estimated_pickup` is required. + */ + pickup_time?: string; + /** + * The local pickup time of the package.Either `pickup_time` or `estimated_pickup` is required. + */ + estimated_pickup?: EstimatedPickupEstimatedDeliveryDateResponse; + /** + * The estimated arrival date of the shipment, provided by AfterShip. + */ + estimated_delivery_date?: string; + /** + * Indicates the confidence level and associated reason for an AI EDD prediction request. For a comprehensive list of confidence codes, refer to . + */ + confidence_code?: number; + /** + * The earliest estimated delivery date of the shipment, provided by AfterShip. + */ + estimated_delivery_date_min?: string; + /** + * The latest estimated delivery date of the shipment, provided by AfterShip. + */ + estimated_delivery_date_max?: string; +} diff --git a/src/model/EstimatedPickupEstimatedDeliveryDateRequest.ts b/src/model/EstimatedPickupEstimatedDeliveryDateRequest.ts new file mode 100644 index 0000000..91c8bf5 --- /dev/null +++ b/src/model/EstimatedPickupEstimatedDeliveryDateRequest.ts @@ -0,0 +1,24 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { OrderProcessingTimeEstimatedPickupEstimatedDeliveryDateRequest } from "./OrderProcessingTimeEstimatedPickupEstimatedDeliveryDateRequest"; + +export interface EstimatedPickupEstimatedDeliveryDateRequest { + /** + * The local order time in the origin address time zone of the package. + */ + order_time: string; + /** + * Order cut off time in the origin address time zone. The default value set by AfterShip is 18:00:00. + */ + order_cutoff_time?: string; + /** + * Operating days in a week. Number refers to the weekday.E.g., [1,2,3,4,5] means operating days are from Monday to Friday.AfterShip will set [1,2,3,4,5] as the default value. + */ + business_days?: number[]; + /** + * + */ + order_processing_time?: OrderProcessingTimeEstimatedPickupEstimatedDeliveryDateRequest; +} diff --git a/src/model/EstimatedPickupEstimatedDeliveryDateResponse.ts b/src/model/EstimatedPickupEstimatedDeliveryDateResponse.ts new file mode 100644 index 0000000..049b52a --- /dev/null +++ b/src/model/EstimatedPickupEstimatedDeliveryDateResponse.ts @@ -0,0 +1,28 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { OrderProcessingTimeEstimatedPickupEstimatedDeliveryDateResponse } from "./OrderProcessingTimeEstimatedPickupEstimatedDeliveryDateResponse"; + +export interface EstimatedPickupEstimatedDeliveryDateResponse { + /** + * The local order time in the origin address time zone of the package. + */ + order_time: string; + /** + * Order cut off time in the origin address time zone. The default value set by AfterShip is 18:00:00. + */ + order_cutoff_time?: string; + /** + * Operating days in a week. Number refers to the weekday.E.g., [1,2,3,4,5] means operating days are from Monday to Friday.AfterShip will set [1,2,3,4,5] as the default value. + */ + business_days?: number[]; + /** + * + */ + order_processing_time?: OrderProcessingTimeEstimatedPickupEstimatedDeliveryDateResponse; + /** + * The local pickup time of the package. + */ + pickup_time?: string; +} diff --git a/src/model/EstimatedPickupPredictRequest.ts b/src/model/EstimatedPickupPredictRequest.ts new file mode 100644 index 0000000..dd86040 --- /dev/null +++ b/src/model/EstimatedPickupPredictRequest.ts @@ -0,0 +1,24 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { OrderProcessingTimeEstimatedPickupPredictRequest } from "./OrderProcessingTimeEstimatedPickupPredictRequest"; + +export interface EstimatedPickupPredictRequest { + /** + * The local order time in the origin address time zone of the package. + */ + order_time: string; + /** + * Order cut off time in the origin address time zone. The default value set by AfterShip is 18:00:00. + */ + order_cutoff_time?: string; + /** + * Operating days in a week. Number refers to the weekday.E.g., [1,2,3,4,5] means operating days are from Monday to Friday.AfterShip will set [1,2,3,4,5] as the default value. + */ + business_days?: number[]; + /** + * + */ + order_processing_time?: OrderProcessingTimeEstimatedPickupPredictRequest; +} diff --git a/src/model/EstimatedPickupPredictResponse.ts b/src/model/EstimatedPickupPredictResponse.ts new file mode 100644 index 0000000..2f5ae12 --- /dev/null +++ b/src/model/EstimatedPickupPredictResponse.ts @@ -0,0 +1,28 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { OrderProcessingTimeEstimatedPickupPredictResponse } from "./OrderProcessingTimeEstimatedPickupPredictResponse"; + +export interface EstimatedPickupPredictResponse { + /** + * The local order time in the origin address time zone of the package. + */ + order_time: string; + /** + * Order cut off time in the origin address time zone. The default value set by AfterShip is 18:00:00. + */ + order_cutoff_time?: string; + /** + * Operating days in a week. Number refers to the weekday.E.g., [1,2,3,4,5] means operating days are from Monday to Friday.AfterShip will set [1,2,3,4,5] as the default value. + */ + business_days?: number[]; + /** + * + */ + order_processing_time?: OrderProcessingTimeEstimatedPickupPredictResponse; + /** + * The local pickup time of the package. + */ + pickup_time?: string; +} diff --git a/src/model/EventsCheckpoint.ts b/src/model/EventsCheckpoint.ts new file mode 100644 index 0000000..ea388a6 --- /dev/null +++ b/src/model/EventsCheckpoint.ts @@ -0,0 +1,16 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { ReasonEventsCheckpoint } from "./ReasonEventsCheckpoint"; + +export interface EventsCheckpoint { + /** + * Represents the event code. + */ + code?: string; + /** + * Describes the specific reason that led to the event. + */ + reason?: ReasonEventsCheckpoint; +} diff --git a/src/model/FirstEstimatedDeliveryCreateTrackingResponse.ts b/src/model/FirstEstimatedDeliveryCreateTrackingResponse.ts new file mode 100644 index 0000000..7915501 --- /dev/null +++ b/src/model/FirstEstimatedDeliveryCreateTrackingResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface FirstEstimatedDeliveryCreateTrackingResponse { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The source of the EDD. Either the carrier, AfterShip AI, or based on your custom EDD settings. + */ + source?: string; + /** + * The latest EDD time. + */ + datetime?: string; + /** + * For a date range EDD format, the date and time for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date and time for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/FirstEstimatedDeliveryDeleteTrackingByIdResponse.ts b/src/model/FirstEstimatedDeliveryDeleteTrackingByIdResponse.ts new file mode 100644 index 0000000..97d0424 --- /dev/null +++ b/src/model/FirstEstimatedDeliveryDeleteTrackingByIdResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface FirstEstimatedDeliveryDeleteTrackingByIdResponse { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The source of the EDD. Either the carrier, AfterShip AI, or based on your custom EDD settings. + */ + source?: string; + /** + * The latest EDD time. + */ + datetime?: string; + /** + * For a date range EDD format, the date and time for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date and time for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/FirstEstimatedDeliveryGetTrackingByIdResponse.ts b/src/model/FirstEstimatedDeliveryGetTrackingByIdResponse.ts new file mode 100644 index 0000000..7a91c3f --- /dev/null +++ b/src/model/FirstEstimatedDeliveryGetTrackingByIdResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface FirstEstimatedDeliveryGetTrackingByIdResponse { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The source of the EDD. Either the carrier, AfterShip AI, or based on your custom EDD settings. + */ + source?: string; + /** + * The latest EDD time. + */ + datetime?: string; + /** + * For a date range EDD format, the date and time for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date and time for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/FirstEstimatedDeliveryMarkTrackingCompletedByIdResponse.ts b/src/model/FirstEstimatedDeliveryMarkTrackingCompletedByIdResponse.ts new file mode 100644 index 0000000..b558471 --- /dev/null +++ b/src/model/FirstEstimatedDeliveryMarkTrackingCompletedByIdResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface FirstEstimatedDeliveryMarkTrackingCompletedByIdResponse { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The source of the EDD. Either the carrier, AfterShip AI, or based on your custom EDD settings. + */ + source?: string; + /** + * The latest EDD time. + */ + datetime?: string; + /** + * For a date range EDD format, the date and time for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date and time for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/FirstEstimatedDeliveryRetrackTrackingByIdResponse.ts b/src/model/FirstEstimatedDeliveryRetrackTrackingByIdResponse.ts new file mode 100644 index 0000000..4aaca0a --- /dev/null +++ b/src/model/FirstEstimatedDeliveryRetrackTrackingByIdResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface FirstEstimatedDeliveryRetrackTrackingByIdResponse { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The source of the EDD. Either the carrier, AfterShip AI, or based on your custom EDD settings. + */ + source?: string; + /** + * The latest EDD time. + */ + datetime?: string; + /** + * For a date range EDD format, the date and time for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date and time for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/FirstEstimatedDeliveryTracking.ts b/src/model/FirstEstimatedDeliveryTracking.ts new file mode 100644 index 0000000..f4736dc --- /dev/null +++ b/src/model/FirstEstimatedDeliveryTracking.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface FirstEstimatedDeliveryTracking { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The source of the EDD. Either the carrier, AfterShip AI, or based on your custom EDD settings. + */ + source?: string; + /** + * The latest EDD time. + */ + datetime?: string; + /** + * For a date range EDD format, the date and time for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date and time for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/FirstEstimatedDeliveryUpdateTrackingByIdResponse.ts b/src/model/FirstEstimatedDeliveryUpdateTrackingByIdResponse.ts new file mode 100644 index 0000000..bf1be55 --- /dev/null +++ b/src/model/FirstEstimatedDeliveryUpdateTrackingByIdResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface FirstEstimatedDeliveryUpdateTrackingByIdResponse { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The source of the EDD. Either the carrier, AfterShip AI, or based on your custom EDD settings. + */ + source?: string; + /** + * The latest EDD time. + */ + datetime?: string; + /** + * For a date range EDD format, the date and time for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date and time for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/FirstMileCreateTrackingResponse.ts b/src/model/FirstMileCreateTrackingResponse.ts new file mode 100644 index 0000000..da80069 --- /dev/null +++ b/src/model/FirstMileCreateTrackingResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface FirstMileCreateTrackingResponse { + /** + * The tracking number of the first-mile carrier. + */ + tracking_number?: string; + /** + * The unique code of the carrier responsible for the first-mile of the shipment. Find all the courier slugs . + */ + slug?: string; + /** + * The transit time for the first-mile of a shipment in days. This field is calculated based on whether the handed_over_to_last_mile_carrier or received_by_last_mile_carrier event is detected by AfterShip. The handover event date is used to calculate the first-mile transit time.- First mile transit time (in days) = Handover date - Pickup date + */ + transit_time?: string; + /** + * The field provides the link for modifying delivery instructions (such as delivery date and shipping address), if supported by the first-mile carrier. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_redirect_link?: string; + /** + * The field contains the official tracking URL of the first-mile carrier, if available. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_tracking_link?: string; +} diff --git a/src/model/FirstMileDeleteTrackingByIdResponse.ts b/src/model/FirstMileDeleteTrackingByIdResponse.ts new file mode 100644 index 0000000..831ef13 --- /dev/null +++ b/src/model/FirstMileDeleteTrackingByIdResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface FirstMileDeleteTrackingByIdResponse { + /** + * The tracking number of the first-mile carrier. + */ + tracking_number?: string; + /** + * The unique code of the carrier responsible for the first-mile of the shipment. Find all the courier slugs . + */ + slug?: string; + /** + * The transit time for the first-mile of a shipment in days. This field is calculated based on whether the handed_over_to_last_mile_carrier or received_by_last_mile_carrier event is detected by AfterShip. The handover event date is used to calculate the first-mile transit time.- First mile transit time (in days) = Handover date - Pickup date + */ + transit_time?: string; + /** + * The field provides the link for modifying delivery instructions (such as delivery date and shipping address), if supported by the first-mile carrier. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_redirect_link?: string; + /** + * The field contains the official tracking URL of the first-mile carrier, if available. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_tracking_link?: string; +} diff --git a/src/model/FirstMileGetTrackingByIdResponse.ts b/src/model/FirstMileGetTrackingByIdResponse.ts new file mode 100644 index 0000000..48f2993 --- /dev/null +++ b/src/model/FirstMileGetTrackingByIdResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface FirstMileGetTrackingByIdResponse { + /** + * The tracking number of the first-mile carrier. + */ + tracking_number?: string; + /** + * The unique code of the carrier responsible for the first-mile of the shipment. Find all the courier slugs . + */ + slug?: string; + /** + * The transit time for the first-mile of a shipment in days. This field is calculated based on whether the handed_over_to_last_mile_carrier or received_by_last_mile_carrier event is detected by AfterShip. The handover event date is used to calculate the first-mile transit time.- First mile transit time (in days) = Handover date - Pickup date + */ + transit_time?: string; + /** + * The field provides the link for modifying delivery instructions (such as delivery date and shipping address), if supported by the first-mile carrier. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_redirect_link?: string; + /** + * The field contains the official tracking URL of the first-mile carrier, if available. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_tracking_link?: string; +} diff --git a/src/model/FirstMileMarkTrackingCompletedByIdResponse.ts b/src/model/FirstMileMarkTrackingCompletedByIdResponse.ts new file mode 100644 index 0000000..4ea0cc5 --- /dev/null +++ b/src/model/FirstMileMarkTrackingCompletedByIdResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface FirstMileMarkTrackingCompletedByIdResponse { + /** + * The tracking number of the first-mile carrier. + */ + tracking_number?: string; + /** + * The unique code of the carrier responsible for the first-mile of the shipment. Find all the courier slugs . + */ + slug?: string; + /** + * The transit time for the first-mile of a shipment in days. This field is calculated based on whether the handed_over_to_last_mile_carrier or received_by_last_mile_carrier event is detected by AfterShip. The handover event date is used to calculate the first-mile transit time.- First mile transit time (in days) = Handover date - Pickup date + */ + transit_time?: string; + /** + * The field provides the link for modifying delivery instructions (such as delivery date and shipping address), if supported by the first-mile carrier. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_redirect_link?: string; + /** + * The field contains the official tracking URL of the first-mile carrier, if available. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_tracking_link?: string; +} diff --git a/src/model/FirstMileRetrackTrackingByIdResponse.ts b/src/model/FirstMileRetrackTrackingByIdResponse.ts new file mode 100644 index 0000000..d9a465b --- /dev/null +++ b/src/model/FirstMileRetrackTrackingByIdResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface FirstMileRetrackTrackingByIdResponse { + /** + * The tracking number of the first-mile carrier. + */ + tracking_number?: string; + /** + * The unique code of the carrier responsible for the first-mile of the shipment. Find all the courier slugs . + */ + slug?: string; + /** + * The transit time for the first-mile of a shipment in days. This field is calculated based on whether the handed_over_to_last_mile_carrier or received_by_last_mile_carrier event is detected by AfterShip. The handover event date is used to calculate the first-mile transit time.- First mile transit time (in days) = Handover date - Pickup date + */ + transit_time?: string; + /** + * The field provides the link for modifying delivery instructions (such as delivery date and shipping address), if supported by the first-mile carrier. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_redirect_link?: string; + /** + * The field contains the official tracking URL of the first-mile carrier, if available. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_tracking_link?: string; +} diff --git a/src/model/FirstMileTracking.ts b/src/model/FirstMileTracking.ts new file mode 100644 index 0000000..b6096d3 --- /dev/null +++ b/src/model/FirstMileTracking.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface FirstMileTracking { + /** + * The tracking number of the first-mile carrier. + */ + tracking_number?: string; + /** + * The unique code of the carrier responsible for the first-mile of the shipment. Find all the courier slugs . + */ + slug?: string; + /** + * The transit time for the first-mile of a shipment in days. This field is calculated based on whether the handed_over_to_last_mile_carrier or received_by_last_mile_carrier event is detected by AfterShip. The handover event date is used to calculate the first-mile transit time.- First mile transit time (in days) = Handover date - Pickup date + */ + transit_time?: string; + /** + * The field provides the link for modifying delivery instructions (such as delivery date and shipping address), if supported by the first-mile carrier. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_redirect_link?: string; + /** + * The field contains the official tracking URL of the first-mile carrier, if available. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_tracking_link?: string; +} diff --git a/src/model/FirstMileUpdateTrackingByIdResponse.ts b/src/model/FirstMileUpdateTrackingByIdResponse.ts new file mode 100644 index 0000000..cdfdcef --- /dev/null +++ b/src/model/FirstMileUpdateTrackingByIdResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface FirstMileUpdateTrackingByIdResponse { + /** + * The tracking number of the first-mile carrier. + */ + tracking_number?: string; + /** + * The unique code of the carrier responsible for the first-mile of the shipment. Find all the courier slugs . + */ + slug?: string; + /** + * The transit time for the first-mile of a shipment in days. This field is calculated based on whether the handed_over_to_last_mile_carrier or received_by_last_mile_carrier event is detected by AfterShip. The handover event date is used to calculate the first-mile transit time.- First mile transit time (in days) = Handover date - Pickup date + */ + transit_time?: string; + /** + * The field provides the link for modifying delivery instructions (such as delivery date and shipping address), if supported by the first-mile carrier. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_redirect_link?: string; + /** + * The field contains the official tracking URL of the first-mile carrier, if available. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_tracking_link?: string; +} diff --git a/src/model/GetAllCouriersResponse.ts b/src/model/GetAllCouriersResponse.ts new file mode 100644 index 0000000..c5e224b --- /dev/null +++ b/src/model/GetAllCouriersResponse.ts @@ -0,0 +1,16 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { Courier } from "./Courier"; + +export interface GetAllCouriersResponse { + /** + * Total count of courier objects + */ + total?: number; + /** + * Array of object. + */ + couriers?: Courier[]; +} diff --git a/src/model/GetTrackingByIdQuery.ts b/src/model/GetTrackingByIdQuery.ts new file mode 100644 index 0000000..98e9808 --- /dev/null +++ b/src/model/GetTrackingByIdQuery.ts @@ -0,0 +1,8 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +export interface GetTrackingByIdQuery { + fields?: string; + lang?: string; +} diff --git a/src/model/GetTrackingByIdResponse.ts b/src/model/GetTrackingByIdResponse.ts new file mode 100644 index 0000000..07baeb2 --- /dev/null +++ b/src/model/GetTrackingByIdResponse.ts @@ -0,0 +1,335 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { CourierEstimatedDeliveryDateGetTrackingByIdResponse } from "./CourierEstimatedDeliveryDateGetTrackingByIdResponse"; +import { ShipmentWeightGetTrackingByIdResponse } from "./ShipmentWeightGetTrackingByIdResponse"; +import { TagV1 } from "./TagV1"; +import { Checkpoint } from "./Checkpoint"; +import { AftershipEstimatedDeliveryDateGetTrackingByIdResponse } from "./AftershipEstimatedDeliveryDateGetTrackingByIdResponse"; +import { CustomEstimatedDeliveryDateGetTrackingByIdResponse } from "./CustomEstimatedDeliveryDateGetTrackingByIdResponse"; +import { FirstEstimatedDeliveryGetTrackingByIdResponse } from "./FirstEstimatedDeliveryGetTrackingByIdResponse"; +import { LatestEstimatedDeliveryGetTrackingByIdResponse } from "./LatestEstimatedDeliveryGetTrackingByIdResponse"; +import { CarbonEmissionsGetTrackingByIdResponse } from "./CarbonEmissionsGetTrackingByIdResponse"; +import { FirstMileGetTrackingByIdResponse } from "./FirstMileGetTrackingByIdResponse"; +import { LastMileGetTrackingByIdResponse } from "./LastMileGetTrackingByIdResponse"; +import { CustomersGetTrackingByIdResponse } from "./CustomersGetTrackingByIdResponse"; + +export interface GetTrackingByIdResponse { + /** + * Tracking ID. + */ + id?: string; + /** + * The length of the tracking ID has been increased from 24 characters to 32 characters. We will use the legacy_id field to store the original 24-character tracking ID to maintain compatibility with existing data. Therefore, all tracking endpoints will continue to work with the legacy_id field as before. + */ + legacy_id?: string; + /** + * The date and time the shipment was imported or added to AfterShip. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0. + */ + created_at?: string; + /** + * The date and time the shipment was updated. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0. + */ + updated_at?: string; + /** + * Tracking number. + */ + tracking_number?: string; + /** + * Unique courier code. When importing a shipment with no courier slug and the tracking number can’t be recognized, the courier will be marked as `unrecognized`. Get courier codes . + */ + slug?: string; + /** + * Whether or not AfterShip will continue tracking the shipments. Value is `false` when tag (status) is `Delivered`, `Expired`, or further updates for 30 days since last update. + */ + active?: boolean; + /** + * Custom fields that accept an object with string field. In order to protect the privacy of your customers, do not include any in custom fields. + */ + custom_fields?: { [key: string]: any }; + /** + * Total transit time in days.- For delivered shipments: Transit time (in days) = Delivered date - Pick-up date- For undelivered shipments: Transit time (in days) = Current date - Pick-up dateValue as `null` for the shipment without pick-up date. + */ + transit_time?: number; + /** + * The for the origin country/region. E.g. USA for the United States. + */ + origin_country_region?: string; + /** + * The state of the sender’s address. + */ + origin_state?: string; + /** + * The city of the sender’s address. + */ + origin_city?: string; + /** + * The postal code of the sender’s address. + */ + origin_postal_code?: string; + /** + * The sender address that the shipment is shipping from. + */ + origin_raw_location?: string; + /** + * The for the destination country/region. E.g. USA for the United States. + */ + destination_country_region?: string; + /** + * The state of the recipient’s address. + */ + destination_state?: string; + /** + * The city of the recipient’s address. + */ + destination_city?: string; + /** + * The postal code of the recipient’s address. + */ + destination_postal_code?: string; + /** + * The shipping address that the shipment is shipping to. + */ + destination_raw_location?: string; + /** + * Destination country/region of the tracking detected from the courier. ISO Alpha-3 (three letters). Value will be `null` if the courier doesn't provide the destination country. + */ + courier_destination_country_region?: string; + /** + * The field contains the estimated delivery date provided by the carrier. + */ + courier_estimated_delivery_date?: CourierEstimatedDeliveryDateGetTrackingByIdResponse; + /** + * Text field for the note. + */ + note?: string; + /** + * A globally-unique identifier for the order. + */ + order_id?: string; + /** + * The URL for the order in your system or store. + */ + order_id_path?: string; + /** + * The date and time the order was created in your system or store. It uses the format: `YYYY-MM-DDTHH:mm:ssZ` based on whichever timezone you provide. + */ + order_date?: string; + /** + * Number of packages under the tracking. + */ + shipment_package_count?: number; + /** + * The date and time the shipment was picked up by the carrier. It uses the timezone where the pickup occured. The format may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + shipment_pickup_date?: string; + /** + * The date and time the shipment was delivered. It uses the shipment recipient’s timezone. The format may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + shipment_delivery_date?: string; + /** + * The carrier service type for the shipment. + */ + shipment_type?: string; + /** + * The shipment_weight field represents the total weight of the shipment. In scenarios where the carrier does not provide this information, you can provide the weight to AfterShip. We will prioritize the data provided by the carrier, if available. The shipment weight will be included in the Response and accessed through the GET API, Webhook, and CSV export. It will also be displayed on the AfterShip Tracking admin. Additionally, it plays a significant role in error-free shipment handling and carbon emission calculations, ensuring accurate and informed decision-making + */ + shipment_weight?: ShipmentWeightGetTrackingByIdResponse; + /** + * Signed by information for delivered shipment. + */ + signed_by?: string; + /** + * Source of how this tracking is added. + */ + source?: string; + /** + * Current status of tracking. ( + */ + tag?: TagV1; + /** + * Current subtag of tracking. ( + */ + subtag?: string; + /** + * Normalized tracking message. ( + */ + subtag_message?: string; + /** + * By default this field shows the `tracking_number`, but you can customize it as you wish with any info (e.g. the order number). + */ + title?: string; + /** + * Number of attempts AfterShip tracks at courier's system. + */ + tracked_count?: number; + /** + * Indicates if the shipment is trackable till the final destination.Three possible values:- true- false- null + */ + last_mile_tracking_supported?: boolean; + /** + * The recipient’s language. If you set up AfterShip notifications in different languages, we use this to send the recipient tracking updates in their preferred language. + */ + language?: string; + /** + * Deprecated + */ + unique_token?: string; + /** + * Array of checkpoint object describes the checkpoint information. + */ + checkpoints?: Checkpoint[]; + /** + * Phone number(s) subscribed to receive sms notifications. + */ + subscribed_smses?: string[]; + /** + * Email address(es) subscribed to receive email notifications. + */ + subscribed_emails?: string[]; + /** + * Whether or not the shipment is returned to sender. Value is `true` when any of its checkpoints has subtag `Exception_010` (returning to sender) or `Exception_011` (returned to sender). Otherwise value is `false`. + */ + return_to_sender?: boolean; + /** + * The promised delivery date of the order. It uses the formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + order_promised_delivery_date?: string; + /** + * Shipment delivery type- pickup_at_store- pickup_at_courier- door_to_door + */ + delivery_type?: string; + /** + * Shipment pickup location for receiver + */ + pickup_location?: string; + /** + * Shipment pickup note for receiver + */ + pickup_note?: string; + /** + * Official tracking URL of the courier (if any). The language parameter of this link relies on the destination country/region and the language associated with the shipment, if the data regarding the destination country/region and language of the shipment is not available, AfterShip will set the language parameter of the link to "US" by default. + */ + courier_tracking_link?: string; + /** + * The date and time of the carrier’s first attempt to deliver the package to the recipient. It uses the shipment recipient’s timezone. The format may differ depending on how the carrier provides it:- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + first_attempted_at?: string; + /** + * Delivery instructions (delivery date or address) can be modified by visiting the link if supported by a carrier. The language parameter of this link relies on the destination country/region and the language associated with the shipment, if the data regarding the destination country/region and language of the shipment is not available, AfterShip will set the language parameter of the link to "US" by default. + */ + courier_redirect_link?: string; + /** + * Additional field required by some carriers to retrieve the tracking info. The shipper’s carrier account number. Refer to our article on for more details. + */ + tracking_account_number?: string; + /** + * Additional field required by some carriers to retrieve the tracking info. A type of tracking credential required by some carriers. Refer to our article on for more details. + */ + tracking_key?: string; + /** + * The date and time when the shipment is shipped by the merchant and ready for pickup by the carrier. The field supports the following formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZThe field serves two key purposes:- Calculate processing time metrics in the Order-to-delivery Analytics dashboard. To ensure accurate analytics, it's recommended to include timezone information when configuring this value- Required by certain carriers to retrieve tracking information as an additional tracking field. + */ + tracking_ship_date?: string; + /** + * Whether the tracking is delivered on time or not. + */ + on_time_status?: string; + /** + * The difference days of the on time. + */ + on_time_difference?: number; + /** + * The tags of the order. + */ + order_tags?: string[]; + /** + * The estimated delivery date of the shipment provided by AfterShip’s AI and shown to the recipients. It uses the format `YYYY-MM-DD` based on the shipment recipient’s timezone. + */ + aftership_estimated_delivery_date?: AftershipEstimatedDeliveryDateGetTrackingByIdResponse; + /** + * Estimated delivery time of the shipment based on your . It uses the format `YYYY-MM-DD` based on the shipment recipient’s timezone. + */ + custom_estimated_delivery_date?: CustomEstimatedDeliveryDateGetTrackingByIdResponse; + /** + * A unique, human-readable identifier for the order. + */ + order_number?: string; + /** + * The shipment’s original estimated delivery date. It could be provided by the carrier, AfterShip AI, or based on your custom settings. The format of carrier EDDs may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ AfterShip AI and custom EDDs always use the format `YYYY-MM-DD`. All EDDs use the shipment recipient’s timezone. + */ + first_estimated_delivery?: FirstEstimatedDeliveryGetTrackingByIdResponse; + /** + * The most recently calculated estimated delivery date. It could be provided by the carrier, AfterShip AI, or based on your custom settings. The format of carrier EDDs may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ AfterShip AI and custom EDDs always use the format `YYYY-MM-DD`. All EDDs use the shipment recipient’s timezone. + */ + latest_estimated_delivery?: LatestEstimatedDeliveryGetTrackingByIdResponse; + /** + * Used to add tags to your shipments to help categorize and filter them easily. + */ + shipment_tags?: string[]; + /** + * If you have multiple accounts connected for a single carrier on AfterShip, we have introduced the courier_connection_id field to allow you to specify the carrier account associated with each shipment. By providing this information, you enable us to accurately track and monitor your shipments based on the correct carrier account.(</br>In the event that you do not specify the courier_connection_id, we will handle your shipment using the connection that was created earliest among your connected accounts. + */ + courier_connection_id?: string; + /** + * (Legacy) Replaced by `origin_country_region`. Additional field required by some carriers to retrieve the tracking info. The origin country/region of the shipment. Refer to our article on for more details. + */ + tracking_origin_country_region?: string; + /** + * (Legacy) Replaced by `destination_country_region`. Additional field required by some carriers to retrieve the tracking info. The destination country/region of the shipment. Refer to our article on for more details. + */ + tracking_destination_country_region?: string; + /** + * (Legacy) Replaced by `destination_postal_code`. Additional field required by some carriers to retrieve the tracking info. The postal code of the recipient’s address. Refer to our article on for more details. + */ + tracking_postal_code?: string; + /** + * (Legacy) Replaced by `destination_state`. Additional field required by some carriers to retrieve the tracking info. The state/province of the recipient’s address. Refer to our article on for more details. + */ + tracking_state?: string; + /** + * The model contains the total amount of carbon emissions generated by the shipment. - AfterShip will provide this data only when it is available, and its availability is contingent upon the location and weight information that AfterShip can obtain.- The values will be accessible solely for shipments that have been successfully delivered. However, in the event of a shipping update after the delivery status has been achieved, the value may change.- It’s a paid service and only for Tracking Enterprise users, please contact your customer success manager if you want to know more. + */ + carbon_emissions?: CarbonEmissionsGetTrackingByIdResponse; + /** + * The location_id refers to the place where you fulfilled the items. - If you provide a location_id, the system will automatically use it as the tracking's origin address. However, passing both location_id and any origin address information simultaneously is not allowed.- Please make sure you add your locations . + */ + location_id?: string; + /** + * The shipping_method string refers to the chosen method for delivering the package. Merchants typically offer various shipping methods to consumers during the checkout process, such as, Local Delivery, Free Express Worldwide Shipping, etc. + */ + shipping_method?: string; + /** + * By dynamically tracking failed delivery attempts during shipment, this field allows you to pinpoint carriers accountable for the most failures. Analyzing the root cause of these failures enables you to improve carriers' delivery standard operating procedures (SOP), leading to an overall enhancement in delivery service quality. + */ + failed_delivery_attempts?: number; + /** + * The signature_requirement field serves the purpose of validating the service option type, specifically proof of delivery. By collecting the recipient's signature upon delivery, it ensures the package reaches the intended recipient and prevents disputes related to non-delivery or lost packages.</br> + */ + signature_requirement?: string; + /** + * The delivery location type represents the secure area where the carrier leaves the package, such as a safe place, locker, mailbox, front porch, etc. This information helps ensure the shipment reaches the intended recipient efficiently, minimizing the risk of theft or damage. + */ + delivery_location_type?: string; + /** + * The tracking URL directs your customers to the shipment tracking page which can display either the default or a customized page based on segmentation rules.- The universal URL is used by default, but you can opt for a custom domain if you have one. Learn how to set up a custom domain .The field is not automatically enabled in API & Webhook. Please contact support if you’d like to enable it. + */ + aftership_tracking_url?: string; + /** + * The order URL directs your customers to the order tracking page, which includes all shipments. It can display either the default or a customized page based on segmentation rules.- The universal URL is used by default, but you can opt for a custom domain if you have one. Learn how to set up a custom domain .The field is not automatically enabled in API & Webhook. Please contact support if you’d like to enable it. + */ + aftership_tracking_order_url?: string; + /** + * The field contains information about the first leg of the shipping starting from the carrier picking up the shipment from the shipper to the point where they hand it over to the last-mile carrier. Once AfterShip detects the shipment is multi-leg, we will populate the first-mile information under this object. + */ + first_mile?: FirstMileGetTrackingByIdResponse; + /** + * This field contains information about the last leg of the shipment, starting from the carrier who hands it over to the last-mile carrier, all the way to delivery. Once AfterShip detects that the shipment involves multiple legs and identifies the last-mile carrier, we will populate the last-mile carrier information in this object. Alternatively, the user can provide this information in this field to specify the last-mile carrier, which is helpful if AfterShip is unable to detect it automatically. + */ + last_mile?: LastMileGetTrackingByIdResponse; + /** + * The field contains the customer information associated with the tracking. A maximum of three customer objects are allowed. + */ + customers?: CustomersGetTrackingByIdResponse[]; +} diff --git a/src/model/GetTrackingsQuery.ts b/src/model/GetTrackingsQuery.ts new file mode 100644 index 0000000..f34251c --- /dev/null +++ b/src/model/GetTrackingsQuery.ts @@ -0,0 +1,24 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +export interface GetTrackingsQuery { + cursor?: string; + limit?: number; + keyword?: string; + tracking_numbers?: string; + slug?: string; + transit_time?: number; + origin?: string; + destination?: string; + tag?: string; + created_at_min?: string; + created_at_max?: string; + updated_at_min?: string; + updated_at_max?: string; + fields?: string; + return_to_sender?: string; + courier_destination_country_region?: string; + shipment_tags?: string; + order_id?: string; +} diff --git a/src/model/GetTrackingsResponse.ts b/src/model/GetTrackingsResponse.ts new file mode 100644 index 0000000..62e6f85 --- /dev/null +++ b/src/model/GetTrackingsResponse.ts @@ -0,0 +1,17 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { Tracking } from "./Tracking"; +import { Pagination } from "./Pagination"; + +export interface GetTrackingsResponse { + /** + * + */ + pagination: Pagination; + /** + * Array of + */ + trackings?: Tracking[]; +} diff --git a/src/model/GetUserCouriersResponse.ts b/src/model/GetUserCouriersResponse.ts new file mode 100644 index 0000000..9fb76f7 --- /dev/null +++ b/src/model/GetUserCouriersResponse.ts @@ -0,0 +1,16 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { Courier } from "./Courier"; + +export interface GetUserCouriersResponse { + /** + * Total count of courier objects + */ + total?: number; + /** + * Array of object. + */ + couriers?: Courier[]; +} diff --git a/src/model/LastMileCreateTrackingRequest.ts b/src/model/LastMileCreateTrackingRequest.ts new file mode 100644 index 0000000..49e10b4 --- /dev/null +++ b/src/model/LastMileCreateTrackingRequest.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface LastMileCreateTrackingRequest { + /** + * The tracking number of the last-mile carrier. + */ + tracking_number: string; + /** + * The unique code of the carrier responsible for the last-mile of the shipment. Find all the courier slugs . + */ + slug?: string; +} diff --git a/src/model/LastMileCreateTrackingResponse.ts b/src/model/LastMileCreateTrackingResponse.ts new file mode 100644 index 0000000..2c8de6c --- /dev/null +++ b/src/model/LastMileCreateTrackingResponse.ts @@ -0,0 +1,31 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface LastMileCreateTrackingResponse { + /** + * The tracking number of the last-mile carrier. + */ + tracking_number?: string; + /** + * The unique code of the carrier responsible for the last-mile of the shipment. Find all the courier slugs . + */ + slug?: string; + /** + * The transit time for the last-mile of a shipment in days. This field is calculated based on whether the handed_over_to_last_mile_carrier or the received_by_last_mile_carrier event is detected by AfterShip. The handover event date is used to calculate the last-mile transit time.- Last mile transit time (in days)= Delivered date - Handover date + */ + transit_time?: string; + /** + * The field contains the official tracking URL of the last-mile carrier, if available. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_tracking_link?: string; + /** + * The field provides the link for modifying delivery instructions (such as delivery date and shipping address), if supported by the last-mile carrier. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_redirect_link?: string; + /** + * The field indicates the source of last-mile carrier. + */ + source?: string; +} diff --git a/src/model/LastMileDeleteTrackingByIdResponse.ts b/src/model/LastMileDeleteTrackingByIdResponse.ts new file mode 100644 index 0000000..88cb7a9 --- /dev/null +++ b/src/model/LastMileDeleteTrackingByIdResponse.ts @@ -0,0 +1,31 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface LastMileDeleteTrackingByIdResponse { + /** + * The tracking number of the last-mile carrier. + */ + tracking_number?: string; + /** + * The unique code of the carrier responsible for the last-mile of the shipment. Find all the courier slugs . + */ + slug?: string; + /** + * The transit time for the last-mile of a shipment in days. This field is calculated based on whether the handed_over_to_last_mile_carrier or the received_by_last_mile_carrier event is detected by AfterShip. The handover event date is used to calculate the last-mile transit time.- Last mile transit time (in days)= Delivered date - Handover date + */ + transit_time?: string; + /** + * The field contains the official tracking URL of the last-mile carrier, if available. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_tracking_link?: string; + /** + * The field provides the link for modifying delivery instructions (such as delivery date and shipping address), if supported by the last-mile carrier. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_redirect_link?: string; + /** + * The field indicates the source of last-mile carrier. + */ + source?: string; +} diff --git a/src/model/LastMileGetTrackingByIdResponse.ts b/src/model/LastMileGetTrackingByIdResponse.ts new file mode 100644 index 0000000..cf1ca5f --- /dev/null +++ b/src/model/LastMileGetTrackingByIdResponse.ts @@ -0,0 +1,31 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface LastMileGetTrackingByIdResponse { + /** + * The tracking number of the last-mile carrier. + */ + tracking_number?: string; + /** + * The unique code of the carrier responsible for the last-mile of the shipment. Find all the courier slugs . + */ + slug?: string; + /** + * The transit time for the last-mile of a shipment in days. This field is calculated based on whether the handed_over_to_last_mile_carrier or the received_by_last_mile_carrier event is detected by AfterShip. The handover event date is used to calculate the last-mile transit time.- Last mile transit time (in days)= Delivered date - Handover date + */ + transit_time?: string; + /** + * The field contains the official tracking URL of the last-mile carrier, if available. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_tracking_link?: string; + /** + * The field provides the link for modifying delivery instructions (such as delivery date and shipping address), if supported by the last-mile carrier. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_redirect_link?: string; + /** + * The field indicates the source of last-mile carrier. + */ + source?: string; +} diff --git a/src/model/LastMileMarkTrackingCompletedByIdResponse.ts b/src/model/LastMileMarkTrackingCompletedByIdResponse.ts new file mode 100644 index 0000000..40bdb3e --- /dev/null +++ b/src/model/LastMileMarkTrackingCompletedByIdResponse.ts @@ -0,0 +1,31 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface LastMileMarkTrackingCompletedByIdResponse { + /** + * The tracking number of the last-mile carrier. + */ + tracking_number?: string; + /** + * The unique code of the carrier responsible for the last-mile of the shipment. Find all the courier slugs . + */ + slug?: string; + /** + * The transit time for the last-mile of a shipment in days. This field is calculated based on whether the handed_over_to_last_mile_carrier or the received_by_last_mile_carrier event is detected by AfterShip. The handover event date is used to calculate the last-mile transit time.- Last mile transit time (in days)= Delivered date - Handover date + */ + transit_time?: string; + /** + * The field contains the official tracking URL of the last-mile carrier, if available. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_tracking_link?: string; + /** + * The field provides the link for modifying delivery instructions (such as delivery date and shipping address), if supported by the last-mile carrier. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_redirect_link?: string; + /** + * The field indicates the source of last-mile carrier. + */ + source?: string; +} diff --git a/src/model/LastMileRetrackTrackingByIdResponse.ts b/src/model/LastMileRetrackTrackingByIdResponse.ts new file mode 100644 index 0000000..2df98e7 --- /dev/null +++ b/src/model/LastMileRetrackTrackingByIdResponse.ts @@ -0,0 +1,31 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface LastMileRetrackTrackingByIdResponse { + /** + * The tracking number of the last-mile carrier. + */ + tracking_number?: string; + /** + * The unique code of the carrier responsible for the last-mile of the shipment. Find all the courier slugs . + */ + slug?: string; + /** + * The transit time for the last-mile of a shipment in days. This field is calculated based on whether the handed_over_to_last_mile_carrier or the received_by_last_mile_carrier event is detected by AfterShip. The handover event date is used to calculate the last-mile transit time.- Last mile transit time (in days)= Delivered date - Handover date + */ + transit_time?: string; + /** + * The field contains the official tracking URL of the last-mile carrier, if available. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_tracking_link?: string; + /** + * The field provides the link for modifying delivery instructions (such as delivery date and shipping address), if supported by the last-mile carrier. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_redirect_link?: string; + /** + * The field indicates the source of last-mile carrier. + */ + source?: string; +} diff --git a/src/model/LastMileTracking.ts b/src/model/LastMileTracking.ts new file mode 100644 index 0000000..45932f7 --- /dev/null +++ b/src/model/LastMileTracking.ts @@ -0,0 +1,31 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface LastMileTracking { + /** + * The tracking number of the last-mile carrier. + */ + tracking_number?: string; + /** + * The unique code of the carrier responsible for the last-mile of the shipment. Find all the courier slugs . + */ + slug?: string; + /** + * The transit time for the last-mile of a shipment in days. This field is calculated based on whether the handed_over_to_last_mile_carrier or the received_by_last_mile_carrier event is detected by AfterShip. The handover event date is used to calculate the last-mile transit time.- Last mile transit time (in days)= Delivered date - Handover date + */ + transit_time?: string; + /** + * The field contains the official tracking URL of the last-mile carrier, if available. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_tracking_link?: string; + /** + * The field provides the link for modifying delivery instructions (such as delivery date and shipping address), if supported by the last-mile carrier. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_redirect_link?: string; + /** + * The field indicates the source of last-mile carrier. + */ + source?: string; +} diff --git a/src/model/LastMileUpdateTrackingByIdResponse.ts b/src/model/LastMileUpdateTrackingByIdResponse.ts new file mode 100644 index 0000000..fcffb13 --- /dev/null +++ b/src/model/LastMileUpdateTrackingByIdResponse.ts @@ -0,0 +1,31 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface LastMileUpdateTrackingByIdResponse { + /** + * The tracking number of the last-mile carrier. + */ + tracking_number?: string; + /** + * The unique code of the carrier responsible for the last-mile of the shipment. Find all the courier slugs . + */ + slug?: string; + /** + * The transit time for the last-mile of a shipment in days. This field is calculated based on whether the handed_over_to_last_mile_carrier or the received_by_last_mile_carrier event is detected by AfterShip. The handover event date is used to calculate the last-mile transit time.- Last mile transit time (in days)= Delivered date - Handover date + */ + transit_time?: string; + /** + * The field contains the official tracking URL of the last-mile carrier, if available. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_tracking_link?: string; + /** + * The field provides the link for modifying delivery instructions (such as delivery date and shipping address), if supported by the last-mile carrier. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US". + */ + courier_redirect_link?: string; + /** + * The field indicates the source of last-mile carrier. + */ + source?: string; +} diff --git a/src/model/LatestEstimatedDeliveryCreateTrackingResponse.ts b/src/model/LatestEstimatedDeliveryCreateTrackingResponse.ts new file mode 100644 index 0000000..f839c2f --- /dev/null +++ b/src/model/LatestEstimatedDeliveryCreateTrackingResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface LatestEstimatedDeliveryCreateTrackingResponse { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The source of the EDD. Either the carrier, AfterShip AI, or based on your custom EDD settings. + */ + source?: string; + /** + * The latest EDD time. + */ + datetime?: string; + /** + * For a date range EDD format, the date and time for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date and time for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/LatestEstimatedDeliveryDeleteTrackingByIdResponse.ts b/src/model/LatestEstimatedDeliveryDeleteTrackingByIdResponse.ts new file mode 100644 index 0000000..5aee21e --- /dev/null +++ b/src/model/LatestEstimatedDeliveryDeleteTrackingByIdResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface LatestEstimatedDeliveryDeleteTrackingByIdResponse { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The source of the EDD. Either the carrier, AfterShip AI, or based on your custom EDD settings. + */ + source?: string; + /** + * The latest EDD time. + */ + datetime?: string; + /** + * For a date range EDD format, the date and time for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date and time for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/LatestEstimatedDeliveryGetTrackingByIdResponse.ts b/src/model/LatestEstimatedDeliveryGetTrackingByIdResponse.ts new file mode 100644 index 0000000..70154f2 --- /dev/null +++ b/src/model/LatestEstimatedDeliveryGetTrackingByIdResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface LatestEstimatedDeliveryGetTrackingByIdResponse { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The source of the EDD. Either the carrier, AfterShip AI, or based on your custom EDD settings. + */ + source?: string; + /** + * The latest EDD time. + */ + datetime?: string; + /** + * For a date range EDD format, the date and time for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date and time for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/LatestEstimatedDeliveryMarkTrackingCompletedByIdResponse.ts b/src/model/LatestEstimatedDeliveryMarkTrackingCompletedByIdResponse.ts new file mode 100644 index 0000000..c232f91 --- /dev/null +++ b/src/model/LatestEstimatedDeliveryMarkTrackingCompletedByIdResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface LatestEstimatedDeliveryMarkTrackingCompletedByIdResponse { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The source of the EDD. Either the carrier, AfterShip AI, or based on your custom EDD settings. + */ + source?: string; + /** + * The latest EDD time. + */ + datetime?: string; + /** + * For a date range EDD format, the date and time for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date and time for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/LatestEstimatedDeliveryRetrackTrackingByIdResponse.ts b/src/model/LatestEstimatedDeliveryRetrackTrackingByIdResponse.ts new file mode 100644 index 0000000..c6022dd --- /dev/null +++ b/src/model/LatestEstimatedDeliveryRetrackTrackingByIdResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface LatestEstimatedDeliveryRetrackTrackingByIdResponse { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The source of the EDD. Either the carrier, AfterShip AI, or based on your custom EDD settings. + */ + source?: string; + /** + * The latest EDD time. + */ + datetime?: string; + /** + * For a date range EDD format, the date and time for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date and time for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/LatestEstimatedDeliveryTracking.ts b/src/model/LatestEstimatedDeliveryTracking.ts new file mode 100644 index 0000000..9eee155 --- /dev/null +++ b/src/model/LatestEstimatedDeliveryTracking.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface LatestEstimatedDeliveryTracking { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The source of the EDD. Either the carrier, AfterShip AI, or based on your custom EDD settings. + */ + source?: string; + /** + * The latest EDD time. + */ + datetime?: string; + /** + * For a date range EDD format, the date and time for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date and time for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/LatestEstimatedDeliveryUpdateTrackingByIdResponse.ts b/src/model/LatestEstimatedDeliveryUpdateTrackingByIdResponse.ts new file mode 100644 index 0000000..97e66c0 --- /dev/null +++ b/src/model/LatestEstimatedDeliveryUpdateTrackingByIdResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface LatestEstimatedDeliveryUpdateTrackingByIdResponse { + /** + * The format of the EDD. Either a single date or a date range. + */ + type?: string; + /** + * The source of the EDD. Either the carrier, AfterShip AI, or based on your custom EDD settings. + */ + source?: string; + /** + * The latest EDD time. + */ + datetime?: string; + /** + * For a date range EDD format, the date and time for the lower end of the range. + */ + datetime_min?: string; + /** + * For a date range EDD format, the date and time for the upper end of the range. + */ + datetime_max?: string; +} diff --git a/src/model/MarkTrackingCompletedByIdRequest.ts b/src/model/MarkTrackingCompletedByIdRequest.ts new file mode 100644 index 0000000..8087427 --- /dev/null +++ b/src/model/MarkTrackingCompletedByIdRequest.ts @@ -0,0 +1,11 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface MarkTrackingCompletedByIdRequest { + /** + * One of `DELIVERED`, `LOST` or `RETURNED_TO_SENDER`.- Mark the tracking as completed with `DELIVERED`. The tag of the tracking will be updated to `Delivered` and the subtag will be updated to `Delivered_001`.- Mark the tracking as completed with `LOST`. The tag of the tracking will be updated to `Exception` and the subtag will be updated to `Exception_013`.- Mark the tracking as completed with `RETURNED_TO_SENDER`. The tag of the tracking will be updated to `Exception` and the subtag will be updated to `Exception_011`. + */ + reason: string; +} diff --git a/src/model/MarkTrackingCompletedByIdResponse.ts b/src/model/MarkTrackingCompletedByIdResponse.ts new file mode 100644 index 0000000..90d664c --- /dev/null +++ b/src/model/MarkTrackingCompletedByIdResponse.ts @@ -0,0 +1,335 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { CourierEstimatedDeliveryDateMarkTrackingCompletedByIdResponse } from "./CourierEstimatedDeliveryDateMarkTrackingCompletedByIdResponse"; +import { ShipmentWeightMarkTrackingCompletedByIdResponse } from "./ShipmentWeightMarkTrackingCompletedByIdResponse"; +import { TagV1 } from "./TagV1"; +import { Checkpoint } from "./Checkpoint"; +import { AftershipEstimatedDeliveryDateMarkTrackingCompletedByIdResponse } from "./AftershipEstimatedDeliveryDateMarkTrackingCompletedByIdResponse"; +import { CustomEstimatedDeliveryDateMarkTrackingCompletedByIdResponse } from "./CustomEstimatedDeliveryDateMarkTrackingCompletedByIdResponse"; +import { FirstEstimatedDeliveryMarkTrackingCompletedByIdResponse } from "./FirstEstimatedDeliveryMarkTrackingCompletedByIdResponse"; +import { LatestEstimatedDeliveryMarkTrackingCompletedByIdResponse } from "./LatestEstimatedDeliveryMarkTrackingCompletedByIdResponse"; +import { CarbonEmissionsMarkTrackingCompletedByIdResponse } from "./CarbonEmissionsMarkTrackingCompletedByIdResponse"; +import { FirstMileMarkTrackingCompletedByIdResponse } from "./FirstMileMarkTrackingCompletedByIdResponse"; +import { LastMileMarkTrackingCompletedByIdResponse } from "./LastMileMarkTrackingCompletedByIdResponse"; +import { CustomersMarkTrackingCompletedByIdResponse } from "./CustomersMarkTrackingCompletedByIdResponse"; + +export interface MarkTrackingCompletedByIdResponse { + /** + * Tracking ID. + */ + id?: string; + /** + * The length of the tracking ID has been increased from 24 characters to 32 characters. We will use the legacy_id field to store the original 24-character tracking ID to maintain compatibility with existing data. Therefore, all tracking endpoints will continue to work with the legacy_id field as before. + */ + legacy_id?: string; + /** + * The date and time the shipment was imported or added to AfterShip. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0. + */ + created_at?: string; + /** + * The date and time the shipment was updated. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0. + */ + updated_at?: string; + /** + * Tracking number. + */ + tracking_number?: string; + /** + * Unique courier code. When importing a shipment with no courier slug and the tracking number can’t be recognized, the courier will be marked as `unrecognized`. Get courier codes . + */ + slug?: string; + /** + * Whether or not AfterShip will continue tracking the shipments. Value is `false` when tag (status) is `Delivered`, `Expired`, or further updates for 30 days since last update. + */ + active?: boolean; + /** + * Custom fields that accept an object with string field. In order to protect the privacy of your customers, do not include any in custom fields. + */ + custom_fields?: { [key: string]: any }; + /** + * Total transit time in days.- For delivered shipments: Transit time (in days) = Delivered date - Pick-up date- For undelivered shipments: Transit time (in days) = Current date - Pick-up dateValue as `null` for the shipment without pick-up date. + */ + transit_time?: number; + /** + * The for the origin country/region. E.g. USA for the United States. + */ + origin_country_region?: string; + /** + * The state of the sender’s address. + */ + origin_state?: string; + /** + * The city of the sender’s address. + */ + origin_city?: string; + /** + * The postal code of the sender’s address. + */ + origin_postal_code?: string; + /** + * The sender address that the shipment is shipping from. + */ + origin_raw_location?: string; + /** + * The for the destination country/region. E.g. USA for the United States. + */ + destination_country_region?: string; + /** + * The state of the recipient’s address. + */ + destination_state?: string; + /** + * The city of the recipient’s address. + */ + destination_city?: string; + /** + * The postal code of the recipient’s address. + */ + destination_postal_code?: string; + /** + * The shipping address that the shipment is shipping to. + */ + destination_raw_location?: string; + /** + * Destination country/region of the tracking detected from the courier. ISO Alpha-3 (three letters). Value will be `null` if the courier doesn't provide the destination country. + */ + courier_destination_country_region?: string; + /** + * The field contains the estimated delivery date provided by the carrier. + */ + courier_estimated_delivery_date?: CourierEstimatedDeliveryDateMarkTrackingCompletedByIdResponse; + /** + * Text field for the note. + */ + note?: string; + /** + * A globally-unique identifier for the order. + */ + order_id?: string; + /** + * The URL for the order in your system or store. + */ + order_id_path?: string; + /** + * The date and time the order was created in your system or store. It uses the format: `YYYY-MM-DDTHH:mm:ssZ` based on whichever timezone you provide. + */ + order_date?: string; + /** + * Number of packages under the tracking. + */ + shipment_package_count?: number; + /** + * The date and time the shipment was picked up by the carrier. It uses the timezone where the pickup occured. The format may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + shipment_pickup_date?: string; + /** + * The date and time the shipment was delivered. It uses the shipment recipient’s timezone. The format may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + shipment_delivery_date?: string; + /** + * The carrier service type for the shipment. + */ + shipment_type?: string; + /** + * The shipment_weight field represents the total weight of the shipment. In scenarios where the carrier does not provide this information, you can provide the weight to AfterShip. We will prioritize the data provided by the carrier, if available. The shipment weight will be included in the Response and accessed through the GET API, Webhook, and CSV export. It will also be displayed on the AfterShip Tracking admin. Additionally, it plays a significant role in error-free shipment handling and carbon emission calculations, ensuring accurate and informed decision-making + */ + shipment_weight?: ShipmentWeightMarkTrackingCompletedByIdResponse; + /** + * Signed by information for delivered shipment. + */ + signed_by?: string; + /** + * Source of how this tracking is added. + */ + source?: string; + /** + * Current status of tracking. ( + */ + tag?: TagV1; + /** + * Current subtag of tracking. ( + */ + subtag?: string; + /** + * Normalized tracking message. ( + */ + subtag_message?: string; + /** + * By default this field shows the `tracking_number`, but you can customize it as you wish with any info (e.g. the order number). + */ + title?: string; + /** + * Number of attempts AfterShip tracks at courier's system. + */ + tracked_count?: number; + /** + * Indicates if the shipment is trackable till the final destination.Three possible values:- true- false- null + */ + last_mile_tracking_supported?: boolean; + /** + * The recipient’s language. If you set up AfterShip notifications in different languages, we use this to send the recipient tracking updates in their preferred language. + */ + language?: string; + /** + * Deprecated + */ + unique_token?: string; + /** + * Array of checkpoint object describes the checkpoint information. + */ + checkpoints?: Checkpoint[]; + /** + * Phone number(s) subscribed to receive sms notifications. + */ + subscribed_smses?: string[]; + /** + * Email address(es) subscribed to receive email notifications. + */ + subscribed_emails?: string[]; + /** + * Whether or not the shipment is returned to sender. Value is `true` when any of its checkpoints has subtag `Exception_010` (returning to sender) or `Exception_011` (returned to sender). Otherwise value is `false`. + */ + return_to_sender?: boolean; + /** + * The promised delivery date of the order. It uses the formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + order_promised_delivery_date?: string; + /** + * Shipment delivery type- pickup_at_store- pickup_at_courier- door_to_door + */ + delivery_type?: string; + /** + * Shipment pickup location for receiver + */ + pickup_location?: string; + /** + * Shipment pickup note for receiver + */ + pickup_note?: string; + /** + * Official tracking URL of the courier (if any). The language parameter of this link relies on the destination country/region and the language associated with the shipment, if the data regarding the destination country/region and language of the shipment is not available, AfterShip will set the language parameter of the link to "US" by default. + */ + courier_tracking_link?: string; + /** + * The date and time of the carrier’s first attempt to deliver the package to the recipient. It uses the shipment recipient’s timezone. The format may differ depending on how the carrier provides it:- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + first_attempted_at?: string; + /** + * Delivery instructions (delivery date or address) can be modified by visiting the link if supported by a carrier. The language parameter of this link relies on the destination country/region and the language associated with the shipment, if the data regarding the destination country/region and language of the shipment is not available, AfterShip will set the language parameter of the link to "US" by default. + */ + courier_redirect_link?: string; + /** + * Additional field required by some carriers to retrieve the tracking info. The shipper’s carrier account number. Refer to our article on for more details. + */ + tracking_account_number?: string; + /** + * Additional field required by some carriers to retrieve the tracking info. A type of tracking credential required by some carriers. Refer to our article on for more details. + */ + tracking_key?: string; + /** + * The date and time when the shipment is shipped by the merchant and ready for pickup by the carrier. The field supports the following formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZThe field serves two key purposes:- Calculate processing time metrics in the Order-to-delivery Analytics dashboard. To ensure accurate analytics, it's recommended to include timezone information when configuring this value- Required by certain carriers to retrieve tracking information as an additional tracking field. + */ + tracking_ship_date?: string; + /** + * Whether the tracking is delivered on time or not. + */ + on_time_status?: string; + /** + * The difference days of the on time. + */ + on_time_difference?: number; + /** + * The tags of the order. + */ + order_tags?: string[]; + /** + * The estimated delivery date of the shipment provided by AfterShip’s AI and shown to the recipients. It uses the format `YYYY-MM-DD` based on the shipment recipient’s timezone. + */ + aftership_estimated_delivery_date?: AftershipEstimatedDeliveryDateMarkTrackingCompletedByIdResponse; + /** + * Estimated delivery time of the shipment based on your . It uses the format `YYYY-MM-DD` based on the shipment recipient’s timezone. + */ + custom_estimated_delivery_date?: CustomEstimatedDeliveryDateMarkTrackingCompletedByIdResponse; + /** + * A unique, human-readable identifier for the order. + */ + order_number?: string; + /** + * The shipment’s original estimated delivery date. It could be provided by the carrier, AfterShip AI, or based on your custom settings. The format of carrier EDDs may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ AfterShip AI and custom EDDs always use the format `YYYY-MM-DD`. All EDDs use the shipment recipient’s timezone. + */ + first_estimated_delivery?: FirstEstimatedDeliveryMarkTrackingCompletedByIdResponse; + /** + * The most recently calculated estimated delivery date. It could be provided by the carrier, AfterShip AI, or based on your custom settings. The format of carrier EDDs may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ AfterShip AI and custom EDDs always use the format `YYYY-MM-DD`. All EDDs use the shipment recipient’s timezone. + */ + latest_estimated_delivery?: LatestEstimatedDeliveryMarkTrackingCompletedByIdResponse; + /** + * Used to add tags to your shipments to help categorize and filter them easily. + */ + shipment_tags?: string[]; + /** + * If you have multiple accounts connected for a single carrier on AfterShip, we have introduced the courier_connection_id field to allow you to specify the carrier account associated with each shipment. By providing this information, you enable us to accurately track and monitor your shipments based on the correct carrier account.(</br>In the event that you do not specify the courier_connection_id, we will handle your shipment using the connection that was created earliest among your connected accounts. + */ + courier_connection_id?: string; + /** + * (Legacy) Replaced by `origin_country_region`. Additional field required by some carriers to retrieve the tracking info. The origin country/region of the shipment. Refer to our article on for more details. + */ + tracking_origin_country_region?: string; + /** + * (Legacy) Replaced by `destination_country_region`. Additional field required by some carriers to retrieve the tracking info. The destination country/region of the shipment. Refer to our article on for more details. + */ + tracking_destination_country_region?: string; + /** + * (Legacy) Replaced by `destination_postal_code`. Additional field required by some carriers to retrieve the tracking info. The postal code of the recipient’s address. Refer to our article on for more details. + */ + tracking_postal_code?: string; + /** + * (Legacy) Replaced by `destination_state`. Additional field required by some carriers to retrieve the tracking info. The state/province of the recipient’s address. Refer to our article on for more details. + */ + tracking_state?: string; + /** + * The model contains the total amount of carbon emissions generated by the shipment. - AfterShip will provide this data only when it is available, and its availability is contingent upon the location and weight information that AfterShip can obtain.- The values will be accessible solely for shipments that have been successfully delivered. However, in the event of a shipping update after the delivery status has been achieved, the value may change.- It’s a paid service and only for Tracking Enterprise users, please contact your customer success manager if you want to know more. + */ + carbon_emissions?: CarbonEmissionsMarkTrackingCompletedByIdResponse; + /** + * The location_id refers to the place where you fulfilled the items. - If you provide a location_id, the system will automatically use it as the tracking's origin address. However, passing both location_id and any origin address information simultaneously is not allowed.- Please make sure you add your locations . + */ + location_id?: string; + /** + * The shipping_method string refers to the chosen method for delivering the package. Merchants typically offer various shipping methods to consumers during the checkout process, such as, Local Delivery, Free Express Worldwide Shipping, etc. + */ + shipping_method?: string; + /** + * By dynamically tracking failed delivery attempts during shipment, this field allows you to pinpoint carriers accountable for the most failures. Analyzing the root cause of these failures enables you to improve carriers' delivery standard operating procedures (SOP), leading to an overall enhancement in delivery service quality. + */ + failed_delivery_attempts?: number; + /** + * The signature_requirement field serves the purpose of validating the service option type, specifically proof of delivery. By collecting the recipient's signature upon delivery, it ensures the package reaches the intended recipient and prevents disputes related to non-delivery or lost packages.</br> + */ + signature_requirement?: string; + /** + * The delivery location type represents the secure area where the carrier leaves the package, such as a safe place, locker, mailbox, front porch, etc. This information helps ensure the shipment reaches the intended recipient efficiently, minimizing the risk of theft or damage. + */ + delivery_location_type?: string; + /** + * The tracking URL directs your customers to the shipment tracking page which can display either the default or a customized page based on segmentation rules.- The universal URL is used by default, but you can opt for a custom domain if you have one. Learn how to set up a custom domain .The field is not automatically enabled in API & Webhook. Please contact support if you’d like to enable it. + */ + aftership_tracking_url?: string; + /** + * The order URL directs your customers to the order tracking page, which includes all shipments. It can display either the default or a customized page based on segmentation rules.- The universal URL is used by default, but you can opt for a custom domain if you have one. Learn how to set up a custom domain .The field is not automatically enabled in API & Webhook. Please contact support if you’d like to enable it. + */ + aftership_tracking_order_url?: string; + /** + * The field contains information about the first leg of the shipping starting from the carrier picking up the shipment from the shipper to the point where they hand it over to the last-mile carrier. Once AfterShip detects the shipment is multi-leg, we will populate the first-mile information under this object. + */ + first_mile?: FirstMileMarkTrackingCompletedByIdResponse; + /** + * This field contains information about the last leg of the shipment, starting from the carrier who hands it over to the last-mile carrier, all the way to delivery. Once AfterShip detects that the shipment involves multiple legs and identifies the last-mile carrier, we will populate the last-mile carrier information in this object. Alternatively, the user can provide this information in this field to specify the last-mile carrier, which is helpful if AfterShip is unable to detect it automatically. + */ + last_mile?: LastMileMarkTrackingCompletedByIdResponse; + /** + * The field contains the customer information associated with the tracking. A maximum of three customer objects are allowed. + */ + customers?: CustomersMarkTrackingCompletedByIdResponse[]; +} diff --git a/src/model/MetaV1.ts b/src/model/MetaV1.ts new file mode 100644 index 0000000..9378d34 --- /dev/null +++ b/src/model/MetaV1.ts @@ -0,0 +1,19 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface MetaV1 { + /** + * meta code + */ + code: number; + /** + * error message, only exist if the response status is not 2xx + */ + message?: string; + /** + * error type, only exist if the response status is not 2xx + */ + type?: string; +} diff --git a/src/model/OrderProcessingTimeEstimatedPickupEstimatedDeliveryDateRequest.ts b/src/model/OrderProcessingTimeEstimatedPickupEstimatedDeliveryDateRequest.ts new file mode 100644 index 0000000..7ef0c16 --- /dev/null +++ b/src/model/OrderProcessingTimeEstimatedPickupEstimatedDeliveryDateRequest.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface OrderProcessingTimeEstimatedPickupEstimatedDeliveryDateRequest { + /** + * Processing time of an order, from being placed to being picked up. Only support day as value now.AfterShip will set day as the default value. + */ + unit?: string; + /** + * Processing time of an order, from being placed to being picked up.AfterShip will set 0 as the default value. + */ + value?: number; +} diff --git a/src/model/OrderProcessingTimeEstimatedPickupEstimatedDeliveryDateResponse.ts b/src/model/OrderProcessingTimeEstimatedPickupEstimatedDeliveryDateResponse.ts new file mode 100644 index 0000000..ae13f4f --- /dev/null +++ b/src/model/OrderProcessingTimeEstimatedPickupEstimatedDeliveryDateResponse.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface OrderProcessingTimeEstimatedPickupEstimatedDeliveryDateResponse { + /** + * Processing time of an order, from being placed to being picked up. Only support day as value now.AfterShip will set day as the default value. + */ + unit?: string; + /** + * Processing time of an order, from being placed to being picked up.AfterShip will set 0 as the default value. + */ + value?: number; +} diff --git a/src/model/OrderProcessingTimeEstimatedPickupPredictRequest.ts b/src/model/OrderProcessingTimeEstimatedPickupPredictRequest.ts new file mode 100644 index 0000000..8c4569e --- /dev/null +++ b/src/model/OrderProcessingTimeEstimatedPickupPredictRequest.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface OrderProcessingTimeEstimatedPickupPredictRequest { + /** + * Processing time of an order, from being placed to being picked up. Only support day as value now.AfterShip will set day as the default value. + */ + unit?: string; + /** + * Processing time of an order, from being placed to being picked up.AfterShip will set 0 as the default value. + */ + value?: number; +} diff --git a/src/model/OrderProcessingTimeEstimatedPickupPredictResponse.ts b/src/model/OrderProcessingTimeEstimatedPickupPredictResponse.ts new file mode 100644 index 0000000..021b132 --- /dev/null +++ b/src/model/OrderProcessingTimeEstimatedPickupPredictResponse.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface OrderProcessingTimeEstimatedPickupPredictResponse { + /** + * Processing time of an order, from being placed to being picked up. Only support day as value now.AfterShip will set day as the default value. + */ + unit?: string; + /** + * Processing time of an order, from being placed to being picked up.AfterShip will set 0 as the default value. + */ + value?: number; +} diff --git a/src/model/OriginAddressEstimatedDeliveryDateRequest.ts b/src/model/OriginAddressEstimatedDeliveryDateRequest.ts new file mode 100644 index 0000000..7a3f262 --- /dev/null +++ b/src/model/OriginAddressEstimatedDeliveryDateRequest.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface OriginAddressEstimatedDeliveryDateRequest { + /** + * The country/region of the origin location from where the package is picked up by the carrier to be delivered to the final destination. Use 3 letters of ISO 3166-1 country/region code. + */ + country_region: string; + /** + * State, province, or the equivalent location of the origin address. Use 3 letters of ISO 3166-1 country/region code for countries/regions without state. Either `origin_address.state` or `origin_address.postal_code` is required. + */ + state?: string; + /** + * City of the origin address. Use 3 letters of ISO 3166-1 country/region code for countries/regions without City. + */ + city?: string; + /** + * Postal code of the origin address. Use 3 letters of ISO 3166-1 country/region code for countries/regions without postal code. Either `origin_address.state` or `origin_address.postal_code` is required. + */ + postal_code?: string; + /** + * Raw location of the origin address. A raw address will help AI to identify the accurate location of the origin address. + */ + raw_location?: string; +} diff --git a/src/model/OriginAddressEstimatedDeliveryDateResponse.ts b/src/model/OriginAddressEstimatedDeliveryDateResponse.ts new file mode 100644 index 0000000..5580bc2 --- /dev/null +++ b/src/model/OriginAddressEstimatedDeliveryDateResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface OriginAddressEstimatedDeliveryDateResponse { + /** + * The country/region of the origin location from where the package is picked up by the carrier to be delivered to the final destination. Use 3 letters of ISO 3166-1 country/region code. + */ + country_region: string; + /** + * State, province, or the equivalent location of the origin address. Use 3 letters of ISO 3166-1 country/region code for countries/regions without state. Either `origin_address.state` or `origin_address.postal_code` is required. + */ + state?: string; + /** + * City of the origin address. Use 3 letters of ISO 3166-1 country/region code for countries/regions without City. + */ + city?: string; + /** + * Postal code of the origin address. Use 3 letters of ISO 3166-1 country/region code for countries/regions without postal code. Either `origin_address.state` or `origin_address.postal_code` is required. + */ + postal_code?: string; + /** + * Raw location of the origin address. A raw address will help AI to identify the accurate location of the origin address. + */ + raw_location?: string; +} diff --git a/src/model/OriginAddressPredictRequest.ts b/src/model/OriginAddressPredictRequest.ts new file mode 100644 index 0000000..ff5d732 --- /dev/null +++ b/src/model/OriginAddressPredictRequest.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface OriginAddressPredictRequest { + /** + * The country/region of the origin location from where the package is picked up by the carrier to be delivered to the final destination. Use 3 letters of ISO 3166-1 country/region code. + */ + country_region: string; + /** + * State, province, or the equivalent location of the origin address. Use 3 letters of ISO 3166-1 country/region code for countries/regions without state. Either `origin_address.state` or `origin_address.postal_code` is required. + */ + state?: string; + /** + * City of the origin address. Use 3 letters of ISO 3166-1 country/region code for countries/regions without City. + */ + city?: string; + /** + * Postal code of the origin address. Use 3 letters of ISO 3166-1 country/region code for countries/regions without postal code. Either `origin_address.state` or `origin_address.postal_code` is required. + */ + postal_code?: string; + /** + * Raw location of the origin address. A raw address will help AI to identify the accurate location of the origin address. + */ + raw_location?: string; +} diff --git a/src/model/OriginAddressPredictResponse.ts b/src/model/OriginAddressPredictResponse.ts new file mode 100644 index 0000000..767298d --- /dev/null +++ b/src/model/OriginAddressPredictResponse.ts @@ -0,0 +1,27 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface OriginAddressPredictResponse { + /** + * The country/region of the origin location from where the package is picked up by the carrier to be delivered to the final destination. Use 3 letters of ISO 3166-1 country/region code. + */ + country_region: string; + /** + * State, province, or the equivalent location of the origin address. Use 3 letters of ISO 3166-1 country/region code for countries/regions without state. Either `origin_address.state` or `origin_address.postal_code` is required. + */ + state?: string; + /** + * City of the origin address. Use 3 letters of ISO 3166-1 country/region code for countries/regions without City. + */ + city?: string; + /** + * Postal code of the origin address. Use 3 letters of ISO 3166-1 country/region code for countries/regions without postal code. Either `origin_address.state` or `origin_address.postal_code` is required. + */ + postal_code?: string; + /** + * Raw location of the origin address. A raw address will help AI to identify the accurate location of the origin address. + */ + raw_location?: string; +} diff --git a/src/model/Pagination.ts b/src/model/Pagination.ts new file mode 100644 index 0000000..3a089b4 --- /dev/null +++ b/src/model/Pagination.ts @@ -0,0 +1,9 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +export interface Pagination { + total: number; + next_cursor: string; + has_next_page: boolean | null; +} diff --git a/src/model/PaginationDataTrackingResponseGetMultipleV1.ts b/src/model/PaginationDataTrackingResponseGetMultipleV1.ts new file mode 100644 index 0000000..b41a9ef --- /dev/null +++ b/src/model/PaginationDataTrackingResponseGetMultipleV1.ts @@ -0,0 +1,19 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface PaginationDataTrackingResponseGetMultipleV1 { + /** + * The total number of trackings. + */ + total?: number; + /** + * A string representing the cursor value for the next page of results. + */ + next_cursor?: string; + /** + * To indicate if next page is available. + */ + has_next_page?: boolean; +} diff --git a/src/model/PaginationGetTrackingsResponse.ts b/src/model/PaginationGetTrackingsResponse.ts new file mode 100644 index 0000000..8cbc153 --- /dev/null +++ b/src/model/PaginationGetTrackingsResponse.ts @@ -0,0 +1,19 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface PaginationGetTrackingsResponse { + /** + * The total number of trackings. + */ + total?: number; + /** + * A string representing the cursor value for the next page of results. + */ + next_cursor?: string; + /** + * To indicate if next page is available. + */ + has_next_page?: boolean; +} diff --git a/src/model/PredictBatchRequest.ts b/src/model/PredictBatchRequest.ts new file mode 100644 index 0000000..93158de --- /dev/null +++ b/src/model/PredictBatchRequest.ts @@ -0,0 +1,12 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { EstimatedDeliveryDateRequest } from "./EstimatedDeliveryDateRequest"; + +export interface PredictBatchRequest { + /** + * + */ + estimated_delivery_dates: EstimatedDeliveryDateRequest[]; +} diff --git a/src/model/PredictBatchResponse.ts b/src/model/PredictBatchResponse.ts new file mode 100644 index 0000000..c971d32 --- /dev/null +++ b/src/model/PredictBatchResponse.ts @@ -0,0 +1,12 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { EstimatedDeliveryDateResponse } from "./EstimatedDeliveryDateResponse"; + +export interface PredictBatchResponse { + /** + * + */ + estimated_delivery_dates: EstimatedDeliveryDateResponse[]; +} diff --git a/src/model/PredictRequest.ts b/src/model/PredictRequest.ts new file mode 100644 index 0000000..de2afb1 --- /dev/null +++ b/src/model/PredictRequest.ts @@ -0,0 +1,43 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { OriginAddressPredictRequest } from "./OriginAddressPredictRequest"; +import { DestinationAddressPredictRequest } from "./DestinationAddressPredictRequest"; +import { WeightPredictRequest } from "./WeightPredictRequest"; +import { EstimatedPickupPredictRequest } from "./EstimatedPickupPredictRequest"; + +export interface PredictRequest { + /** + * AfterShip's unique code of courier. Please refer to https://track.aftership.com/couriers/download. + */ + slug: string; + /** + * AfterShip’s unique code represents carrier’s shipping and delivery options. Refer to . + */ + service_type_name?: string; + /** + * The location from where the package is picked up by the carrier to be delivered to the final destination. + */ + origin_address: OriginAddressPredictRequest; + /** + * The final destination of the customer where the delivery will be made. + */ + destination_address: DestinationAddressPredictRequest; + /** + * AfterShip uses this object to calculate the total weight of the order. + */ + weight?: WeightPredictRequest; + /** + * The number of packages. + */ + package_count?: number; + /** + * The local pickup time in the origin address time zone of the package.Either `pickup_time` or `estimated_pickup` is required. + */ + pickup_time?: string; + /** + * The local pickup time of the package.Either `pickup_time` or `estimated_pickup` is required. + */ + estimated_pickup?: EstimatedPickupPredictRequest; +} diff --git a/src/model/PredictResponse.ts b/src/model/PredictResponse.ts new file mode 100644 index 0000000..c453416 --- /dev/null +++ b/src/model/PredictResponse.ts @@ -0,0 +1,63 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { OriginAddressPredictResponse } from "./OriginAddressPredictResponse"; +import { DestinationAddressPredictResponse } from "./DestinationAddressPredictResponse"; +import { WeightPredictResponse } from "./WeightPredictResponse"; +import { EstimatedPickupPredictResponse } from "./EstimatedPickupPredictResponse"; + +export interface PredictResponse { + /** + * A string that acts as a unique identifier for the estimated delivery date value generated by AfterShip Predict API + */ + id: string; + /** + * AfterShip's unique code of courier. Please refer to https://track.aftership.com/couriers/download. + */ + slug: string; + /** + * AfterShip’s unique code represents carrier’s shipping and delivery options. Refer to . + */ + service_type_name?: string; + /** + * The location from where the package is picked up by the carrier to be delivered to the final destination. + */ + origin_address: OriginAddressPredictResponse; + /** + * The final destination of the customer where the delivery will be made. + */ + destination_address: DestinationAddressPredictResponse; + /** + * AfterShip uses this object to calculate the total weight of the order. + */ + weight?: WeightPredictResponse; + /** + * The number of packages. + */ + package_count?: number; + /** + * The local pickup time in the origin address time zone of the package.Either `pickup_time` or `estimated_pickup` is required. + */ + pickup_time?: string; + /** + * The local pickup time of the package.Either `pickup_time` or `estimated_pickup` is required. + */ + estimated_pickup?: EstimatedPickupPredictResponse; + /** + * The estimated arrival date of the shipment, provided by AfterShip. + */ + estimated_delivery_date?: string; + /** + * Indicates the confidence level and associated reason for an AI EDD prediction request. For a comprehensive list of confidence codes, refer to . + */ + confidence_code?: number; + /** + * The earliest estimated delivery date of the shipment, provided by AfterShip. + */ + estimated_delivery_date_min?: string; + /** + * The latest estimated delivery date of the shipment, provided by AfterShip. + */ + estimated_delivery_date_max?: string; +} diff --git a/src/model/ReasonEventsCheckpoint.ts b/src/model/ReasonEventsCheckpoint.ts new file mode 100644 index 0000000..3065ff9 --- /dev/null +++ b/src/model/ReasonEventsCheckpoint.ts @@ -0,0 +1,11 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface ReasonEventsCheckpoint { + /** + * The code of the reason. + */ + code?: string; +} diff --git a/src/model/RetrackTrackingByIdResponse.ts b/src/model/RetrackTrackingByIdResponse.ts new file mode 100644 index 0000000..92c2407 --- /dev/null +++ b/src/model/RetrackTrackingByIdResponse.ts @@ -0,0 +1,335 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { CourierEstimatedDeliveryDateRetrackTrackingByIdResponse } from "./CourierEstimatedDeliveryDateRetrackTrackingByIdResponse"; +import { ShipmentWeightRetrackTrackingByIdResponse } from "./ShipmentWeightRetrackTrackingByIdResponse"; +import { TagV1 } from "./TagV1"; +import { Checkpoint } from "./Checkpoint"; +import { AftershipEstimatedDeliveryDateRetrackTrackingByIdResponse } from "./AftershipEstimatedDeliveryDateRetrackTrackingByIdResponse"; +import { CustomEstimatedDeliveryDateRetrackTrackingByIdResponse } from "./CustomEstimatedDeliveryDateRetrackTrackingByIdResponse"; +import { FirstEstimatedDeliveryRetrackTrackingByIdResponse } from "./FirstEstimatedDeliveryRetrackTrackingByIdResponse"; +import { LatestEstimatedDeliveryRetrackTrackingByIdResponse } from "./LatestEstimatedDeliveryRetrackTrackingByIdResponse"; +import { CarbonEmissionsRetrackTrackingByIdResponse } from "./CarbonEmissionsRetrackTrackingByIdResponse"; +import { FirstMileRetrackTrackingByIdResponse } from "./FirstMileRetrackTrackingByIdResponse"; +import { LastMileRetrackTrackingByIdResponse } from "./LastMileRetrackTrackingByIdResponse"; +import { CustomersRetrackTrackingByIdResponse } from "./CustomersRetrackTrackingByIdResponse"; + +export interface RetrackTrackingByIdResponse { + /** + * Tracking ID. + */ + id?: string; + /** + * The length of the tracking ID has been increased from 24 characters to 32 characters. We will use the legacy_id field to store the original 24-character tracking ID to maintain compatibility with existing data. Therefore, all tracking endpoints will continue to work with the legacy_id field as before. + */ + legacy_id?: string; + /** + * The date and time the shipment was imported or added to AfterShip. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0. + */ + created_at?: string; + /** + * The date and time the shipment was updated. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0. + */ + updated_at?: string; + /** + * Tracking number. + */ + tracking_number?: string; + /** + * Unique courier code. When importing a shipment with no courier slug and the tracking number can’t be recognized, the courier will be marked as `unrecognized`. Get courier codes . + */ + slug?: string; + /** + * Whether or not AfterShip will continue tracking the shipments. Value is `false` when tag (status) is `Delivered`, `Expired`, or further updates for 30 days since last update. + */ + active?: boolean; + /** + * Custom fields that accept an object with string field. In order to protect the privacy of your customers, do not include any in custom fields. + */ + custom_fields?: { [key: string]: any }; + /** + * Total transit time in days.- For delivered shipments: Transit time (in days) = Delivered date - Pick-up date- For undelivered shipments: Transit time (in days) = Current date - Pick-up dateValue as `null` for the shipment without pick-up date. + */ + transit_time?: number; + /** + * The for the origin country/region. E.g. USA for the United States. + */ + origin_country_region?: string; + /** + * The state of the sender’s address. + */ + origin_state?: string; + /** + * The city of the sender’s address. + */ + origin_city?: string; + /** + * The postal code of the sender’s address. + */ + origin_postal_code?: string; + /** + * The sender address that the shipment is shipping from. + */ + origin_raw_location?: string; + /** + * The for the destination country/region. E.g. USA for the United States. + */ + destination_country_region?: string; + /** + * The state of the recipient’s address. + */ + destination_state?: string; + /** + * The city of the recipient’s address. + */ + destination_city?: string; + /** + * The postal code of the recipient’s address. + */ + destination_postal_code?: string; + /** + * The shipping address that the shipment is shipping to. + */ + destination_raw_location?: string; + /** + * Destination country/region of the tracking detected from the courier. ISO Alpha-3 (three letters). Value will be `null` if the courier doesn't provide the destination country. + */ + courier_destination_country_region?: string; + /** + * The field contains the estimated delivery date provided by the carrier. + */ + courier_estimated_delivery_date?: CourierEstimatedDeliveryDateRetrackTrackingByIdResponse; + /** + * Text field for the note. + */ + note?: string; + /** + * A globally-unique identifier for the order. + */ + order_id?: string; + /** + * The URL for the order in your system or store. + */ + order_id_path?: string; + /** + * The date and time the order was created in your system or store. It uses the format: `YYYY-MM-DDTHH:mm:ssZ` based on whichever timezone you provide. + */ + order_date?: string; + /** + * Number of packages under the tracking. + */ + shipment_package_count?: number; + /** + * The date and time the shipment was picked up by the carrier. It uses the timezone where the pickup occured. The format may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + shipment_pickup_date?: string; + /** + * The date and time the shipment was delivered. It uses the shipment recipient’s timezone. The format may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + shipment_delivery_date?: string; + /** + * The carrier service type for the shipment. + */ + shipment_type?: string; + /** + * The shipment_weight field represents the total weight of the shipment. In scenarios where the carrier does not provide this information, you can provide the weight to AfterShip. We will prioritize the data provided by the carrier, if available. The shipment weight will be included in the Response and accessed through the GET API, Webhook, and CSV export. It will also be displayed on the AfterShip Tracking admin. Additionally, it plays a significant role in error-free shipment handling and carbon emission calculations, ensuring accurate and informed decision-making + */ + shipment_weight?: ShipmentWeightRetrackTrackingByIdResponse; + /** + * Signed by information for delivered shipment. + */ + signed_by?: string; + /** + * Source of how this tracking is added. + */ + source?: string; + /** + * Current status of tracking. ( + */ + tag?: TagV1; + /** + * Current subtag of tracking. ( + */ + subtag?: string; + /** + * Normalized tracking message. ( + */ + subtag_message?: string; + /** + * By default this field shows the `tracking_number`, but you can customize it as you wish with any info (e.g. the order number). + */ + title?: string; + /** + * Number of attempts AfterShip tracks at courier's system. + */ + tracked_count?: number; + /** + * Indicates if the shipment is trackable till the final destination.Three possible values:- true- false- null + */ + last_mile_tracking_supported?: boolean; + /** + * The recipient’s language. If you set up AfterShip notifications in different languages, we use this to send the recipient tracking updates in their preferred language. + */ + language?: string; + /** + * Deprecated + */ + unique_token?: string; + /** + * Array of checkpoint object describes the checkpoint information. + */ + checkpoints?: Checkpoint[]; + /** + * Phone number(s) subscribed to receive sms notifications. + */ + subscribed_smses?: string[]; + /** + * Email address(es) subscribed to receive email notifications. + */ + subscribed_emails?: string[]; + /** + * Whether or not the shipment is returned to sender. Value is `true` when any of its checkpoints has subtag `Exception_010` (returning to sender) or `Exception_011` (returned to sender). Otherwise value is `false`. + */ + return_to_sender?: boolean; + /** + * The promised delivery date of the order. It uses the formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + order_promised_delivery_date?: string; + /** + * Shipment delivery type- pickup_at_store- pickup_at_courier- door_to_door + */ + delivery_type?: string; + /** + * Shipment pickup location for receiver + */ + pickup_location?: string; + /** + * Shipment pickup note for receiver + */ + pickup_note?: string; + /** + * Official tracking URL of the courier (if any). The language parameter of this link relies on the destination country/region and the language associated with the shipment, if the data regarding the destination country/region and language of the shipment is not available, AfterShip will set the language parameter of the link to "US" by default. + */ + courier_tracking_link?: string; + /** + * The date and time of the carrier’s first attempt to deliver the package to the recipient. It uses the shipment recipient’s timezone. The format may differ depending on how the carrier provides it:- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + first_attempted_at?: string; + /** + * Delivery instructions (delivery date or address) can be modified by visiting the link if supported by a carrier. The language parameter of this link relies on the destination country/region and the language associated with the shipment, if the data regarding the destination country/region and language of the shipment is not available, AfterShip will set the language parameter of the link to "US" by default. + */ + courier_redirect_link?: string; + /** + * Additional field required by some carriers to retrieve the tracking info. The shipper’s carrier account number. Refer to our article on for more details. + */ + tracking_account_number?: string; + /** + * Additional field required by some carriers to retrieve the tracking info. A type of tracking credential required by some carriers. Refer to our article on for more details. + */ + tracking_key?: string; + /** + * The date and time when the shipment is shipped by the merchant and ready for pickup by the carrier. The field supports the following formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZThe field serves two key purposes:- Calculate processing time metrics in the Order-to-delivery Analytics dashboard. To ensure accurate analytics, it's recommended to include timezone information when configuring this value- Required by certain carriers to retrieve tracking information as an additional tracking field. + */ + tracking_ship_date?: string; + /** + * Whether the tracking is delivered on time or not. + */ + on_time_status?: string; + /** + * The difference days of the on time. + */ + on_time_difference?: number; + /** + * The tags of the order. + */ + order_tags?: string[]; + /** + * The estimated delivery date of the shipment provided by AfterShip’s AI and shown to the recipients. It uses the format `YYYY-MM-DD` based on the shipment recipient’s timezone. + */ + aftership_estimated_delivery_date?: AftershipEstimatedDeliveryDateRetrackTrackingByIdResponse; + /** + * Estimated delivery time of the shipment based on your . It uses the format `YYYY-MM-DD` based on the shipment recipient’s timezone. + */ + custom_estimated_delivery_date?: CustomEstimatedDeliveryDateRetrackTrackingByIdResponse; + /** + * A unique, human-readable identifier for the order. + */ + order_number?: string; + /** + * The shipment’s original estimated delivery date. It could be provided by the carrier, AfterShip AI, or based on your custom settings. The format of carrier EDDs may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ AfterShip AI and custom EDDs always use the format `YYYY-MM-DD`. All EDDs use the shipment recipient’s timezone. + */ + first_estimated_delivery?: FirstEstimatedDeliveryRetrackTrackingByIdResponse; + /** + * The most recently calculated estimated delivery date. It could be provided by the carrier, AfterShip AI, or based on your custom settings. The format of carrier EDDs may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ AfterShip AI and custom EDDs always use the format `YYYY-MM-DD`. All EDDs use the shipment recipient’s timezone. + */ + latest_estimated_delivery?: LatestEstimatedDeliveryRetrackTrackingByIdResponse; + /** + * Used to add tags to your shipments to help categorize and filter them easily. + */ + shipment_tags?: string[]; + /** + * If you have multiple accounts connected for a single carrier on AfterShip, we have introduced the courier_connection_id field to allow you to specify the carrier account associated with each shipment. By providing this information, you enable us to accurately track and monitor your shipments based on the correct carrier account.(</br>In the event that you do not specify the courier_connection_id, we will handle your shipment using the connection that was created earliest among your connected accounts. + */ + courier_connection_id?: string; + /** + * (Legacy) Replaced by `origin_country_region`. Additional field required by some carriers to retrieve the tracking info. The origin country/region of the shipment. Refer to our article on for more details. + */ + tracking_origin_country_region?: string; + /** + * (Legacy) Replaced by `destination_country_region`. Additional field required by some carriers to retrieve the tracking info. The destination country/region of the shipment. Refer to our article on for more details. + */ + tracking_destination_country_region?: string; + /** + * (Legacy) Replaced by `destination_postal_code`. Additional field required by some carriers to retrieve the tracking info. The postal code of the recipient’s address. Refer to our article on for more details. + */ + tracking_postal_code?: string; + /** + * (Legacy) Replaced by `destination_state`. Additional field required by some carriers to retrieve the tracking info. The state/province of the recipient’s address. Refer to our article on for more details. + */ + tracking_state?: string; + /** + * The model contains the total amount of carbon emissions generated by the shipment. - AfterShip will provide this data only when it is available, and its availability is contingent upon the location and weight information that AfterShip can obtain.- The values will be accessible solely for shipments that have been successfully delivered. However, in the event of a shipping update after the delivery status has been achieved, the value may change.- It’s a paid service and only for Tracking Enterprise users, please contact your customer success manager if you want to know more. + */ + carbon_emissions?: CarbonEmissionsRetrackTrackingByIdResponse; + /** + * The location_id refers to the place where you fulfilled the items. - If you provide a location_id, the system will automatically use it as the tracking's origin address. However, passing both location_id and any origin address information simultaneously is not allowed.- Please make sure you add your locations . + */ + location_id?: string; + /** + * The shipping_method string refers to the chosen method for delivering the package. Merchants typically offer various shipping methods to consumers during the checkout process, such as, Local Delivery, Free Express Worldwide Shipping, etc. + */ + shipping_method?: string; + /** + * By dynamically tracking failed delivery attempts during shipment, this field allows you to pinpoint carriers accountable for the most failures. Analyzing the root cause of these failures enables you to improve carriers' delivery standard operating procedures (SOP), leading to an overall enhancement in delivery service quality. + */ + failed_delivery_attempts?: number; + /** + * The signature_requirement field serves the purpose of validating the service option type, specifically proof of delivery. By collecting the recipient's signature upon delivery, it ensures the package reaches the intended recipient and prevents disputes related to non-delivery or lost packages.</br> + */ + signature_requirement?: string; + /** + * The delivery location type represents the secure area where the carrier leaves the package, such as a safe place, locker, mailbox, front porch, etc. This information helps ensure the shipment reaches the intended recipient efficiently, minimizing the risk of theft or damage. + */ + delivery_location_type?: string; + /** + * The tracking URL directs your customers to the shipment tracking page which can display either the default or a customized page based on segmentation rules.- The universal URL is used by default, but you can opt for a custom domain if you have one. Learn how to set up a custom domain .The field is not automatically enabled in API & Webhook. Please contact support if you’d like to enable it. + */ + aftership_tracking_url?: string; + /** + * The order URL directs your customers to the order tracking page, which includes all shipments. It can display either the default or a customized page based on segmentation rules.- The universal URL is used by default, but you can opt for a custom domain if you have one. Learn how to set up a custom domain .The field is not automatically enabled in API & Webhook. Please contact support if you’d like to enable it. + */ + aftership_tracking_order_url?: string; + /** + * The field contains information about the first leg of the shipping starting from the carrier picking up the shipment from the shipper to the point where they hand it over to the last-mile carrier. Once AfterShip detects the shipment is multi-leg, we will populate the first-mile information under this object. + */ + first_mile?: FirstMileRetrackTrackingByIdResponse; + /** + * This field contains information about the last leg of the shipment, starting from the carrier who hands it over to the last-mile carrier, all the way to delivery. Once AfterShip detects that the shipment involves multiple legs and identifies the last-mile carrier, we will populate the last-mile carrier information in this object. Alternatively, the user can provide this information in this field to specify the last-mile carrier, which is helpful if AfterShip is unable to detect it automatically. + */ + last_mile?: LastMileRetrackTrackingByIdResponse; + /** + * The field contains the customer information associated with the tracking. A maximum of three customer objects are allowed. + */ + customers?: CustomersRetrackTrackingByIdResponse[]; +} diff --git a/src/model/ShipmentWeightCreateTrackingResponse.ts b/src/model/ShipmentWeightCreateTrackingResponse.ts new file mode 100644 index 0000000..30dabcf --- /dev/null +++ b/src/model/ShipmentWeightCreateTrackingResponse.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface ShipmentWeightCreateTrackingResponse { + /** + * The unit in which the value field is expressed. + */ + unit?: string; + /** + * The total amount of shipment weight. + */ + value?: number; +} diff --git a/src/model/ShipmentWeightDeleteTrackingByIdResponse.ts b/src/model/ShipmentWeightDeleteTrackingByIdResponse.ts new file mode 100644 index 0000000..9b5d80c --- /dev/null +++ b/src/model/ShipmentWeightDeleteTrackingByIdResponse.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface ShipmentWeightDeleteTrackingByIdResponse { + /** + * The unit in which the value field is expressed. + */ + unit?: string; + /** + * The total amount of shipment weight. + */ + value?: number; +} diff --git a/src/model/ShipmentWeightGetTrackingByIdResponse.ts b/src/model/ShipmentWeightGetTrackingByIdResponse.ts new file mode 100644 index 0000000..8af4b8f --- /dev/null +++ b/src/model/ShipmentWeightGetTrackingByIdResponse.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface ShipmentWeightGetTrackingByIdResponse { + /** + * The unit in which the value field is expressed. + */ + unit?: string; + /** + * The total amount of shipment weight. + */ + value?: number; +} diff --git a/src/model/ShipmentWeightMarkTrackingCompletedByIdResponse.ts b/src/model/ShipmentWeightMarkTrackingCompletedByIdResponse.ts new file mode 100644 index 0000000..09dae23 --- /dev/null +++ b/src/model/ShipmentWeightMarkTrackingCompletedByIdResponse.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface ShipmentWeightMarkTrackingCompletedByIdResponse { + /** + * The unit in which the value field is expressed. + */ + unit?: string; + /** + * The total amount of shipment weight. + */ + value?: number; +} diff --git a/src/model/ShipmentWeightRetrackTrackingByIdResponse.ts b/src/model/ShipmentWeightRetrackTrackingByIdResponse.ts new file mode 100644 index 0000000..f291bb1 --- /dev/null +++ b/src/model/ShipmentWeightRetrackTrackingByIdResponse.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface ShipmentWeightRetrackTrackingByIdResponse { + /** + * The unit in which the value field is expressed. + */ + unit?: string; + /** + * The total amount of shipment weight. + */ + value?: number; +} diff --git a/src/model/ShipmentWeightTracking.ts b/src/model/ShipmentWeightTracking.ts new file mode 100644 index 0000000..a3bff7b --- /dev/null +++ b/src/model/ShipmentWeightTracking.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface ShipmentWeightTracking { + /** + * The unit in which the value field is expressed. + */ + unit?: string; + /** + * The total amount of shipment weight. + */ + value?: number; +} diff --git a/src/model/ShipmentWeightUpdateTrackingByIdResponse.ts b/src/model/ShipmentWeightUpdateTrackingByIdResponse.ts new file mode 100644 index 0000000..9a17d43 --- /dev/null +++ b/src/model/ShipmentWeightUpdateTrackingByIdResponse.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface ShipmentWeightUpdateTrackingByIdResponse { + /** + * The unit in which the value field is expressed. + */ + unit?: string; + /** + * The total amount of shipment weight. + */ + value?: number; +} diff --git a/src/model/SlugGroupV1.ts b/src/model/SlugGroupV1.ts new file mode 100644 index 0000000..fc9d095 --- /dev/null +++ b/src/model/SlugGroupV1.ts @@ -0,0 +1,19 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export enum SlugGroupV1 { + "amazon-group" = "amazon-group", + "fedex-group" = "fedex-group", + "toll-group" = "toll-group", + "taqbin-group" = "taqbin-group", + "tnt-group" = "tnt-group", + "cj-group" = "cj-group", + "hermes-group" = "hermes-group", + "dpd-group" = "dpd-group", + "gls-group" = "gls-group", + "dhl-group" = "dhl-group", + "fastway-group" = "fastway-group", + "asendia-group" = "asendia-group", +} diff --git a/src/model/TagV1.ts b/src/model/TagV1.ts new file mode 100644 index 0000000..91ba0fe --- /dev/null +++ b/src/model/TagV1.ts @@ -0,0 +1,16 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export enum TagV1 { + "Pending" = "Pending", + "InfoReceived" = "InfoReceived", + "InTransit" = "InTransit", + "OutForDelivery" = "OutForDelivery", + "AttemptFail" = "AttemptFail", + "Delivered" = "Delivered", + "AvailableForPickup" = "AvailableForPickup", + "Exception" = "Exception", + "Expired" = "Expired", +} diff --git a/src/model/Tracking.ts b/src/model/Tracking.ts new file mode 100644 index 0000000..530f367 --- /dev/null +++ b/src/model/Tracking.ts @@ -0,0 +1,335 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { CourierEstimatedDeliveryDateTracking } from "./CourierEstimatedDeliveryDateTracking"; +import { ShipmentWeightTracking } from "./ShipmentWeightTracking"; +import { TagV1 } from "./TagV1"; +import { Checkpoint } from "./Checkpoint"; +import { AftershipEstimatedDeliveryDateTracking } from "./AftershipEstimatedDeliveryDateTracking"; +import { CustomEstimatedDeliveryDateTracking } from "./CustomEstimatedDeliveryDateTracking"; +import { FirstEstimatedDeliveryTracking } from "./FirstEstimatedDeliveryTracking"; +import { LatestEstimatedDeliveryTracking } from "./LatestEstimatedDeliveryTracking"; +import { CarbonEmissionsTracking } from "./CarbonEmissionsTracking"; +import { FirstMileTracking } from "./FirstMileTracking"; +import { LastMileTracking } from "./LastMileTracking"; +import { CustomersTracking } from "./CustomersTracking"; + +export interface Tracking { + /** + * Tracking ID. + */ + id?: string; + /** + * The length of the tracking ID has been increased from 24 characters to 32 characters. We will use the legacy_id field to store the original 24-character tracking ID to maintain compatibility with existing data. Therefore, all tracking endpoints will continue to work with the legacy_id field as before. + */ + legacy_id?: string; + /** + * The date and time the shipment was imported or added to AfterShip. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0. + */ + created_at?: string; + /** + * The date and time the shipment was updated. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0. + */ + updated_at?: string; + /** + * Tracking number. + */ + tracking_number?: string; + /** + * Unique courier code. When importing a shipment with no courier slug and the tracking number can’t be recognized, the courier will be marked as `unrecognized`. Get courier codes . + */ + slug?: string; + /** + * Whether or not AfterShip will continue tracking the shipments. Value is `false` when tag (status) is `Delivered`, `Expired`, or further updates for 30 days since last update. + */ + active?: boolean; + /** + * Custom fields that accept an object with string field. In order to protect the privacy of your customers, do not include any in custom fields. + */ + custom_fields?: { [key: string]: any }; + /** + * Total transit time in days.- For delivered shipments: Transit time (in days) = Delivered date - Pick-up date- For undelivered shipments: Transit time (in days) = Current date - Pick-up dateValue as `null` for the shipment without pick-up date. + */ + transit_time?: number; + /** + * The for the origin country/region. E.g. USA for the United States. + */ + origin_country_region?: string; + /** + * The state of the sender’s address. + */ + origin_state?: string; + /** + * The city of the sender’s address. + */ + origin_city?: string; + /** + * The postal code of the sender’s address. + */ + origin_postal_code?: string; + /** + * The sender address that the shipment is shipping from. + */ + origin_raw_location?: string; + /** + * The for the destination country/region. E.g. USA for the United States. + */ + destination_country_region?: string; + /** + * The state of the recipient’s address. + */ + destination_state?: string; + /** + * The city of the recipient’s address. + */ + destination_city?: string; + /** + * The postal code of the recipient’s address. + */ + destination_postal_code?: string; + /** + * The shipping address that the shipment is shipping to. + */ + destination_raw_location?: string; + /** + * Destination country/region of the tracking detected from the courier. ISO Alpha-3 (three letters). Value will be `null` if the courier doesn't provide the destination country. + */ + courier_destination_country_region?: string; + /** + * The field contains the estimated delivery date provided by the carrier. + */ + courier_estimated_delivery_date?: CourierEstimatedDeliveryDateTracking; + /** + * Text field for the note. + */ + note?: string; + /** + * A globally-unique identifier for the order. + */ + order_id?: string; + /** + * The URL for the order in your system or store. + */ + order_id_path?: string; + /** + * The date and time the order was created in your system or store. It uses the format: `YYYY-MM-DDTHH:mm:ssZ` based on whichever timezone you provide. + */ + order_date?: string; + /** + * Number of packages under the tracking. + */ + shipment_package_count?: number; + /** + * The date and time the shipment was picked up by the carrier. It uses the timezone where the pickup occured. The format may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + shipment_pickup_date?: string; + /** + * The date and time the shipment was delivered. It uses the shipment recipient’s timezone. The format may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + shipment_delivery_date?: string; + /** + * The carrier service type for the shipment. + */ + shipment_type?: string; + /** + * The shipment_weight field represents the total weight of the shipment. In scenarios where the carrier does not provide this information, you can provide the weight to AfterShip. We will prioritize the data provided by the carrier, if available. The shipment weight will be included in the Response and accessed through the GET API, Webhook, and CSV export. It will also be displayed on the AfterShip Tracking admin. Additionally, it plays a significant role in error-free shipment handling and carbon emission calculations, ensuring accurate and informed decision-making + */ + shipment_weight?: ShipmentWeightTracking; + /** + * Signed by information for delivered shipment. + */ + signed_by?: string; + /** + * Source of how this tracking is added. + */ + source?: string; + /** + * Current status of tracking. ( + */ + tag?: TagV1; + /** + * Current subtag of tracking. ( + */ + subtag?: string; + /** + * Normalized tracking message. ( + */ + subtag_message?: string; + /** + * By default this field shows the `tracking_number`, but you can customize it as you wish with any info (e.g. the order number). + */ + title?: string; + /** + * Number of attempts AfterShip tracks at courier's system. + */ + tracked_count?: number; + /** + * Indicates if the shipment is trackable till the final destination.Three possible values:- true- false- null + */ + last_mile_tracking_supported?: boolean; + /** + * The recipient’s language. If you set up AfterShip notifications in different languages, we use this to send the recipient tracking updates in their preferred language. + */ + language?: string; + /** + * Deprecated + */ + unique_token?: string; + /** + * Array of checkpoint object describes the checkpoint information. + */ + checkpoints?: Checkpoint[]; + /** + * Phone number(s) subscribed to receive sms notifications. + */ + subscribed_smses?: string[]; + /** + * Email address(es) subscribed to receive email notifications. + */ + subscribed_emails?: string[]; + /** + * Whether or not the shipment is returned to sender. Value is `true` when any of its checkpoints has subtag `Exception_010` (returning to sender) or `Exception_011` (returned to sender). Otherwise value is `false`. + */ + return_to_sender?: boolean; + /** + * The promised delivery date of the order. It uses the formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + order_promised_delivery_date?: string; + /** + * Shipment delivery type- pickup_at_store- pickup_at_courier- door_to_door + */ + delivery_type?: string; + /** + * Shipment pickup location for receiver + */ + pickup_location?: string; + /** + * Shipment pickup note for receiver + */ + pickup_note?: string; + /** + * Official tracking URL of the courier (if any). The language parameter of this link relies on the destination country/region and the language associated with the shipment, if the data regarding the destination country/region and language of the shipment is not available, AfterShip will set the language parameter of the link to "US" by default. + */ + courier_tracking_link?: string; + /** + * The date and time of the carrier’s first attempt to deliver the package to the recipient. It uses the shipment recipient’s timezone. The format may differ depending on how the carrier provides it:- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + first_attempted_at?: string; + /** + * Delivery instructions (delivery date or address) can be modified by visiting the link if supported by a carrier. The language parameter of this link relies on the destination country/region and the language associated with the shipment, if the data regarding the destination country/region and language of the shipment is not available, AfterShip will set the language parameter of the link to "US" by default. + */ + courier_redirect_link?: string; + /** + * Additional field required by some carriers to retrieve the tracking info. The shipper’s carrier account number. Refer to our article on for more details. + */ + tracking_account_number?: string; + /** + * Additional field required by some carriers to retrieve the tracking info. A type of tracking credential required by some carriers. Refer to our article on for more details. + */ + tracking_key?: string; + /** + * The date and time when the shipment is shipped by the merchant and ready for pickup by the carrier. The field supports the following formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZThe field serves two key purposes:- Calculate processing time metrics in the Order-to-delivery Analytics dashboard. To ensure accurate analytics, it's recommended to include timezone information when configuring this value- Required by certain carriers to retrieve tracking information as an additional tracking field. + */ + tracking_ship_date?: string; + /** + * Whether the tracking is delivered on time or not. + */ + on_time_status?: string; + /** + * The difference days of the on time. + */ + on_time_difference?: number; + /** + * The tags of the order. + */ + order_tags?: string[]; + /** + * The estimated delivery date of the shipment provided by AfterShip’s AI and shown to the recipients. It uses the format `YYYY-MM-DD` based on the shipment recipient’s timezone. + */ + aftership_estimated_delivery_date?: AftershipEstimatedDeliveryDateTracking; + /** + * Estimated delivery time of the shipment based on your . It uses the format `YYYY-MM-DD` based on the shipment recipient’s timezone. + */ + custom_estimated_delivery_date?: CustomEstimatedDeliveryDateTracking; + /** + * A unique, human-readable identifier for the order. + */ + order_number?: string; + /** + * The shipment’s original estimated delivery date. It could be provided by the carrier, AfterShip AI, or based on your custom settings. The format of carrier EDDs may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ AfterShip AI and custom EDDs always use the format `YYYY-MM-DD`. All EDDs use the shipment recipient’s timezone. + */ + first_estimated_delivery?: FirstEstimatedDeliveryTracking; + /** + * The most recently calculated estimated delivery date. It could be provided by the carrier, AfterShip AI, or based on your custom settings. The format of carrier EDDs may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ AfterShip AI and custom EDDs always use the format `YYYY-MM-DD`. All EDDs use the shipment recipient’s timezone. + */ + latest_estimated_delivery?: LatestEstimatedDeliveryTracking; + /** + * Used to add tags to your shipments to help categorize and filter them easily. + */ + shipment_tags?: string[]; + /** + * If you have multiple accounts connected for a single carrier on AfterShip, we have introduced the courier_connection_id field to allow you to specify the carrier account associated with each shipment. By providing this information, you enable us to accurately track and monitor your shipments based on the correct carrier account.(</br>In the event that you do not specify the courier_connection_id, we will handle your shipment using the connection that was created earliest among your connected accounts. + */ + courier_connection_id?: string; + /** + * (Legacy) Replaced by `origin_country_region`. Additional field required by some carriers to retrieve the tracking info. The origin country/region of the shipment. Refer to our article on for more details. + */ + tracking_origin_country_region?: string; + /** + * (Legacy) Replaced by `destination_country_region`. Additional field required by some carriers to retrieve the tracking info. The destination country/region of the shipment. Refer to our article on for more details. + */ + tracking_destination_country_region?: string; + /** + * (Legacy) Replaced by `destination_postal_code`. Additional field required by some carriers to retrieve the tracking info. The postal code of the recipient’s address. Refer to our article on for more details. + */ + tracking_postal_code?: string; + /** + * (Legacy) Replaced by `destination_state`. Additional field required by some carriers to retrieve the tracking info. The state/province of the recipient’s address. Refer to our article on for more details. + */ + tracking_state?: string; + /** + * The model contains the total amount of carbon emissions generated by the shipment. - AfterShip will provide this data only when it is available, and its availability is contingent upon the location and weight information that AfterShip can obtain.- The values will be accessible solely for shipments that have been successfully delivered. However, in the event of a shipping update after the delivery status has been achieved, the value may change.- It’s a paid service and only for Tracking Enterprise users, please contact your customer success manager if you want to know more. + */ + carbon_emissions?: CarbonEmissionsTracking; + /** + * The location_id refers to the place where you fulfilled the items. - If you provide a location_id, the system will automatically use it as the tracking's origin address. However, passing both location_id and any origin address information simultaneously is not allowed.- Please make sure you add your locations . + */ + location_id?: string; + /** + * The shipping_method string refers to the chosen method for delivering the package. Merchants typically offer various shipping methods to consumers during the checkout process, such as, Local Delivery, Free Express Worldwide Shipping, etc. + */ + shipping_method?: string; + /** + * By dynamically tracking failed delivery attempts during shipment, this field allows you to pinpoint carriers accountable for the most failures. Analyzing the root cause of these failures enables you to improve carriers' delivery standard operating procedures (SOP), leading to an overall enhancement in delivery service quality. + */ + failed_delivery_attempts?: number; + /** + * The signature_requirement field serves the purpose of validating the service option type, specifically proof of delivery. By collecting the recipient's signature upon delivery, it ensures the package reaches the intended recipient and prevents disputes related to non-delivery or lost packages.</br> + */ + signature_requirement?: string; + /** + * The delivery location type represents the secure area where the carrier leaves the package, such as a safe place, locker, mailbox, front porch, etc. This information helps ensure the shipment reaches the intended recipient efficiently, minimizing the risk of theft or damage. + */ + delivery_location_type?: string; + /** + * The tracking URL directs your customers to the shipment tracking page which can display either the default or a customized page based on segmentation rules.- The universal URL is used by default, but you can opt for a custom domain if you have one. Learn how to set up a custom domain .The field is not automatically enabled in API & Webhook. Please contact support if you’d like to enable it. + */ + aftership_tracking_url?: string; + /** + * The order URL directs your customers to the order tracking page, which includes all shipments. It can display either the default or a customized page based on segmentation rules.- The universal URL is used by default, but you can opt for a custom domain if you have one. Learn how to set up a custom domain .The field is not automatically enabled in API & Webhook. Please contact support if you’d like to enable it. + */ + aftership_tracking_order_url?: string; + /** + * The field contains information about the first leg of the shipping starting from the carrier picking up the shipment from the shipper to the point where they hand it over to the last-mile carrier. Once AfterShip detects the shipment is multi-leg, we will populate the first-mile information under this object. + */ + first_mile?: FirstMileTracking; + /** + * This field contains information about the last leg of the shipment, starting from the carrier who hands it over to the last-mile carrier, all the way to delivery. Once AfterShip detects that the shipment involves multiple legs and identifies the last-mile carrier, we will populate the last-mile carrier information in this object. Alternatively, the user can provide this information in this field to specify the last-mile carrier, which is helpful if AfterShip is unable to detect it automatically. + */ + last_mile?: LastMileTracking; + /** + * The field contains the customer information associated with the tracking. A maximum of three customer objects are allowed. + */ + customers?: CustomersTracking[]; +} diff --git a/src/model/TrackingResponseGetMultipleV1.ts b/src/model/TrackingResponseGetMultipleV1.ts new file mode 100644 index 0000000..688d86b --- /dev/null +++ b/src/model/TrackingResponseGetMultipleV1.ts @@ -0,0 +1,17 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { MetaV1 } from "./MetaV1"; +import { DataTrackingResponseGetMultipleV1 } from "./DataTrackingResponseGetMultipleV1"; + +export interface TrackingResponseGetMultipleV1 { + /** + * Meta data + */ + meta: MetaV1; + /** + * + */ + data?: DataTrackingResponseGetMultipleV1; +} diff --git a/src/model/TrackingResponseV1.ts b/src/model/TrackingResponseV1.ts new file mode 100644 index 0000000..8585ea2 --- /dev/null +++ b/src/model/TrackingResponseV1.ts @@ -0,0 +1,17 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { MetaV1 } from "./MetaV1"; +import { Tracking } from "./Tracking"; + +export interface TrackingResponseV1 { + /** + * Meta data + */ + meta: MetaV1; + /** + * Object describes the tracking information.<div style="display:none; height: 0"></div> + */ + data: Tracking; +} diff --git a/src/model/UpdateTrackingByIdRequest.ts b/src/model/UpdateTrackingByIdRequest.ts new file mode 100644 index 0000000..156ecca --- /dev/null +++ b/src/model/UpdateTrackingByIdRequest.ts @@ -0,0 +1,144 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { CustomersUpdateTrackingByIdRequest } from "./CustomersUpdateTrackingByIdRequest"; + +export interface UpdateTrackingByIdRequest { + /** + * By default this field shows the `tracking_number`, but you can customize it as you wish with any info (e.g. the order number). + */ + title?: string; + /** + * A globally-unique identifier for the order. + */ + order_id?: string; + /** + * The URL for the order in your system or store. + */ + order_id_path?: string; + /** + * Custom fields that accept an object with string field. In order to protect the privacy of your customers, do not include any + */ + custom_fields?: { [key: string]: any }; + /** + * Text field for the note.Input `""` to clear the value of this field. + */ + note?: string; + /** + * The recipient’s language. If you set up AfterShip notifications in different languages, we use this to send the recipient tracking updates in their preferred language. Use an to specify the language. + */ + language?: string; + /** + * The promised delivery date of the order. It uses the formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + order_promised_delivery_date?: string; + /** + * Shipment delivery type- `pickup_at_store`- `pickup_at_courier`- `door_to_door` + */ + delivery_type?: string; + /** + * Shipment pickup location for receiver + */ + pickup_location?: string; + /** + * Shipment pickup note for receiver + */ + pickup_note?: string; + /** + * Unique code of each courier. Provide a single courier.(https://admin.aftership.com/settings/couriers). Get a list of courier slug using + */ + slug?: string; + /** + * Additional field required by some carriers to retrieve the tracking info. The shipper’s carrier account number. Refer to our article on for more details. + */ + tracking_account_number?: string; + /** + * Additional field required by some carriers to retrieve the tracking info. A type of tracking credential required by some carriers. Refer to our article on for more details. + */ + tracking_key?: string; + /** + * The date and time when the shipment is shipped by the merchant and ready for pickup by the carrier. The field supports the following formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZThe field serves two key purposes:- Calculate processing time metrics in the Order-to-delivery Analytics dashboard. To ensure accurate analytics, it's recommended to include timezone information when configuring this value- Required by certain carriers to retrieve tracking information as an additional tracking field. + */ + tracking_ship_date?: string; + /** + * A unique, human-readable identifier for the order. + */ + order_number?: string; + /** + * Order date in YYYY-MM-DDTHH:mm:ssZ format. e.g. 2021-07-26T11:23:51-05:00 + */ + order_date?: string; + /** + * The carrier service type for the shipment. If you provide info for this field, AfterShip will not update it with info from the carrier. + */ + shipment_type?: string; + /** + * The for more details. + */ + origin_country_region?: string; + /** + * The state of the sender’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. + */ + origin_state?: string; + /** + * The city of the sender’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. + */ + origin_city?: string; + /** + * The postal of the sender’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. + */ + origin_postal_code?: string; + /** + * The sender address that the shipment is shipping from. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. + */ + origin_raw_location?: string; + /** + * The for more details. + */ + destination_country_region?: string; + /** + * The state of the recipient’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. Also the additional field required by some carriers to retrieve the tracking info. The state/province of the recipient’s address. Refer to our article on for more details. + */ + destination_state?: string; + /** + * The city of the recipient’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. + */ + destination_city?: string; + /** + * The postal of the recipient’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. Also the additional field required by some carriers to retrieve the tracking info. The postal code of the recipient’s address. Refer to our article on for more details. + */ + destination_postal_code?: string; + /** + * The shipping address that the shipment is shipping to. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. + */ + destination_raw_location?: string; + /** + * (Legacy) Replaced by `origin_country_region`. Additional field required by some carriers to retrieve the tracking info. The origin country/region of the shipment. Refer to our article on for more details. + */ + tracking_origin_country_region?: string; + /** + * (Legacy) Replaced by `destination_country_region`. Additional field required by some carriers to retrieve the tracking info. The destination country/region of the shipment. Refer to our article on for more details. + */ + tracking_destination_country_region?: string; + /** + * (Legacy) Replaced by `destination_postal_code`. Additional field required by some carriers to retrieve the tracking info. The postal code of the recipient’s address. Refer to our article on for more details. + */ + tracking_postal_code?: string; + /** + * (Legacy) Replaced by `destination_state`. Additional field required by some carriers to retrieve the tracking info. The state/province of the recipient’s address. Refer to our article on for more details. + */ + tracking_state?: string; + /** + * The location_id refers to the place where you fulfilled the items. - If you provide a location_id, the system will automatically use it as the tracking's origin address. However, passing both location_id and any origin address information simultaneously is not allowed.- Please make sure you add your locations . + */ + location_id?: string; + /** + * The shipping_method string refers to the chosen method for delivering the package. Merchants typically offer various shipping methods to consumers during the checkout process, such as, Local Delivery, Free Express Worldwide Shipping, etc. + */ + shipping_method?: string; + /** + * The field contains the customer information associated with the tracking. A maximum of three customer objects are allowed. + */ + customers?: CustomersUpdateTrackingByIdRequest[]; +} diff --git a/src/model/UpdateTrackingByIdResponse.ts b/src/model/UpdateTrackingByIdResponse.ts new file mode 100644 index 0000000..8d0ceb4 --- /dev/null +++ b/src/model/UpdateTrackingByIdResponse.ts @@ -0,0 +1,335 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ +import { CourierEstimatedDeliveryDateUpdateTrackingByIdResponse } from "./CourierEstimatedDeliveryDateUpdateTrackingByIdResponse"; +import { ShipmentWeightUpdateTrackingByIdResponse } from "./ShipmentWeightUpdateTrackingByIdResponse"; +import { TagV1 } from "./TagV1"; +import { Checkpoint } from "./Checkpoint"; +import { AftershipEstimatedDeliveryDateUpdateTrackingByIdResponse } from "./AftershipEstimatedDeliveryDateUpdateTrackingByIdResponse"; +import { CustomEstimatedDeliveryDateUpdateTrackingByIdResponse } from "./CustomEstimatedDeliveryDateUpdateTrackingByIdResponse"; +import { FirstEstimatedDeliveryUpdateTrackingByIdResponse } from "./FirstEstimatedDeliveryUpdateTrackingByIdResponse"; +import { LatestEstimatedDeliveryUpdateTrackingByIdResponse } from "./LatestEstimatedDeliveryUpdateTrackingByIdResponse"; +import { CarbonEmissionsUpdateTrackingByIdResponse } from "./CarbonEmissionsUpdateTrackingByIdResponse"; +import { FirstMileUpdateTrackingByIdResponse } from "./FirstMileUpdateTrackingByIdResponse"; +import { LastMileUpdateTrackingByIdResponse } from "./LastMileUpdateTrackingByIdResponse"; +import { CustomersUpdateTrackingByIdResponse } from "./CustomersUpdateTrackingByIdResponse"; + +export interface UpdateTrackingByIdResponse { + /** + * Tracking ID. + */ + id?: string; + /** + * The length of the tracking ID has been increased from 24 characters to 32 characters. We will use the legacy_id field to store the original 24-character tracking ID to maintain compatibility with existing data. Therefore, all tracking endpoints will continue to work with the legacy_id field as before. + */ + legacy_id?: string; + /** + * The date and time the shipment was imported or added to AfterShip. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0. + */ + created_at?: string; + /** + * The date and time the shipment was updated. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0. + */ + updated_at?: string; + /** + * Tracking number. + */ + tracking_number?: string; + /** + * Unique courier code. When importing a shipment with no courier slug and the tracking number can’t be recognized, the courier will be marked as `unrecognized`. Get courier codes . + */ + slug?: string; + /** + * Whether or not AfterShip will continue tracking the shipments. Value is `false` when tag (status) is `Delivered`, `Expired`, or further updates for 30 days since last update. + */ + active?: boolean; + /** + * Custom fields that accept an object with string field. In order to protect the privacy of your customers, do not include any in custom fields. + */ + custom_fields?: { [key: string]: any }; + /** + * Total transit time in days.- For delivered shipments: Transit time (in days) = Delivered date - Pick-up date- For undelivered shipments: Transit time (in days) = Current date - Pick-up dateValue as `null` for the shipment without pick-up date. + */ + transit_time?: number; + /** + * The for the origin country/region. E.g. USA for the United States. + */ + origin_country_region?: string; + /** + * The state of the sender’s address. + */ + origin_state?: string; + /** + * The city of the sender’s address. + */ + origin_city?: string; + /** + * The postal code of the sender’s address. + */ + origin_postal_code?: string; + /** + * The sender address that the shipment is shipping from. + */ + origin_raw_location?: string; + /** + * The for the destination country/region. E.g. USA for the United States. + */ + destination_country_region?: string; + /** + * The state of the recipient’s address. + */ + destination_state?: string; + /** + * The city of the recipient’s address. + */ + destination_city?: string; + /** + * The postal code of the recipient’s address. + */ + destination_postal_code?: string; + /** + * The shipping address that the shipment is shipping to. + */ + destination_raw_location?: string; + /** + * Destination country/region of the tracking detected from the courier. ISO Alpha-3 (three letters). Value will be `null` if the courier doesn't provide the destination country. + */ + courier_destination_country_region?: string; + /** + * The field contains the estimated delivery date provided by the carrier. + */ + courier_estimated_delivery_date?: CourierEstimatedDeliveryDateUpdateTrackingByIdResponse; + /** + * Text field for the note. + */ + note?: string; + /** + * A globally-unique identifier for the order. + */ + order_id?: string; + /** + * The URL for the order in your system or store. + */ + order_id_path?: string; + /** + * The date and time the order was created in your system or store. It uses the format: `YYYY-MM-DDTHH:mm:ssZ` based on whichever timezone you provide. + */ + order_date?: string; + /** + * Number of packages under the tracking. + */ + shipment_package_count?: number; + /** + * The date and time the shipment was picked up by the carrier. It uses the timezone where the pickup occured. The format may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + shipment_pickup_date?: string; + /** + * The date and time the shipment was delivered. It uses the shipment recipient’s timezone. The format may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + shipment_delivery_date?: string; + /** + * The carrier service type for the shipment. + */ + shipment_type?: string; + /** + * The shipment_weight field represents the total weight of the shipment. In scenarios where the carrier does not provide this information, you can provide the weight to AfterShip. We will prioritize the data provided by the carrier, if available. The shipment weight will be included in the Response and accessed through the GET API, Webhook, and CSV export. It will also be displayed on the AfterShip Tracking admin. Additionally, it plays a significant role in error-free shipment handling and carbon emission calculations, ensuring accurate and informed decision-making + */ + shipment_weight?: ShipmentWeightUpdateTrackingByIdResponse; + /** + * Signed by information for delivered shipment. + */ + signed_by?: string; + /** + * Source of how this tracking is added. + */ + source?: string; + /** + * Current status of tracking. ( + */ + tag?: TagV1; + /** + * Current subtag of tracking. ( + */ + subtag?: string; + /** + * Normalized tracking message. ( + */ + subtag_message?: string; + /** + * By default this field shows the `tracking_number`, but you can customize it as you wish with any info (e.g. the order number). + */ + title?: string; + /** + * Number of attempts AfterShip tracks at courier's system. + */ + tracked_count?: number; + /** + * Indicates if the shipment is trackable till the final destination.Three possible values:- true- false- null + */ + last_mile_tracking_supported?: boolean; + /** + * The recipient’s language. If you set up AfterShip notifications in different languages, we use this to send the recipient tracking updates in their preferred language. + */ + language?: string; + /** + * Deprecated + */ + unique_token?: string; + /** + * Array of checkpoint object describes the checkpoint information. + */ + checkpoints?: Checkpoint[]; + /** + * Phone number(s) subscribed to receive sms notifications. + */ + subscribed_smses?: string[]; + /** + * Email address(es) subscribed to receive email notifications. + */ + subscribed_emails?: string[]; + /** + * Whether or not the shipment is returned to sender. Value is `true` when any of its checkpoints has subtag `Exception_010` (returning to sender) or `Exception_011` (returned to sender). Otherwise value is `false`. + */ + return_to_sender?: boolean; + /** + * The promised delivery date of the order. It uses the formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + order_promised_delivery_date?: string; + /** + * Shipment delivery type- pickup_at_store- pickup_at_courier- door_to_door + */ + delivery_type?: string; + /** + * Shipment pickup location for receiver + */ + pickup_location?: string; + /** + * Shipment pickup note for receiver + */ + pickup_note?: string; + /** + * Official tracking URL of the courier (if any). The language parameter of this link relies on the destination country/region and the language associated with the shipment, if the data regarding the destination country/region and language of the shipment is not available, AfterShip will set the language parameter of the link to "US" by default. + */ + courier_tracking_link?: string; + /** + * The date and time of the carrier’s first attempt to deliver the package to the recipient. It uses the shipment recipient’s timezone. The format may differ depending on how the carrier provides it:- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ + */ + first_attempted_at?: string; + /** + * Delivery instructions (delivery date or address) can be modified by visiting the link if supported by a carrier. The language parameter of this link relies on the destination country/region and the language associated with the shipment, if the data regarding the destination country/region and language of the shipment is not available, AfterShip will set the language parameter of the link to "US" by default. + */ + courier_redirect_link?: string; + /** + * Additional field required by some carriers to retrieve the tracking info. The shipper’s carrier account number. Refer to our article on for more details. + */ + tracking_account_number?: string; + /** + * Additional field required by some carriers to retrieve the tracking info. A type of tracking credential required by some carriers. Refer to our article on for more details. + */ + tracking_key?: string; + /** + * The date and time when the shipment is shipped by the merchant and ready for pickup by the carrier. The field supports the following formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZThe field serves two key purposes:- Calculate processing time metrics in the Order-to-delivery Analytics dashboard. To ensure accurate analytics, it's recommended to include timezone information when configuring this value- Required by certain carriers to retrieve tracking information as an additional tracking field. + */ + tracking_ship_date?: string; + /** + * Whether the tracking is delivered on time or not. + */ + on_time_status?: string; + /** + * The difference days of the on time. + */ + on_time_difference?: number; + /** + * The tags of the order. + */ + order_tags?: string[]; + /** + * The estimated delivery date of the shipment provided by AfterShip’s AI and shown to the recipients. It uses the format `YYYY-MM-DD` based on the shipment recipient’s timezone. + */ + aftership_estimated_delivery_date?: AftershipEstimatedDeliveryDateUpdateTrackingByIdResponse; + /** + * Estimated delivery time of the shipment based on your . It uses the format `YYYY-MM-DD` based on the shipment recipient’s timezone. + */ + custom_estimated_delivery_date?: CustomEstimatedDeliveryDateUpdateTrackingByIdResponse; + /** + * A unique, human-readable identifier for the order. + */ + order_number?: string; + /** + * The shipment’s original estimated delivery date. It could be provided by the carrier, AfterShip AI, or based on your custom settings. The format of carrier EDDs may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ AfterShip AI and custom EDDs always use the format `YYYY-MM-DD`. All EDDs use the shipment recipient’s timezone. + */ + first_estimated_delivery?: FirstEstimatedDeliveryUpdateTrackingByIdResponse; + /** + * The most recently calculated estimated delivery date. It could be provided by the carrier, AfterShip AI, or based on your custom settings. The format of carrier EDDs may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ AfterShip AI and custom EDDs always use the format `YYYY-MM-DD`. All EDDs use the shipment recipient’s timezone. + */ + latest_estimated_delivery?: LatestEstimatedDeliveryUpdateTrackingByIdResponse; + /** + * Used to add tags to your shipments to help categorize and filter them easily. + */ + shipment_tags?: string[]; + /** + * If you have multiple accounts connected for a single carrier on AfterShip, we have introduced the courier_connection_id field to allow you to specify the carrier account associated with each shipment. By providing this information, you enable us to accurately track and monitor your shipments based on the correct carrier account.(</br>In the event that you do not specify the courier_connection_id, we will handle your shipment using the connection that was created earliest among your connected accounts. + */ + courier_connection_id?: string; + /** + * (Legacy) Replaced by `origin_country_region`. Additional field required by some carriers to retrieve the tracking info. The origin country/region of the shipment. Refer to our article on for more details. + */ + tracking_origin_country_region?: string; + /** + * (Legacy) Replaced by `destination_country_region`. Additional field required by some carriers to retrieve the tracking info. The destination country/region of the shipment. Refer to our article on for more details. + */ + tracking_destination_country_region?: string; + /** + * (Legacy) Replaced by `destination_postal_code`. Additional field required by some carriers to retrieve the tracking info. The postal code of the recipient’s address. Refer to our article on for more details. + */ + tracking_postal_code?: string; + /** + * (Legacy) Replaced by `destination_state`. Additional field required by some carriers to retrieve the tracking info. The state/province of the recipient’s address. Refer to our article on for more details. + */ + tracking_state?: string; + /** + * The model contains the total amount of carbon emissions generated by the shipment. - AfterShip will provide this data only when it is available, and its availability is contingent upon the location and weight information that AfterShip can obtain.- The values will be accessible solely for shipments that have been successfully delivered. However, in the event of a shipping update after the delivery status has been achieved, the value may change.- It’s a paid service and only for Tracking Enterprise users, please contact your customer success manager if you want to know more. + */ + carbon_emissions?: CarbonEmissionsUpdateTrackingByIdResponse; + /** + * The location_id refers to the place where you fulfilled the items. - If you provide a location_id, the system will automatically use it as the tracking's origin address. However, passing both location_id and any origin address information simultaneously is not allowed.- Please make sure you add your locations . + */ + location_id?: string; + /** + * The shipping_method string refers to the chosen method for delivering the package. Merchants typically offer various shipping methods to consumers during the checkout process, such as, Local Delivery, Free Express Worldwide Shipping, etc. + */ + shipping_method?: string; + /** + * By dynamically tracking failed delivery attempts during shipment, this field allows you to pinpoint carriers accountable for the most failures. Analyzing the root cause of these failures enables you to improve carriers' delivery standard operating procedures (SOP), leading to an overall enhancement in delivery service quality. + */ + failed_delivery_attempts?: number; + /** + * The signature_requirement field serves the purpose of validating the service option type, specifically proof of delivery. By collecting the recipient's signature upon delivery, it ensures the package reaches the intended recipient and prevents disputes related to non-delivery or lost packages.</br> + */ + signature_requirement?: string; + /** + * The delivery location type represents the secure area where the carrier leaves the package, such as a safe place, locker, mailbox, front porch, etc. This information helps ensure the shipment reaches the intended recipient efficiently, minimizing the risk of theft or damage. + */ + delivery_location_type?: string; + /** + * The tracking URL directs your customers to the shipment tracking page which can display either the default or a customized page based on segmentation rules.- The universal URL is used by default, but you can opt for a custom domain if you have one. Learn how to set up a custom domain .The field is not automatically enabled in API & Webhook. Please contact support if you’d like to enable it. + */ + aftership_tracking_url?: string; + /** + * The order URL directs your customers to the order tracking page, which includes all shipments. It can display either the default or a customized page based on segmentation rules.- The universal URL is used by default, but you can opt for a custom domain if you have one. Learn how to set up a custom domain .The field is not automatically enabled in API & Webhook. Please contact support if you’d like to enable it. + */ + aftership_tracking_order_url?: string; + /** + * The field contains information about the first leg of the shipping starting from the carrier picking up the shipment from the shipper to the point where they hand it over to the last-mile carrier. Once AfterShip detects the shipment is multi-leg, we will populate the first-mile information under this object. + */ + first_mile?: FirstMileUpdateTrackingByIdResponse; + /** + * This field contains information about the last leg of the shipment, starting from the carrier who hands it over to the last-mile carrier, all the way to delivery. Once AfterShip detects that the shipment involves multiple legs and identifies the last-mile carrier, we will populate the last-mile carrier information in this object. Alternatively, the user can provide this information in this field to specify the last-mile carrier, which is helpful if AfterShip is unable to detect it automatically. + */ + last_mile?: LastMileUpdateTrackingByIdResponse; + /** + * The field contains the customer information associated with the tracking. A maximum of three customer objects are allowed. + */ + customers?: CustomersUpdateTrackingByIdResponse[]; +} diff --git a/src/model/WeightEstimatedDeliveryDateRequest.ts b/src/model/WeightEstimatedDeliveryDateRequest.ts new file mode 100644 index 0000000..eb4a1a8 --- /dev/null +++ b/src/model/WeightEstimatedDeliveryDateRequest.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface WeightEstimatedDeliveryDateRequest { + /** + * The weight unit of the package. + */ + unit: string; + /** + * The weight of the shipment. + */ + value: number; +} diff --git a/src/model/WeightEstimatedDeliveryDateResponse.ts b/src/model/WeightEstimatedDeliveryDateResponse.ts new file mode 100644 index 0000000..5aa5190 --- /dev/null +++ b/src/model/WeightEstimatedDeliveryDateResponse.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface WeightEstimatedDeliveryDateResponse { + /** + * The weight unit of the package. + */ + unit: string; + /** + * The weight of the shipment. + */ + value: number; +} diff --git a/src/model/WeightPredictRequest.ts b/src/model/WeightPredictRequest.ts new file mode 100644 index 0000000..b304d24 --- /dev/null +++ b/src/model/WeightPredictRequest.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface WeightPredictRequest { + /** + * The weight unit of the package. + */ + unit: string; + /** + * The weight of the shipment. + */ + value: number; +} diff --git a/src/model/WeightPredictResponse.ts b/src/model/WeightPredictResponse.ts new file mode 100644 index 0000000..97073d8 --- /dev/null +++ b/src/model/WeightPredictResponse.ts @@ -0,0 +1,15 @@ +/* + * This code was auto generated by AfterShip SDK Generator. + * Do not edit the class manually. + */ + +export interface WeightPredictResponse { + /** + * The weight unit of the package. + */ + unit: string; + /** + * The weight of the shipment. + */ + value: number; +} diff --git a/src/utils/parse_proxy.ts b/src/utils/parse_proxy.ts new file mode 100644 index 0000000..6360acf --- /dev/null +++ b/src/utils/parse_proxy.ts @@ -0,0 +1,81 @@ +import { AfterShipErrorCodes, AftershipError } from "../error"; + +export interface Proxy { + host: string; + port: number; + protocol?: string; + auth?: { + username: string; + password: string; + }; +} + +export function parseProxy(input?: string): Proxy | undefined { + if (!input) { + return undefined; + } + return { ...getAddress(input), ...getProtocol(input), ...getAuth(input) }; +} + +function getAddress(input: string): { host: string; port: number } { + if (input.includes("@")) { + input = input.substring(input.lastIndexOf("@") + 1); + } else if (input.includes("://")) { + input = input.split("://")[1]; + } + if (!input.includes(":")) { + throw new AftershipError( + `Invalid option: proxy`, + AfterShipErrorCodes.INVALID_OPTION, + ); + } + const host = input.split(":")[0]; + const port = parseInt(input.split(":")[1]); + if (/^\w+$/.test(host)) { + throw new AftershipError( + `Invalid option: proxy`, + AfterShipErrorCodes.INVALID_OPTION, + ); + } + if (isNaN(port)) { + throw new AftershipError( + `Invalid option: proxy`, + AfterShipErrorCodes.INVALID_OPTION, + ); + } + return { host: host, port: port }; +} + +function getProtocol(input: string): { protocol: string } { + if (!input.includes("://")) { + return { protocol: "http" }; + } + const protocol = input.split("://")[0]; + if (protocol.length < 3 || protocol.length > 6) { + throw new AftershipError( + `Invalid option: proxy`, + AfterShipErrorCodes.INVALID_OPTION, + ); + } + return { protocol }; +} + +function getAuth( + input: string, +): { auth: { username: string; password: string } } | undefined { + if (!input.includes("@")) { + return undefined; + } + if (input.includes("://")) { + input = input.split("://")[1]; + } + input = input.substring(0, input.lastIndexOf("@")); + if (!input.includes(":")) { + throw new AftershipError( + `Invalid option: proxy`, + AfterShipErrorCodes.INVALID_OPTION, + ); + } + const [username, password] = input.split(":"); + return { auth: { username, password } }; +} diff --git a/test.ts b/test.ts new file mode 100644 index 0000000..7a07df2 --- /dev/null +++ b/test.ts @@ -0,0 +1,89 @@ +// Step 1: Require the AfterShip client +import { AfterShip } from "./src/aftership"; +// or +// const {AfterShip} = require('@aftership/tracking-sdk'); + +// Step 2: Initialize the client object +const aftership = new AfterShip({ + api_key: "asat_870416d3ea2742dba0eb68e23ddfcbe9", +}); + +// Step 3: Create the request object +const createTrackingRequestBody = { + tracking_number: "432718269418", + slug: "fedex", +}; + +// Step 4: Make the request +for (let i = 0; i < 10; i++) { + aftership.tracking + .getTrackingById('64aadd38e5164280bad89241e2038383') + .then((result) => console.log(result)) + .catch((e) => console.log(e.response_headers)); +} +// aftership.tracking +// .createTracking(createTrackingRequestBody) +// .then((tracking) => console.log(tracking)) +// .catch((error) => console.log(error)); + +// aftership.tracking +// .deleteTrackingById('6bd44ccc82d342d0bab71dfa1dbe367f') +// .then((result) => console.log(result)) +// .catch((e) => console.log(e)); + +// const payload = { +// slug: 'ups', +// tracking_number: '1ZK7898C1317272039', +// title: 'Title Name', +// order_id: 'ID 1234', +// order_id_path: 'http://www.aftership.com/order_id=1234', +// custom_fields: { +// 'product_name': 'iPhone Case', +// 'product_price': 'USD19.99' +// } +// }; + +// aftership.tracking +// .createTracking(payload) +// .then((result) => console.log(result)) +// .catch((e) => console.log(e)); + +// aftership.tracking +// .getTrackings({ limit: 10, fields: 'id,slug,tracking_number' }) +// .then((result) => console.log(result)) +// .catch((e) => console.log(e)); + +// aftership.tracking +// .updateTrackingById('64aadd38e5164280bad89241e2038383',{title: 'New Title123'}) +// .then((result) => console.log(result)) +// .catch((e) => console.log(e)); + +// aftership.tracking +// .getTrackingById('64aadd38e5164280bad89241e2038383') +// .then((result) => console.log(result)) +// .catch((e) => console.log(e)); + +// aftership.tracking +// .retrackTrackingById('64aadd38e5164280bad89241e2038383') +// .then((result) => console.log(result)) +// .catch((e) => console.log(e)); + +// aftership.tracking +// .markTrackingCompletedById('64aadd38e5164280bad89241e2038383', { reason: 'DELIVERED' }) +// .then((result) => console.log(result)) +// .catch((e) => console.log(e)); + +// aftership.courier +// .getUserCouriers() +// .then(result => console.log(result)) +// .catch(e => console.log(e)); + +// aftership.courier +// .getAllCouriers() +// .then(result => console.log(result)) +// .catch(e => console.log(e)); + +// aftership.courier +// .detectCourier({ tracking_number: "432718269418" }) +// .then((result) => console.log(result)) +// .catch((e) => console.log(e)); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..75dd11e --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "noImplicitAny": false, + "target": "ES6", + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "strict": true, + "moduleResolution": "node", + "removeComments": true, + "sourceMap": true, + "noLib": false, + "declaration": true, + "lib": ["dom", "es6", "es5", "dom.iterable", "scripthost"], + "outDir": "dist", + "typeRoots": ["node_modules/@types"] + }, + "include": ["src/**/*"], + "exclude": ["src/**/*.spec.js", "src/**/*.js"], + "jsdoc": { + "out": "support/jsdoc", + "access": "public" + } +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..4a75fd8 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,77 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@types/node@^20.11.25": + version "20.17.12" + resolved "https://nexus.automizely.org/repository/npm-group/@types/node/-/node-20.17.12.tgz#ee3b7d25a522fd95608c1b3f02921c97b93fcbd6" + integrity sha512-vo/wmBgMIiEA23A/knMfn/cf37VnuF52nZh5ZoW0GWt4e4sxNquibrMRJ7UQsA06+MBx9r/H1jsI9grYjQCQlw== + dependencies: + undici-types "~6.19.2" + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://nexus.automizely.org/repository/npm-group/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== + +axios@^1.7.2: + version "1.7.9" + resolved "https://nexus.automizely.org/repository/npm-group/axios/-/axios-1.7.9.tgz#d7d071380c132a24accda1b2cfc1535b79ec650a" + integrity sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw== + dependencies: + follow-redirects "^1.15.6" + form-data "^4.0.0" + proxy-from-env "^1.1.0" + +combined-stream@^1.0.8: + version "1.0.8" + resolved "https://nexus.automizely.org/repository/npm-group/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://nexus.automizely.org/repository/npm-group/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== + +follow-redirects@^1.15.6: + version "1.15.9" + resolved "https://nexus.automizely.org/repository/npm-group/follow-redirects/-/follow-redirects-1.15.9.tgz#a604fa10e443bf98ca94228d9eebcc2e8a2c8ee1" + integrity sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ== + +form-data@^4.0.0: + version "4.0.1" + resolved "https://nexus.automizely.org/repository/npm-group/form-data/-/form-data-4.0.1.tgz#ba1076daaaa5bfd7e99c1a6cb02aa0a5cff90d48" + integrity sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + +mime-db@1.52.0: + version "1.52.0" + resolved "https://nexus.automizely.org/repository/npm-group/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@^2.1.12: + version "2.1.35" + resolved "https://nexus.automizely.org/repository/npm-group/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + +proxy-from-env@^1.1.0: + version "1.1.0" + resolved "https://nexus.automizely.org/repository/npm-group/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" + integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== + +typescript@^4.9.5: + version "4.9.5" + resolved "https://nexus.automizely.org/repository/npm-group/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" + integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== + +undici-types@~6.19.2: + version "6.19.8" + resolved "https://nexus.automizely.org/repository/npm-group/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==