Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions components/fedex/actions/track-by-reference/track-by-reference.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import fedex from "../../fedex.app.mjs";
import { ConfigurationError } from "@pipedream/platform";

export default {
key: "fedex-track-by-reference",
name: "Track by Reference",
description: "Tracks a package by reference number. [See the documentation](https://developer.fedex.com/api/en-us/catalog/track/v1/docs.html#operation/Track%20by%20References)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
props: {
fedex,
value: {
type: "string",
label: "Reference Value",
description: "The reference value to track",
},
accountNumber: {
type: "string",
label: "Account Number",
description: "The shipper's account number. Either `accountNumber` or `destinationPostalCode` and `destinationCountryCode` must be provided.",
optional: true,
},
destinationPostalCode: {
type: "string",
label: "Destination Postal Code",
description: "The postal code of the destination. Either `accountNumber` or `destinationPostalCode` and `destinationCountryCode` must be provided.",
optional: true,
},
destinationCountryCode: {
type: "string",
label: "Destination Country Code",
description: "The country code of the destination. Either `accountNumber` or `destinationPostalCode` and `destinationCountryCode` must be provided.",
optional: true,
},
shipDateBegin: {
propDefinition: [
fedex,
"shipDateBegin",
],
},
shipDateEnd: {
propDefinition: [
fedex,
"shipDateEnd",
],
},
includeDetailedScans: {
propDefinition: [
fedex,
"includeDetailedScans",
],
},
},
async run({ $ }) {
if (!this.accountNumber && (!this.destinationPostalCode || !this.destinationCountryCode)) {
throw new ConfigurationError("Either `accountNumber` or `destinationPostalCode` and `destinationCountryCode` must be provided.");
}
const response = await this.fedex.trackByReference({
$,
data: {
referencesInformation: {
value: this.value,
accountNumber: this.accountNumber,
destinationPostalCode: this.destinationPostalCode,
destinationCountryCode: this.destinationCountryCode,
shipDateBegin: this.shipDateBegin,
shipDateEnd: this.shipDateEnd,
},
includeDetailedScans: this.includeDetailedScans,
},
});
$.export("$summary", `Tracking information for ${this.trackingNumber} retrieved successfully`);
return response;
},
};
55 changes: 55 additions & 0 deletions components/fedex/actions/track-by-tcn/track-by-tcn.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import fedex from "../../fedex.app.mjs";

export default {
key: "fedex-track-by-tcn",
name: "Track by TCN",
description: "Tracks a package by transportation control number. [See the documentation](https://developer.fedex.com/api/en-us/catalog/track/v1/docs.html#operation/f1f9080e8452d9ac903f562a2d2626d0)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
props: {
fedex,
value: {
type: "string",
label: "Transportation Control Number",
description: "The transportation control number to track",
},
shipDateBegin: {
propDefinition: [
fedex,
"shipDateBegin",
],
},
shipDateEnd: {
propDefinition: [
fedex,
"shipDateEnd",
],
},
includeDetailedScans: {
propDefinition: [
fedex,
"includeDetailedScans",
],
},
},
async run({ $ }) {
const response = await this.fedex.trackByTrackingControlNumber({
$,
data: {
tcnInfo: {
value: this.value,
shipDateBegin: this.shipDateBegin,
shipDateEnd: this.shipDateEnd,
},
includeDetailedScans: this.includeDetailedScans,
},
});
$.export("$summary", `Tracking information for ${this.value} retrieved successfully`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import fedex from "../../fedex.app.mjs";

export default {
key: "fedex-track-by-tracking-number",
name: "Track by Tracking Number",
description: "Tracks a package by tracking number. [See the documentation](https://developer.fedex.com/api/en-us/catalog/track/v1/docs.html#operation/Track%20by%20Tracking%20Number)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
props: {
fedex,
trackingNumber: {
propDefinition: [
fedex,
"trackingNumber",
],
},
includeDetailedScans: {
propDefinition: [
fedex,
"includeDetailedScans",
],
},
},
async run({ $ }) {
const response = await this.fedex.trackByTrackingNumber({
$,
data: {
trackingInfo: [
{
trackingNumberInfo: {
trackingNumber: this.trackingNumber,
},
},
],
includeDetailedScans: this.includeDetailedScans,
},
});
$.export("$summary", `Tracking information for ${this.trackingNumber} retrieved successfully`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import fedex from "../../fedex.app.mjs";

export default {
key: "fedex-track-multi-piece-shipment",
name: "Track Multi-Piece Shipment",
description: "Tracks a multi-piece shipment. [See the documentation](https://developer.fedex.com/api/en-us/catalog/track/v1/docs.html#operation/Track%20Multiple%20Piece%20Shipment)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
props: {
fedex,
associatedType: {
type: "string",
label: "Associated Type",
description: "The associated shipment type, such as MPS, Group MPS, or an outbound shipment which is linked to a return shipment",
options: [
"OUTBOUND_LINK_TO_RETURN",
"STANDARD_MPS",
"GROUP_MPS",
],
},
trackingNumber: {
propDefinition: [
fedex,
"trackingNumber",
],
},
includeDetailedScans: {
propDefinition: [
fedex,
"includeDetailedScans",
],
},
},
async run({ $ }) {
const response = await this.fedex.trackMultiplePieceShipment({
$,
data: {
associatedType: this.associatedType,
masterTrackingNumberInfo: {
trackingNumberInfo: {
trackingNumber: this.trackingNumber,
},
},
includeDetailedScans: this.includeDetailedScans,
},
});
$.export("$summary", `Tracking information for ${this.trackingNumber} retrieved successfully`);
return response;
},
};
50 changes: 50 additions & 0 deletions components/fedex/fedex.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,28 @@ export default {
label: "Weights",
description: "An array of weight values for each of the requested pieces of the shipment",
},
trackingNumber: {
type: "string",
label: "Tracking Number",
description: "The tracking number to track",
},
includeDetailedScans: {
type: "boolean",
label: "Include Detailed Scans",
description: "Indicates whether to include detailed scan information in the response",
default: false,
optional: true,
},
shipDateBegin: {
type: "string",
label: "Ship Date Begin",
description: "The beginning of the ship date range to track. Format: YYYY-MM-DD",
},
shipDateEnd: {
type: "string",
label: "Ship Date End",
description: "The end of the ship date range to track. Format: YYYY-MM-DD",
},
},
methods: {
_baseUrl() {
Expand Down Expand Up @@ -208,5 +230,33 @@ export default {
...opts,
});
},
trackByTrackingNumber(opts = {}) {
return this._makeRequest({
path: "/track/v1/trackingnumbers",
method: "POST",
...opts,
});
},
trackByReference(opts = {}) {
return this._makeRequest({
path: "/track/v1/referencenumbers",
method: "POST",
...opts,
});
},
trackByTrackingControlNumber(opts = {}) {
return this._makeRequest({
path: "/track/v1/tcn",
method: "POST",
...opts,
});
},
trackMultiplePieceShipment(opts = {}) {
return this._makeRequest({
path: "/track/v1/associatedshipments",
method: "POST",
...opts,
});
},
},
};
2 changes: 1 addition & 1 deletion components/fedex/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/fedex",
"version": "0.1.0",
"version": "0.2.0",
"description": "Pipedream FedEx Components",
"main": "fedex.app.mjs",
"keywords": [
Expand Down
Loading