node-shopify
Advanced tools
Comparing version 5.4.0 to 5.5.0
@@ -8,3 +8,3 @@ import { ReturningResultAsync } from 'node-result'; | ||
import { CreateCheckout, UpdateCheckout, CheckoutToken, Checkout, CheckoutShippingRates } from './types/checkout'; | ||
import { ProductId, Product, CreateProduct, UpdateProduct, ProductListing, ProductVariantId, CreateProductVariant, ProductVariant } from './types/product'; | ||
import { ProductId, Product, CreateProduct, UpdateProduct, ProductListing, ProductVariantId, CreateProductVariant, ProductVariant, CreateProductImage } from './types/product'; | ||
export declare class Shopify { | ||
@@ -56,2 +56,3 @@ private readonly instance; | ||
deleteProductVariant(productId: ProductId, productVariantId: ProductVariantId): ReturningResultAsync<null, Error>; | ||
createProductImage(productId: ProductId, productImageCreate: CreateProductImage): ReturningResultAsync<Product, Error>; | ||
} |
@@ -353,2 +353,13 @@ "use strict"; | ||
} | ||
async createProductImage(productId, productImageCreate) { | ||
const url = `/admin/api/2021-01/products/${productId}/images.json`; | ||
const payload = { | ||
image: productImageCreate | ||
}; | ||
const { data } = (await this.instance.post(url, payload)).unwrap(); | ||
if (!data) { | ||
return node_result_1.ResultFail(new Error('Response without data.')); | ||
} | ||
return node_result_1.ResultOk(data.product); | ||
} | ||
} | ||
@@ -355,0 +366,0 @@ __decorate([ |
@@ -60,1 +60,8 @@ export declare type ProductId = number; | ||
}; | ||
export declare type CreateProductImage = { | ||
image: { | ||
attachment?: string; | ||
filename?: string; | ||
src?: string; | ||
}; | ||
}; |
{ | ||
"name": "node-shopify", | ||
"version": "5.4.0", | ||
"version": "5.5.0", | ||
"description": "module for creating Shopify API calls", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35463
779