@bss-sbc/shopify-api-fetcher
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -25,3 +25,3 @@ import fetch, { RequestInfo, RequestInit } from 'node-fetch'; | ||
query: string; | ||
variable?: any; | ||
variables?: any; | ||
}; | ||
@@ -28,0 +28,0 @@ declare class ShopifyGraphQL { |
{ | ||
"name": "@bss-sbc/shopify-api-fetcher", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -26,26 +26,44 @@ # Shopify API Fetcher | ||
```javascript | ||
// To bulk initialize | ||
const shops = [ | ||
{ id: 1, domain: 'dev-mida-dean.myshopify.com' }, | ||
{ id: 2, domain: 'dev-mida-store.myshopify.com' }, | ||
] | ||
const intialized = BucketManager.initializeAll(shops); | ||
const { GraphQL, Rest } = require("@bss-sbc/shopify-api-fetcher"); | ||
// To initialize | ||
BucketManager.initializeOne({ | ||
id: 1, | ||
domain: 'dev-mida-dean.myshopify.com', | ||
}); | ||
const DOMAIN="...replace this....myshopify.com" | ||
const TOKEN="...replace this..." | ||
const API_VERSION="2022-10" | ||
// To get specific bucket | ||
const bucket = BucketManager.get('dev-mida-dean.myshopify.com'); | ||
async function main() { | ||
await GraphQL.safeFetch(DOMAIN, TOKEN, { | ||
query: ` | ||
query queryShop { | ||
shop { | ||
name | ||
contactEmail | ||
myshopifyDomain | ||
ianaTimezone | ||
currencyCode | ||
currencyFormats { | ||
moneyFormat | ||
} | ||
} | ||
} | ||
`, | ||
}).then(data => console.log(JSON.stringify(data))); | ||
// To clean up specific bucket | ||
BucketManager.clear('dev-mida-dean.myshopify.com'); | ||
await Rest.safeFetch(DOMAIN, `https://${DOMAIN}/admin/api/${API_VERSION}/shop.json`, { | ||
method: "GET", | ||
headers: { | ||
"Content-Type": "application/json", | ||
'X-Shopify-Access-Token': TOKEN, | ||
} | ||
}).then(response => response.json()).then(data => console.log(JSON.stringify(data))); | ||
} | ||
// Auto initialize bucket, | ||
// using safeFetch | ||
const response = await safeFetch(domain, url, params); | ||
main().finally(() => { | ||
process.exit(0); | ||
}); | ||
``` | ||
### Roadmap | ||
@@ -52,0 +70,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
24852
77
0