-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
release(v2.0.2-beta): update endpoints for Feb 2025
- Loading branch information
1 parent
1c5f511
commit f32580c
Showing
11 changed files
with
1,838 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
docs | ||
src/**/*.js | ||
|
||
examples/typescript/*.js | ||
# Logs | ||
logs | ||
*.log | ||
|
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
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,18 @@ | ||
// tsc && node getStoresV2.ts | ||
|
||
import { PrintfulClient } from 'printful-sdk-js-v2'; | ||
|
||
const printful = new PrintfulClient({ | ||
TOKEN: '<PRINTFUL_API_TOKEN>', | ||
}); | ||
|
||
(async () => { | ||
const response = await printful.storesV2.getStores(); | ||
const stores = response.data; | ||
console.log(stores); | ||
// Expected response: | ||
// [ | ||
// { id: 1234567, name: 'MyStoreName', type: 'etsy' } | ||
// ... | ||
// ] | ||
})(); |
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,8 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} **/ | ||
module.exports = { | ||
testEnvironment: 'node', | ||
// setupFilesAfterEnv: ['<rootDir>/tests/jest.setup.ts'], | ||
transform: { | ||
'^.+.tsx?$': ['ts-jest', {}], | ||
}, | ||
}; |
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,6 +1,6 @@ | ||
{ | ||
"name": "printful-sdk-js-v2", | ||
"version": "2.0.1-beta", | ||
"version": "2.0.2-beta", | ||
"description": "Printful SDK for Node.js / TypeScript. A wrapper for the Printful REST API (v2)", | ||
"author": "Spencer Lepine <[email protected]>", | ||
"license": "MIT", | ||
|
@@ -44,7 +44,7 @@ | |
"node": ">= 18" | ||
}, | ||
"scripts": { | ||
"test": "echo 'No unit tests found.' && exit 0", | ||
"test": "jest", | ||
"bundle": "rollup -c", | ||
"generate-sdk": "openapi --input ./openapi.json --output ./src --name PrintfulClient", | ||
"generate-docs": "typedoc src/index.ts", | ||
|
@@ -54,8 +54,10 @@ | |
"@rollup/plugin-commonjs": "^26.0.1", | ||
"@rollup/plugin-json": "^6.1.0", | ||
"@rollup/plugin-node-resolve": "^15.2.3", | ||
"@types/jest": "^29.5.14", | ||
"@types/node": "^22.1.0", | ||
"husky": "4.3.8", | ||
"jest": "^29.7.0", | ||
"lint-staged": "10.5.4", | ||
"openapi-typescript-codegen": "^0.29.0", | ||
"prettier": "2.8.8", | ||
|
@@ -66,6 +68,7 @@ | |
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-typescript2": "^0.36.0", | ||
"ts-jest": "^29.2.3", | ||
"tslib": "^2.6.3", | ||
"typedoc": "^0.26.5", | ||
"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,45 @@ | ||
import { | ||
ApprovalSheetsV2Service, | ||
CatalogV2Service, | ||
CountriesV2Service, | ||
FilesV2Service, | ||
MockupGeneratorV2Service, | ||
OAuthScopesV2Service, | ||
OrdersV2Service, | ||
PrintfulClient, | ||
ShippingRatesV2Service, | ||
StoresV2Service, | ||
WarehouseProductsV2Service, | ||
WebhookV2Service, | ||
} from '../src/index'; | ||
|
||
describe('PrintfulClient', () => { | ||
let printful: PrintfulClient; | ||
const accessToken = 'mockAccessToken'; | ||
const config = { TOKEN: accessToken }; | ||
|
||
beforeEach(() => { | ||
printful = new PrintfulClient(config); | ||
}); | ||
|
||
it('should initialize with provided config', () => { | ||
expect(printful.request).toBeDefined(); | ||
expect(printful.approvalSheetsV2).toBeInstanceOf(ApprovalSheetsV2Service); | ||
expect(printful.catalogV2).toBeInstanceOf(CatalogV2Service); | ||
expect(printful.countriesV2).toBeInstanceOf(CountriesV2Service); | ||
expect(printful.filesV2).toBeInstanceOf(FilesV2Service); | ||
expect(printful.mockupGeneratorV2).toBeInstanceOf(MockupGeneratorV2Service); | ||
expect(printful.oAuthScopesV2).toBeInstanceOf(OAuthScopesV2Service); | ||
expect(printful.ordersV2).toBeInstanceOf(OrdersV2Service); | ||
expect(printful.shippingRatesV2).toBeInstanceOf(ShippingRatesV2Service); | ||
expect(printful.storesV2).toBeInstanceOf(StoresV2Service); | ||
expect(printful.warehouseProductsV2).toBeInstanceOf(WarehouseProductsV2Service); | ||
expect(printful.webhookV2).toBeInstanceOf(WebhookV2Service); | ||
}); | ||
|
||
it('should handle missing accessToken gracefully', () => { | ||
// @ts-expect-error - Testing for missing accessToken | ||
const printfulMissingToken = () => new PrintfulClient({ foo: 'bar' }); | ||
expect(printfulMissingToken).not.toThrowError('accessToken is required'); | ||
}); | ||
}); |
Oops, something went wrong.