diff --git a/.npmignore b/.npmignore index 7ed338f..23ea2b4 100644 --- a/.npmignore +++ b/.npmignore @@ -2,9 +2,7 @@ * # Except for the following files and directories: -!dist/index.cjs.js -!dist/index.esm.js -!dist/types/index.d.mts +!dist !package.json !README.md !LICENSE diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2a49a65..d73ad0f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,30 +2,6 @@ Welcome! We're thrilled that you are interested in contributing to our project. By participating in this project, you agree to abide by the [Code of Conduct](./CODE_OF_CONDUCT.md). -## Local Development - -### Prerequisites - -1. Git -1. Node: any 18.x version starting with v16.0.0 or greater -1. Yarn: See [Yarn website for installation instructions](https://yarnpkg.com/lang/en/docs/install/) (`npm install yarn -g`) - -### Installation - -```sh -git clone https://github.com/spencerlepine/printify-sdk-js.git -cd printify-sdk-js -yarn install -``` - -### Testing - -Add/update tests in the `tests/` directory, ensuring to follow unit test coding conventions - -```sh -yarn test -``` - ## How Can I Contribute? ### Reporting Bugs diff --git a/README.md b/README.md index 124423b..b3ef5ad 100644 --- a/README.md +++ b/README.md @@ -4,104 +4,75 @@ ![Coverage](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg) ![MIT license](https://img.shields.io/badge/License-MIT-blue.svg) ![Project Status Badge](./.github/status-maintained-badge.svg) -Printify SDK for Node.js. A basic TypeScript wrapper for the Printify REST API (v1). Guidelines and source endpoints can be found here: -[developers.printify.com](https://developers.printify.com). +The Printify Node SDK provides convenient access to the Printify API from applications written in server-side JavaScript. -## Getting started +Guidelines and source endpoints can be found here: [developers.printify.com](https://developers.printify.com). -### Prerequisites +> 📢 Note: This SDK currently supports V1 API endpoints only. A 2.0.0 release is planned once the majority of V2 endpoints have been migrated. -- Printify Personal Access Token (create one [here](https://printify.com/app/account/api)) +## Documentation -### Installation +See the [`printify-sdk-js` API docs](./docs/API.md) for Node.js + +- [Shops](./docs/API.md#shops) - `printify.shops.*` +- [Catalog](./docs/API.md#catalog) - `printify.catalog.*` +- [Products](./docs/API.md#products) - `printify.products.*` +- [Orders](./docs/API.md#orders) - `printify.orders.*` +- [Uploads](./docs/API.md#uploads) - `printify.uploads.*` +- [Webhooks](./docs/API.md#webhooks) - `printify.webhooks.*` + +## Installation ```sh -# Npm npm install printify-sdk-js - -# Yarn +# or yarn add printify-sdk-js - -# Pnpm +# or pnpm add printify-sdk-js ``` ## Usage -> ⚠️ For security purposes, this is intended only for server-side use, the API does not support CORS and will not process requests from a frontend application +The package needs to be configured with your account's Personal Access Token (create one [here](https://printify.com/app/account/api)). -```sh -# generate a token: https://printify.com/app/account/api -export PRINTIFY_API_TOKEN="asdfASDFasdfASDFasdfASDF" +```js +import Printify from 'printify-sdk-js'; -# fetch your shopId -curl -X GET https://api.printify.com/v1/shops.json --header "Authorization: Bearer $PRINTIFY_API_TOKEN" -# Expected response: [{"id":1234567,"title":"My Store Name","sales_channel":"custom_integration"}] +const printify = new Printify({ + shopId: '123456', // (optional) find using printify.shops.list() + accessToken: 'asdf0123asdf0123asdf0123', // generate a token: https://printify.com/app/account/api + enableLogging: true, // (optional) enabled by default +}); -# store for process.env.PRINTIFY_API_TOKEN -echo "PRINTIFY_API_TOKEN=\"$PRINTIFY_API_TOKEN\"" >> .env +const orders = await printify.orders.list({ limit: 5, status: 'fulfilled' }); +console.log(orders); // { current_page: 1, data: [{ id: "5a9", address_to: {}, line_items: [], total_price: 2200, status: "fulfilled" } ] ``` +### Usage with CommonJS + ```js -import Printify from 'printify-sdk-js'; -// const Printify = require('printify-sdk-js'); // CommonJS +const Printify = require('printify-sdk-js'); const printify = new Printify({ - shopId: '123456', // global query by shop_id - accessToken: process.env.PRINTIFY_API_TOKEN, - enableLogging: true, // on by default + shopId: '123456', + accessToken: 'asdf0123asdf0123asdf0123', + enableLogging: true, }); -const orderData = { - label: order_123456, - line_items: [ - { - print_provider_id: '12345', - blueprint_id: '67890', - variant_id: '112233', - print_areas: { - front: 'https://example.com/path/to/sticker.png', // **must be public - }, - quantity: 1, - }, - // ... - ], - shipping_method: 1, - is_printify_express: false, - is_economy_shipping: false, - send_shipping_notification: true, // send email - address_to: { - first_name: 'John', - last_name: 'Doe', - email: 'johndoe@gmail.com', - phone: '0574 69 21 90', - country: 'US', - region: 'NY', - address1: '123 Main Street', - address2: '', - city: 'New York', - zip: '10001', - }, -}; - -try { - const result = await printify.orders.submit(orderData); - console.log(result); // { "id": "5a96f649b2439217d070f507" } -} catch (error) { - console.error('Error submitting order:', error); -} +printify.orders + .list({ limit: 5, status: 'fulfilled' }) + .then(orders => console.log(orders)) + .catch(error => console.error(error)); ``` -## API +## Development -For the full documentation, please see [`API.md`](./docs/API.md) +```sh +yarn install +yarn test +``` -- [Shops](./docs/API.md#shops) - `printify.shops.*` -- [Catalog](./docs/API.md#catalog) - `printify.catalog.*` -- [Products](./docs/API.md#products) - `printify.products.*` -- [Orders](./docs/API.md#orders) - `printify.orders.*` -- [Uploads](./docs/API.md#uploads) - `printify.uploads.*` -- [Webhooks](./docs/API.md#webhooks) - `printify.webhooks.*` +> If you do not have yarn installed, you can get it with `npm install --global yarn`. ## Contributing diff --git a/docs/API.md b/docs/API.md index 7880a55..87d3bb7 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1,76 +1,5 @@ # Printify SDK Documentation (Node.js) -## Introduction - -The Printify SDK for Node.js. A basic TypeScript wrapper for the Printify REST API (v1). Guidelines and source endpoints can be found here: -[developers.printify.com](https://developers.printify.com/). - -## Usage - -```sh -# generate a token: https://printify.com/app/account/api -export PRINTIFY_API_TOKEN="asdfASDFasdfASDFasdfASDF" - -# fetch your shopId -curl -X GET https://api.printify.com/v1/shops.json --header "Authorization: Bearer $PRINTIFY_API_TOKEN" -# Expected response: [{"id":1234567,"title":"My Store Name","sales_channel":"custom_integration"}] - -# store for process.env.PRINTIFY_API_TOKEN -echo "PRINTIFY_API_TOKEN=\"$PRINTIFY_API_TOKEN\"" >> .env -``` - -```js -import Printify from 'printify-sdk-js'; -// const Printify = require('printify-sdk-js'); // CommonJS - -const printify = new Printify({ - shopId: '123456', // global query by shop_id - accessToken: process.env.PRINTIFY_API_TOKEN, - enableLogging: true, // on by default -}); - -const orderData = { - label: 'order_123456', - line_items: [ - { - print_provider_id: '12345', - blueprint_id: '67890', - variant_id: '112233', - print_areas: { - front: 'https://example.com/path/to/sticker.png', // **must be public - }, - quantity: 1, - }, - // ... - ], - shipping_method: 1, - is_printify_express: false, - is_economy_shipping: false, - send_shipping_notification: true, // send email - address_to: { - first_name: 'John', - last_name: 'Doe', - email: 'johndoe@gmail.com', - phone: '0574 69 21 90', - country: 'US', - region: 'NY', - address1: '123 Main Street', - address2: '', - city: 'New York', - zip: '10001', - }, -}; - -try { - const result = await printify.orders.submit(orderData); - console.log(result); // { "id": "5a96f649b2439217d070f507" } -} catch (error) { - console.error('Error submitting order:', error); -} -``` - -## API - - [Shops](#shops) - [Catalog](#catalog) - [Products](#products) diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..e7423e7 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,8 @@ +# Printify SDK Examples + +## Usage + +```sh +$ npm install +$ npm start +``` diff --git a/examples/commonjs/app.js b/examples/commonjs/app.js new file mode 100644 index 0000000..edf7065 --- /dev/null +++ b/examples/commonjs/app.js @@ -0,0 +1,12 @@ +const Printify = require('printify-sdk-js'); + +const printify = new Printify({ + shopId: '123456', + accessToken: 'asdf0123asdf0123asdf0123', + enableLogging: true, +}); + +printify.orders + .list({ limit: 5, status: 'fulfilled' }) + .then(orders => console.log(orders)) + .catch(error => console.error(error)); diff --git a/examples/commonjs/package.json b/examples/commonjs/package.json new file mode 100644 index 0000000..3d7c651 --- /dev/null +++ b/examples/commonjs/package.json @@ -0,0 +1,10 @@ +{ + "name": "printify-node-examples", + "type": "module", + "scripts": { + "start": "node app.js" + }, + "dependencies": { + "printify-sdk-js": "*" + } +} diff --git a/examples/node/app.js b/examples/node/app.js new file mode 100644 index 0000000..6458243 --- /dev/null +++ b/examples/node/app.js @@ -0,0 +1,45 @@ +import Printify from 'printify-sdk-js'; + +const printify = new Printify({ + shopId: '123456', + accessToken: 'asdfasdf', + 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" } +})(); diff --git a/examples/node/package.json b/examples/node/package.json new file mode 100644 index 0000000..98e4a82 --- /dev/null +++ b/examples/node/package.json @@ -0,0 +1,9 @@ +{ + "name": "printify-node-examples", + "scripts": { + "start": "node app.js" + }, + "dependencies": { + "printify-sdk-js": "*" + } +} diff --git a/examples/typescript/app.ts b/examples/typescript/app.ts new file mode 100644 index 0000000..6458243 --- /dev/null +++ b/examples/typescript/app.ts @@ -0,0 +1,45 @@ +import Printify from 'printify-sdk-js'; + +const printify = new Printify({ + shopId: '123456', + accessToken: 'asdfasdf', + 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" } +})(); diff --git a/examples/typescript/package.json b/examples/typescript/package.json new file mode 100644 index 0000000..2fde630 --- /dev/null +++ b/examples/typescript/package.json @@ -0,0 +1,12 @@ +{ + "name": "printify-typescript-examples", + "scripts": { + "start": "tsc && node app.js" + }, + "dependencies": { + "printify-sdk-js": "*" + }, + "devDependencies": { + "typescript": "^5.5.4" + } +} diff --git a/examples/typescript/tsconfig.json b/examples/typescript/tsconfig.json new file mode 100644 index 0000000..3ffa57b --- /dev/null +++ b/examples/typescript/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "target": "es2016", + "module": "commonjs", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true + } +} diff --git a/src/catalog/getBlueprint.ts b/src/catalog/getBlueprint.ts index 9d3a74a..e40e955 100644 --- a/src/catalog/getBlueprint.ts +++ b/src/catalog/getBlueprint.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface GetBlueprintResponse { id: number; diff --git a/src/catalog/getBlueprintProviders.ts b/src/catalog/getBlueprintProviders.ts index dfe61c6..5c66aa6 100644 --- a/src/catalog/getBlueprintProviders.ts +++ b/src/catalog/getBlueprintProviders.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface PrintProvider { id: number; diff --git a/src/catalog/getBlueprintVariants.ts b/src/catalog/getBlueprintVariants.ts index 3062a83..f30cba4 100644 --- a/src/catalog/getBlueprintVariants.ts +++ b/src/catalog/getBlueprintVariants.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface Placeholder { position: string; diff --git a/src/catalog/getProvider.ts b/src/catalog/getProvider.ts index 1175b4d..c9aead9 100644 --- a/src/catalog/getProvider.ts +++ b/src/catalog/getProvider.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface Location { address1: string; diff --git a/src/catalog/getVariantShipping.ts b/src/catalog/getVariantShipping.ts index 242a7a0..b65dba5 100644 --- a/src/catalog/getVariantShipping.ts +++ b/src/catalog/getVariantShipping.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface ShippingProfile { variant_ids: number[]; diff --git a/src/catalog/index.ts b/src/catalog/index.ts index 7434688..a62dd14 100644 --- a/src/catalog/index.ts +++ b/src/catalog/index.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; import listBlueprints, { ListBlueprintsFunc } from './listBlueprints'; import getBlueprint, { GetBlueprintFunc } from './getBlueprint'; import getBlueprintProviders, { GetBlueprintProvidersFunc } from './getBlueprintProviders'; diff --git a/src/catalog/listBlueprints.ts b/src/catalog/listBlueprints.ts index b8822b5..ea360e7 100644 --- a/src/catalog/listBlueprints.ts +++ b/src/catalog/listBlueprints.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface Blueprint { id: number; diff --git a/src/catalog/listProviders.ts b/src/catalog/listProviders.ts index db72df3..ee2c78b 100644 --- a/src/catalog/listProviders.ts +++ b/src/catalog/listProviders.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface Location { address1: string; diff --git a/src/printify.ts b/src/client.ts similarity index 100% rename from src/printify.ts rename to src/client.ts diff --git a/src/index.ts b/src/index.ts index eddf8f6..bffbd5e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,11 @@ -import Printify from './printify'; +import Printify from './client'; + +// Re-export types +export * from './catalog'; +export * from './orders'; +export * from './products'; +export * from './shops'; +export * from './uploads'; +export * from './webhooks'; export default Printify; diff --git a/src/orders/calculateShipping.ts b/src/orders/calculateShipping.ts index 0b2d2e6..46eab78 100644 --- a/src/orders/calculateShipping.ts +++ b/src/orders/calculateShipping.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface LineItem { product_id?: string; diff --git a/src/orders/cancelUnpaid.ts b/src/orders/cancelUnpaid.ts index f24d2ae..4583e0b 100644 --- a/src/orders/cancelUnpaid.ts +++ b/src/orders/cancelUnpaid.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface Address { first_name: string; diff --git a/src/orders/getOne.ts b/src/orders/getOne.ts index 8427dfd..38def73 100644 --- a/src/orders/getOne.ts +++ b/src/orders/getOne.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface Address { first_name: string; diff --git a/src/orders/index.ts b/src/orders/index.ts index 360ce3d..873c201 100644 --- a/src/orders/index.ts +++ b/src/orders/index.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; import list, { ListOrdersFunc } from './list'; import getOne, { GetOrderFunc } from './getOne'; import submit, { SubmitOrderFunc } from './submit'; diff --git a/src/orders/list.ts b/src/orders/list.ts index b505d13..32bdc45 100644 --- a/src/orders/list.ts +++ b/src/orders/list.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface OrderAddress { first_name: string; diff --git a/src/orders/sendToProduction.ts b/src/orders/sendToProduction.ts index 5de30a7..ef8d2d8 100644 --- a/src/orders/sendToProduction.ts +++ b/src/orders/sendToProduction.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface Address { first_name: string; diff --git a/src/orders/submit.ts b/src/orders/submit.ts index d1baee5..7f63375 100644 --- a/src/orders/submit.ts +++ b/src/orders/submit.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface Address { first_name: string; diff --git a/src/orders/submitExpress.ts b/src/orders/submitExpress.ts index 576ac58..f7269c3 100644 --- a/src/orders/submitExpress.ts +++ b/src/orders/submitExpress.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface LineItem { product_id: string; diff --git a/src/products/create.ts b/src/products/create.ts index 05cbb4b..9b1aa22 100644 --- a/src/products/create.ts +++ b/src/products/create.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface Variant { id: number; diff --git a/src/products/deleteOne.ts b/src/products/deleteOne.ts index fc88cc3..1ae9702 100644 --- a/src/products/deleteOne.ts +++ b/src/products/deleteOne.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export type DeleteProductFunc = (productId: string) => Promise; diff --git a/src/products/getOne.ts b/src/products/getOne.ts index 43531ec..0b8c9e2 100644 --- a/src/products/getOne.ts +++ b/src/products/getOne.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface Product { id: string; diff --git a/src/products/index.ts b/src/products/index.ts index 33c858c..4e76cca 100644 --- a/src/products/index.ts +++ b/src/products/index.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; import create, { CreateProductFunc } from './create'; import deleteOne, { DeleteProductFunc } from './deleteOne'; import getOne, { GetProductFunc } from './getOne'; diff --git a/src/products/list.ts b/src/products/list.ts index 68f3b36..3a4e006 100644 --- a/src/products/list.ts +++ b/src/products/list.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface Product { id: string; diff --git a/src/products/notifyUnpublished.ts b/src/products/notifyUnpublished.ts index 39f4696..f2c5fef 100644 --- a/src/products/notifyUnpublished.ts +++ b/src/products/notifyUnpublished.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export type NotifyUnpublishedFunc = (productId: string) => Promise; diff --git a/src/products/publishOne.ts b/src/products/publishOne.ts index 7aca181..924d0bb 100644 --- a/src/products/publishOne.ts +++ b/src/products/publishOne.ts @@ -1,6 +1,6 @@ // products/publishOne.ts -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface PublishData { title: boolean; diff --git a/src/products/setPublishFailed.ts b/src/products/setPublishFailed.ts index 6551bd8..e725876 100644 --- a/src/products/setPublishFailed.ts +++ b/src/products/setPublishFailed.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface PublishFailedData { reason: string; diff --git a/src/products/setPublishSucceeded.ts b/src/products/setPublishSucceeded.ts index fb052a6..53c4f06 100644 --- a/src/products/setPublishSucceeded.ts +++ b/src/products/setPublishSucceeded.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface ExternalData { id: string; diff --git a/src/products/updateOne.ts b/src/products/updateOne.ts index f9f6d3b..403b156 100644 --- a/src/products/updateOne.ts +++ b/src/products/updateOne.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface UpdateData { title?: string; diff --git a/src/shops/deleteOne.ts b/src/shops/deleteOne.ts index bef8b70..da3d9b3 100644 --- a/src/shops/deleteOne.ts +++ b/src/shops/deleteOne.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export type DeleteShopFunc = (shopId?: string) => Promise; diff --git a/src/shops/index.ts b/src/shops/index.ts index a7a3ca6..b9bf59f 100644 --- a/src/shops/index.ts +++ b/src/shops/index.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; import deleteOne, { DeleteShopFunc } from './deleteOne'; import list, { ListShopsFunc } from './list'; diff --git a/src/shops/list.ts b/src/shops/list.ts index 7d8deeb..639dbd4 100644 --- a/src/shops/list.ts +++ b/src/shops/list.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface Shop { id: number; diff --git a/src/uploads/archive.ts b/src/uploads/archive.ts index a3098f0..7b35e5e 100644 --- a/src/uploads/archive.ts +++ b/src/uploads/archive.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export type ArchiveUploadFunc = (imageId: string) => Promise; diff --git a/src/uploads/getById.ts b/src/uploads/getById.ts index 68617dc..81878d4 100644 --- a/src/uploads/getById.ts +++ b/src/uploads/getById.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface GetUploadByIdResponse { id: string; diff --git a/src/uploads/index.ts b/src/uploads/index.ts index 805ae2b..85e1b9f 100644 --- a/src/uploads/index.ts +++ b/src/uploads/index.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; import archive, { ArchiveUploadFunc } from './archive'; import getById, { GetUploadByIdFunc } from './getById'; import list, { ListUploadsFunc } from './list'; diff --git a/src/uploads/list.ts b/src/uploads/list.ts index e13f257..e066836 100644 --- a/src/uploads/list.ts +++ b/src/uploads/list.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface Upload { id: string; diff --git a/src/uploads/uploadImage.ts b/src/uploads/uploadImage.ts index 13d4cdd..4431184 100644 --- a/src/uploads/uploadImage.ts +++ b/src/uploads/uploadImage.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface UploadImageDataUrl { file_name: string; diff --git a/src/webhooks/create.ts b/src/webhooks/create.ts index a997cbb..6ccbba6 100644 --- a/src/webhooks/create.ts +++ b/src/webhooks/create.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface Data { topic: string; diff --git a/src/webhooks/deleteOne.ts b/src/webhooks/deleteOne.ts index 14606de..a13eaa9 100644 --- a/src/webhooks/deleteOne.ts +++ b/src/webhooks/deleteOne.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface DeleteWebhookResponse { id: string; diff --git a/src/webhooks/index.ts b/src/webhooks/index.ts index 8bda6f1..672f9e5 100644 --- a/src/webhooks/index.ts +++ b/src/webhooks/index.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; import list, { ListWebhooksFunc } from './list'; import create, { CreateWebhookFunc } from './create'; import updateOne, { UpdateWebhookFunc } from './updateOne'; diff --git a/src/webhooks/list.ts b/src/webhooks/list.ts index b10cb8a..a5b4cf8 100644 --- a/src/webhooks/list.ts +++ b/src/webhooks/list.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface Webhook { topic: string; diff --git a/src/webhooks/updateOne.ts b/src/webhooks/updateOne.ts index 62ba562..67b7e3b 100644 --- a/src/webhooks/updateOne.ts +++ b/src/webhooks/updateOne.ts @@ -1,4 +1,4 @@ -import { FetchDataFunc } from '../printify'; +import { FetchDataFunc } from '../client'; export interface UpdateData { url: string; diff --git a/tests/catalog.test.ts b/tests/catalog.test.ts index 8ad480b..58a285f 100644 --- a/tests/catalog.test.ts +++ b/tests/catalog.test.ts @@ -1,4 +1,4 @@ -import printify from './printifyInstance'; +import printify from './mockClient'; import { assertAxiosCall } from './testUtils'; describe('Catalog', () => { diff --git a/tests/printifyInstance.ts b/tests/mockClient.ts similarity index 78% rename from tests/printifyInstance.ts rename to tests/mockClient.ts index 2549a30..4b56da0 100644 --- a/tests/printifyInstance.ts +++ b/tests/mockClient.ts @@ -1,4 +1,4 @@ -import Printify from '../src/printify'; +import Printify from '../src/client'; export const config = { shopId: '123456', diff --git a/tests/orders.test.ts b/tests/orders.test.ts index 10f99bd..6cf728f 100644 --- a/tests/orders.test.ts +++ b/tests/orders.test.ts @@ -1,4 +1,4 @@ -import printify from './printifyInstance'; +import printify from './mockClient'; import { assertAxiosCall } from './testUtils'; describe('Orders', () => { diff --git a/tests/printify.test.ts b/tests/printify.test.ts index f6519ed..62cb46f 100644 --- a/tests/printify.test.ts +++ b/tests/printify.test.ts @@ -1,5 +1,5 @@ import axios from 'axios'; -import Printify from '../src/printify'; +import Printify from '../src/client'; import { assertAxiosCall } from './testUtils'; jest.mock('axios', () => ({ diff --git a/tests/products.test.ts b/tests/products.test.ts index 8bec1eb..07b0569 100644 --- a/tests/products.test.ts +++ b/tests/products.test.ts @@ -1,4 +1,4 @@ -import printify from './printifyInstance'; +import printify from './mockClient'; import { assertAxiosCall } from './testUtils'; describe('Products', () => { diff --git a/tests/shops.test.ts b/tests/shops.test.ts index 1d7fd0d..8a55cdc 100644 --- a/tests/shops.test.ts +++ b/tests/shops.test.ts @@ -1,4 +1,4 @@ -import printify from './printifyInstance'; +import printify from './mockClient'; import { assertAxiosCall } from './testUtils'; describe('Shops', () => { diff --git a/tests/uploads.test.ts b/tests/uploads.test.ts index 99378c8..046f3e9 100644 --- a/tests/uploads.test.ts +++ b/tests/uploads.test.ts @@ -1,4 +1,4 @@ -import printify from './printifyInstance'; +import printify from './mockClient'; import { assertAxiosCall } from './testUtils'; describe('Uploads', () => { diff --git a/tests/webhooks.test.ts b/tests/webhooks.test.ts index eb7072d..fd9dc2b 100644 --- a/tests/webhooks.test.ts +++ b/tests/webhooks.test.ts @@ -1,4 +1,4 @@ -import printify from './printifyInstance'; +import printify from './mockClient'; import { assertAxiosCall } from './testUtils'; describe('Webhooks', () => {