-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
80 changed files
with
1,299 additions
and
1,600 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
app.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// @ts-expect-error - doesn't automatically detect "dist/index.d.mts" | ||
import Printify from './dist/index.cjs.js'; | ||
import type { Webhook } from './dist/index.d.mts'; | ||
|
||
const printify = new Printify({ | ||
shopId: '123456', | ||
accessToken: process.env.PRINTIFY_API_TOKEN, | ||
enableLogging: true, | ||
}); | ||
|
||
(async () => { | ||
const result: Webhook[] = await printify.webhooks.list(); | ||
console.log(result); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "printify-development-testing", | ||
"scripts": { | ||
"start": "tsc && node app.js" | ||
}, | ||
"dependencies": { | ||
"printify-sdk-js": "*" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^5.5.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2016", | ||
"module": "commonjs", | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"skipLibCheck": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,14 @@ | ||
import Printify from 'printify-sdk-js'; | ||
import type { ListWebhooksResponse, Webhook } from 'printify-sdk-js'; | ||
|
||
const printify = new Printify({ | ||
shopId: '123456', | ||
accessToken: 'asdfasdf', | ||
accessToken: process.env.PRINTIFY_API_TOKEN, | ||
enableLogging: true, | ||
}); | ||
|
||
const orderData = { | ||
external_id: 'unique_external_id', | ||
label: 'Order Label', | ||
line_items: [ | ||
{ | ||
print_provider_id: 12345, | ||
blueprint_id: 67890, | ||
variant_id: 112233, | ||
print_areas: { | ||
front: 'https://example.com/path/to/sticker.png', | ||
}, | ||
quantity: 1, | ||
}, | ||
// ... | ||
], | ||
shipping_method: 1, | ||
is_printify_express: true, | ||
is_economy_shipping: false, | ||
send_shipping_notification: true, | ||
address_to: { | ||
first_name: 'string', | ||
last_name: 'string', | ||
email: 'string', | ||
phone: 'string', | ||
region: 'NY', | ||
address1: '123 Main Street', | ||
address2: '', | ||
city: 'New York', | ||
zip: '10001', | ||
country: 'US', | ||
}, | ||
}; | ||
|
||
(async () => { | ||
const result = await printify.orders.submit(orderData); | ||
console.log(result); // { "id": "5a96f649b2439217d070f507" } | ||
const result: ListWebhooksResponse = await printify.webhooks.list(); | ||
const webhook: Webhook = result[0]; | ||
console.log(webhook); // { "topic": "order:created", "url": "https://example.com/webhooks/order/created", "shop_id": "1", "id": "5cb87a8cd490a2ccb256cec4" } | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.