Skip to content

Commit

Permalink
v2 endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerlepine committed Jan 6, 2025
1 parent cb3d8f7 commit 5962584
Show file tree
Hide file tree
Showing 6 changed files with 250 additions and 63 deletions.
20 changes: 10 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.3.0] - 2025-01-XX
## [1.3.0] - 2025-01-06

- TODO v1.3.0
- Added support for V2 endpoints
- Added support for V2 endpoints.
- Removed verbose stack trace from errors.

## [1.2.0] - 2025-01-03

- Organized shared types and fixed bundle export
- Improved configuration object
- Organized shared types and fixed bundle export.
- Improved configuration object.

## [1.1.0] - 2024-11-08

- Replaced `fetch` with `axios` for improved security
- Applied minor internal refactors for better maintainability
- Replaced `fetch` with `axios` for enhanced security.
- Refactored internal code for better maintainability.

## [1.0.2] - 2024-10-24

Improved error log for easier debugging
- Added error logging for easier debugging.

## [1.0.1] - 2024-07-29

Documentation update for TypeScript support
- Updated documentation to include TypeScript support.

## [1.0.0] - 2024-07-26

Initial release for Printify API v1
- Initial release for Printify API v1.
204 changes: 155 additions & 49 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,34 @@ await printify.v2.catalog.getStandardShippingInfo('3', '8');
<summary>View Response</summary>

```json
// TODO v1.3.0
[
{
"type": "variant_shipping_standard_us",
"id": "23494",
"attributes": {
"shippingType": "standard",
"country": {
"code": "US"
},
"variantId": 23494,
"shippingPlanId": "65a7c0825b50fcd56a018e02",
"handlingTime": {
"from": 4,
"to": 8
},
"shippingCost": {
"firstItem": {
"amount": 399,
"currency": "USD"
},
"additionalItems": {
"amount": 219,
"currency": "USD"
}
}
}
}
]
```

</details>
Expand All @@ -549,7 +576,34 @@ await printify.v2.catalog.getPriorityShippingInfo('3', '8');
<summary>View Response</summary>

```json
// TODO v1.3.0
[
{
"type": "variant_shipping_priority_us",
"id": "23494",
"attributes": {
"shippingType": "priority",
"country": {
"code": "US"
},
"variantId": 23494,
"shippingPlanId": "65a7c0825b50fcd56a018e02",
"handlingTime": {
"from": 4,
"to": 8
},
"shippingCost": {
"firstItem": {
"amount": 399,
"currency": "USD"
},
"additionalItems": {
"amount": 219,
"currency": "USD"
}
}
}
}
]
```

</details>
Expand All @@ -567,7 +621,34 @@ await printify.v2.catalog.getExpressShippingInfo('3', '8');
<summary>View Response</summary>

```json
// TODO v1.3.0
[
{
"type": "variant_shipping_express_us",
"id": "23494",
"attributes": {
"shippingType": "express",
"country": {
"code": "US"
},
"variantId": 23494,
"shippingPlanId": "65a7c0825b50fcd56a018e02",
"handlingTime": {
"from": 4,
"to": 8
},
"shippingCost": {
"firstItem": {
"amount": 399,
"currency": "USD"
},
"additionalItems": {
"amount": 219,
"currency": "USD"
}
}
}
}
]
```

</details>
Expand All @@ -585,7 +666,34 @@ await printify.v2.catalog.getEconomyShippingInfo('3', '8');
<summary>View Response</summary>

```json
// TODO v1.3.0
[
{
"type": "variant_shipping_economy_us",
"id": "23494",
"attributes": {
"shippingType": "economy",
"country": {
"code": "US"
},
"variantId": 23494,
"shippingPlanId": "65a7c0825b50fcd56a018e02",
"handlingTime": {
"from": 4,
"to": 8
},
"shippingCost": {
"firstItem": {
"amount": 399,
"currency": "USD"
},
"additionalItems": {
"amount": 219,
"currency": "USD"
}
}
}
}
]
```

</details>
Expand Down Expand Up @@ -1474,52 +1582,50 @@ await printify.orders.submitExpress(data);
<summary>View Response</summary>

