Skip to content

Commit 9edde6e

Browse files
committed
printful init
1 parent 7f3c8a5 commit 9edde6e

File tree

7 files changed

+815
-2
lines changed

7 files changed

+815
-2
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import printful from "../../printful.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "printful-calculate-shipping-rates",
6+
name: "Calculate Shipping Rates",
7+
description: "Fetches available shipping rates for a given destination. [See the documentation](https://developers.printful.com/docs/)",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
printful,
12+
shippingRecipientAddress: {
13+
propDefinition: [
14+
printful,
15+
"shippingRecipientAddress",
16+
],
17+
},
18+
shippingProductDetails: {
19+
propDefinition: [
20+
printful,
21+
"shippingProductDetails",
22+
],
23+
},
24+
},
25+
async run({ $ }) {
26+
const shippingRates = await this.printful.fetchShippingRates({
27+
shippingRecipientAddress: this.shippingRecipientAddress,
28+
shippingProductDetails: this.shippingProductDetails,
29+
});
30+
$.export("$summary", "Fetched shipping rates successfully");
31+
return shippingRates;
32+
},
33+
};
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
import printful from "../../printful.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "printful-create-order",
6+
name: "Create Order",
7+
description: "Creates a new order in your Printful account. [See the documentation]()",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
printful: {
12+
type: "app",
13+
app: "printful",
14+
},
15+
recipientName: {
16+
propDefinition: [
17+
printful,
18+
"recipientName",
19+
],
20+
},
21+
recipientAddress1: {
22+
propDefinition: [
23+
printful,
24+
"recipientAddress1",
25+
],
26+
},
27+
recipientCity: {
28+
propDefinition: [
29+
printful,
30+
"recipientCity",
31+
],
32+
},
33+
recipientState: {
34+
propDefinition: [
35+
printful,
36+
"recipientState",
37+
],
38+
},
39+
recipientZip: {
40+
propDefinition: [
41+
printful,
42+
"recipientZip",
43+
],
44+
},
45+
recipientCountry: {
46+
propDefinition: [
47+
printful,
48+
"recipientCountry",
49+
],
50+
},
51+
shippingMethod: {
52+
propDefinition: [
53+
printful,
54+
"shippingMethod",
55+
],
56+
},
57+
orderItems: {
58+
propDefinition: [
59+
printful,
60+
"orderItems",
61+
],
62+
},
63+
recipientAddress2: {
64+
propDefinition: [
65+
printful,
66+
"recipientAddress2",
67+
],
68+
optional: true,
69+
},
70+
orderNotes: {
71+
propDefinition: [
72+
printful,
73+
"orderNotes",
74+
],
75+
optional: true,
76+
},
77+
orderMetadata: {
78+
propDefinition: [
79+
printful,
80+
"orderMetadata",
81+
],
82+
optional: true,
83+
},
84+
},
85+
async run({ $ }) {
86+
const response = await this.printful.createOrder({
87+
recipientName: this.recipientName,
88+
recipientAddress1: this.recipientAddress1,
89+
recipientAddress2: this.recipientAddress2,
90+
recipientCity: this.recipientCity,
91+
recipientState: this.recipientState,
92+
recipientZip: this.recipientZip,
93+
recipientCountry: this.recipientCountry,
94+
shippingMethod: this.shippingMethod,
95+
orderItems: this.orderItems,
96+
orderNotes: this.orderNotes,
97+
orderMetadata: this.orderMetadata,
98+
});
99+
$.export("$summary", `Created order ${response.id}`);
100+
return response;
101+
},
102+
};
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import printful from "../../printful.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "printful-update-product",
6+
name: "Update Product",
7+
description: "Updates an existing product in your Printful store. [See the documentation](https://developers.printful.com/docs/)",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
printful,
12+
productId: {
13+
propDefinition: [
14+
printful,
15+
"productId",
16+
],
17+
},
18+
updateFields: {
19+
propDefinition: [
20+
printful,
21+
"updateFields",
22+
],
23+
},
24+
},
25+
async run({ $ }) {
26+
const response = await this.printful.updateProduct({
27+
productId: this.productId,
28+
updateFields: this.updateFields,
29+
});
30+
$.export("$summary", `Updated product ${this.productId}`);
31+
return response;
32+
},
33+
};

0 commit comments

Comments
 (0)