-
-
Notifications
You must be signed in to change notification settings - Fork 280
Adding in missing PUT and DELETE for productListings #146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This change adds in PUT (via create) and DELETE for productListings endpoint
|
Dope. Forgot test cases to cover this pull request... will do shortly |
| } | ||
|
|
||
| assign(ProductListing.prototype, omit(base, [ | ||
| 'create', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep this as we are adding a custom version below.
resources/product-listing.js
Outdated
| */ | ||
| ProductListing.prototype.create = function addProductId(productId) { | ||
| const url = this.buildUrl(`${productId}`); | ||
| return this.shopify.request(url, 'PUT', undefined, {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example does not use an empty body. Can we do something like this?
/**
* Creates a product listing.
*
* @param {Number} productId The ID of the product to publish
* @param {Object} [params] Body parameters
* @return {Promise} Promise that resolves with the result
* @public
*/
ProductListing.prototype.create = function create(productId, params) {
params || (params = { product_id: productId });
const url = this.buildUrl(productId);
return this.shopify.request(url, 'PUT', this.key, params);
};
resources/product-listing.js
Outdated
| * @return {Promise} Promise that resolves with the result | ||
| * @public | ||
| */ | ||
| ProductListing.prototype.delete = function deleteProductId(productId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove this as the default implementation
Shopify-api-node/mixins/base.js
Lines 45 to 48 in 53b6ac8
| delete(id) { | |
| const url = this.buildUrl(id); | |
| return this.shopify.request(url, 'DELETE'); | |
| }, |
|
We also need to update the documentation. |
|
Thank you. |
This change adds in PUT (via create) and DELETE for productListings endpoint