```json
{
"data": [
{
"type": "order",
"id": "5a96f649b2439217d070f508",
"attributes": {
"fulfilment_type": "express",
"line_items": [
{
"product_id": "5b05842f3921c9547531758d",
"quantity": 1,
"variant_id": 12359,
"print_provider_id": 5,
"cost": 2200,
"shipping_cost": 799,
"status": "pending",
"metadata": { "title": "T-shirt", "price": 2200, "variant_label": "Blue / S", "sku": "168699843", "country": "United States" },
"sent_to_production_at": "2023-10-18 13:24:28+00:00",
"fulfilled_at": null
}
]
}
},
{
"type": "order",
"id": "5a96f649b2439597d020a9b4",
"attributes": {
"fulfilment_type": "ordinary",
"line_items": [
{
"product_id": "5b05842f3921c34764fa478bc",
"quantity": 1,
"variant_id": 17887,
"print_provider_id": 5,
"cost": 1050,
"shipping_cost": 400,
"status": "pending",
"metadata": { "title": "Mug 11oz", "price": 1050, "variant_label": "11oz", "sku": "168699843", "country": "United States" },
"sent_to_production_at": "2023-10-18 13:24:28+00:00",
"fulfilled_at": null
}
]
}
[
{
"type": "order",
"id": "5a96f649b2439217d070f508",
"attributes": {
"fulfilment_type": "express",
"line_items": [
{
"product_id": "5b05842f3921c9547531758d",
"quantity": 1,
"variant_id": 12359,
"print_provider_id": 5,
"cost": 2200,
"shipping_cost": 799,
"status": "pending",
"metadata": { "title": "T-shirt", "price": 2200, "variant_label": "Blue / S", "sku": "168699843", "country": "United States" },
"sent_to_production_at": "2023-10-18 13:24:28+00:00",
"fulfilled_at": null
}
]
}
]
}
},
{
"type": "order",
"id": "5a96f649b2439597d020a9b4",
"attributes": {
"fulfilment_type": "ordinary",
"line_items": [
{
"product_id": "5b05842f3921c34764fa478bc",
"quantity": 1,
"variant_id": 17887,
"print_provider_id": 5,
"cost": 1050,
"shipping_cost": 400,
"status": "pending",
"metadata": { "title": "Mug 11oz", "price": 1050, "variant_label": "11oz", "sku": "168699843", "country": "United States" },
"sent_to_production_at": "2023-10-18 13:24:28+00:00",
"fulfilled_at": null
}
]
}
}
]
```

</details>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "printify-sdk-js",
"version": "1.3.0-beta.1",
"version": "1.3.0",
"description": "Node.js SDK for the Printify API.",
"author": "Spencer Lepine <spencer.sayhello@gmail.com>",
"license": "MIT",
Expand Down
29 changes: 28 additions & 1 deletion src/v2/catalog/getEconomyShippingInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,34 @@ export type GetEconomyShippingInfoResponse = ShippingInfoSpecific;
* @example
* await printify.v2.catalog.getEconomyShippingInfo('3', '8');
* // Expected response: [
* // TODO v1.3.0
* // [
* // {
* // "type": "variant_shipping_economy_us",
* // "id": "23494",
* // "attributes": {
* // "shippingType": "economy",
* // "country": {
* // "code": "US"
* // },
* // "variantId": 23494,
* // "shippingPlanId": "65a7c0825b50fcd56a018e02",
* // "handlingTime": {
* // "from": 4,
* // "to": 8
* // },
* // "shippingCost": {
* // "firstItem": {
* // "amount": 399,
* // "currency": "USD"
* // },
* // "additionalItems": {
* // "amount": 219,
* // "currency": "USD"
* // }
* // }
* // }
* // }
* // ]
*/
const getEconomyShippingInfo = function (this: method, blueprintId: string, printProviderId: string): Promise<GetEconomyShippingInfoResponse> {
return this.request(`/v2/catalog/blueprints/${blueprintId}/print_providers/${printProviderId}/shipping/economy.json`, {
Expand Down
29 changes: 28 additions & 1 deletion src/v2/catalog/getExpressShippingInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,34 @@ export type GetExpressShippingInfoResponse = ShippingInfoSpecific;
* @example
* await printify.v2.catalog.getExpressShippingInfo('3', '8');
* // Expected response: [
* // TODO v1.3.0
* // [
* // {
* // "type": "variant_shipping_standard_us",
* // "id": "23494",
* // "attributes": {
* // "shippingType": "standard",
* // "country": {
* // "code": "US"
* // },
* // "variantId": 23494,
* // "shippingPlanId": "65a7c0825b50fcd56a018e02",
* // "handlingTime": {
* // "from": 4,
* // "to": 8
* // },
* // "shippingCost": {
* // "firstItem": {
* // "amount": 399,
* // "currency": "USD"
* // },
* // "additionalItems": {
* // "amount": 219,
* // "currency": "USD"
* // }
* // }
* // }
* // }
* // ]
*/
const getExpressShippingInfo = function (this: method, blueprintId: string, printProviderId: string): Promise<GetExpressShippingInfoResponse> {
return this.request(`/v2/catalog/blueprints/${blueprintId}/print_providers/${printProviderId}/shipping/express.json`, {
Expand Down
29 changes: 28 additions & 1 deletion src/v2/catalog/getPriorityShippingInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,34 @@ export type GetPriorityShippingInfoResponse = ShippingInfoSpecific;
* @example
* await printify.v2.catalog.getPriorityShippingInfo('3', '8');
* // Expected response: [
* // TODO v1.3.0
* // [
* // {
* // "type": "variant_shipping_priority_us",
* // "id": "23494",
* // "attributes": {
* // "shippingType": "priority",
* // "country": {
* // "code": "US"
* // },
* // "variantId": 23494,
* // "shippingPlanId": "65a7c0825b50fcd56a018e02",
* // "handlingTime": {
* // "from": 4,
* // "to": 8
* // },
* // "shippingCost": {
* // "firstItem": {
* // "amount": 399,
* // "currency": "USD"
* // },
* // "additionalItems": {
* // "amount": 219,
* // "currency": "USD"
* // }
* // }
* // }
* // }
* // ]
*/
const getPriorityShippingInfo = function (this: method, blueprintId: string, printProviderId: string): Promise<GetPriorityShippingInfoResponse> {
return this.request(`/v2/catalog/blueprints/${blueprintId}/print_providers/${printProviderId}/shipping/priority.json`, {
Expand Down

0 comments on commit 5962584

Please sign in to comment.