node-shopify
Advanced tools
Comparing version 4.0.1 to 4.1.0
@@ -39,2 +39,7 @@ import { Result } from 'node-result'; | ||
getProductsCount(): Promise<Result<Error, number>>; | ||
getProductListings(): Promise<import("node-result").ResultOK<object[]>>; | ||
getProductListingIds(): Promise<import("node-result").ResultOK<number[]>>; | ||
createProductListing(productId: number): Promise<import("node-result").ResultOK<object>>; | ||
getProductListing(productId: number): Promise<import("node-result").ResultOK<object>>; | ||
deleteProductListing(productId: number): Promise<Result<Error, null>>; | ||
} |
@@ -181,2 +181,32 @@ "use strict"; | ||
} | ||
async getProductListings() { | ||
const url = '/admin/api/2021-01/product_listings.json'; | ||
const { data: { product_listings } } = (await this.instance.get(url)).unwrap(); | ||
return node_result_1.ResultOk(product_listings); | ||
} | ||
async getProductListingIds() { | ||
const url = '/admin/api/2021-01/product_listings/product_ids.json'; | ||
const { data: { product_ids } } = (await this.instance.get(url)).unwrap(); | ||
return node_result_1.ResultOk(product_ids); | ||
} | ||
async createProductListing(productId) { | ||
const url = `/admin/api/2021-01/product_listings/${productId}.json`; | ||
const payload = { | ||
product_listing: { | ||
product_id: productId | ||
} | ||
}; | ||
const { data: { product_listing } } = (await this.instance.put(url, payload)).unwrap(); | ||
return node_result_1.ResultOk(product_listing); | ||
} | ||
async getProductListing(productId) { | ||
const url = `/admin/api/2021-01/product_listings/${productId}.json`; | ||
const { data: { product_listing } } = (await this.instance.get(url)).unwrap(); | ||
return node_result_1.ResultOk(product_listing); | ||
} | ||
async deleteProductListing(productId) { | ||
const url = `/admin/api/2021-01/product_listings/${productId}.json`; | ||
(await this.instance.delete(url)).unwrap(); | ||
return node_result_1.ResultOk(null); | ||
} | ||
} | ||
@@ -267,2 +297,17 @@ __decorate([ | ||
], Shopify.prototype, "getProductsCount", null); | ||
__decorate([ | ||
node_result_1.tryCatchWrapperAsync | ||
], Shopify.prototype, "getProductListings", null); | ||
__decorate([ | ||
node_result_1.tryCatchWrapperAsync | ||
], Shopify.prototype, "getProductListingIds", null); | ||
__decorate([ | ||
node_result_1.tryCatchWrapperAsync | ||
], Shopify.prototype, "createProductListing", null); | ||
__decorate([ | ||
node_result_1.tryCatchWrapperAsync | ||
], Shopify.prototype, "getProductListing", null); | ||
__decorate([ | ||
node_result_1.tryCatchWrapperAsync | ||
], Shopify.prototype, "deleteProductListing", null); | ||
exports.Shopify = Shopify; |
{ | ||
"name": "node-shopify", | ||
"version": "4.0.1", | ||
"version": "4.1.0", | ||
"description": "shopify", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
25007
501