@pintahub/shopify-api 2.1.2 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/classes/admin/metaobjects/SearchMetaObjects.js +1 -1
- package/dist/classes/admin/products-v2/DeleteProduct.d.ts +11 -0
- package/dist/classes/admin/products-v2/DeleteProduct.js +44 -0
- package/dist/classes/admin/products-v2/index.d.ts +3 -0
- package/dist/classes/admin/products-v2/index.js +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/graphql/types";
|
|
2
|
+
import { ActionBuilder } from "../../ActionBuilder";
|
|
3
|
+
export interface DeleteProductInput extends Record<string, any> {
|
|
4
|
+
id: string;
|
|
5
|
+
}
|
|
6
|
+
export interface DeleteProductOutput extends Record<string, any> {
|
|
7
|
+
id: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class DeleteProduct extends ActionBuilder<AdminApiClient, DeleteProductInput, DeleteProductOutput> {
|
|
10
|
+
run(args: DeleteProductInput): Promise<DeleteProductOutput>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DeleteProduct = void 0;
|
|
13
|
+
const ActionBuilder_1 = require("../../ActionBuilder");
|
|
14
|
+
const getGlobalID_1 = require("../../../utils/getGlobalID");
|
|
15
|
+
class DeleteProduct extends ActionBuilder_1.ActionBuilder {
|
|
16
|
+
run(args) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const query = `
|
|
19
|
+
mutation productDelete($input: ProductDeleteInput!) {
|
|
20
|
+
productDelete(input: $input) {
|
|
21
|
+
deletedProductId
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
const { id } = Object.assign({}, args);
|
|
26
|
+
const globalId = (0, getGlobalID_1.getGlobalID)(id);
|
|
27
|
+
const newArgs = {
|
|
28
|
+
id: globalId
|
|
29
|
+
};
|
|
30
|
+
const result = yield this.client.request(query, {
|
|
31
|
+
variables: {
|
|
32
|
+
input: newArgs
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const { data } = Object.assign({}, result);
|
|
36
|
+
const { productDelete } = Object.assign({}, data);
|
|
37
|
+
const { deletedProductId } = Object.assign({}, productDelete);
|
|
38
|
+
return Object.assign({}, {
|
|
39
|
+
id: deletedProductId
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.DeleteProduct = DeleteProduct;
|
|
@@ -6,10 +6,12 @@ import { GetProductInput, GetProductOutput } from "./GetProduct";
|
|
|
6
6
|
import { SearchProductsInput, SearchProductsOutput } from "./SearchProducts";
|
|
7
7
|
import { GetProductMediaInput, GetProductMediaOutput } from "./GetProductMedia";
|
|
8
8
|
import { DeleteProductMediaInput, DeleteProductMediaOutput } from "./DeleteProductMedia";
|
|
9
|
+
import { DeleteProductInput, DeleteProductOutput } from "./DeleteProduct";
|
|
9
10
|
export interface AdminProductsAPIInterface {
|
|
10
11
|
search(args: SearchProductsInput): Promise<SearchProductsOutput>;
|
|
11
12
|
get(args: GetProductInput): Promise<GetProductOutput>;
|
|
12
13
|
update(args: UpdateProductInput): Promise<UpdateProductOutput>;
|
|
14
|
+
delete(args: DeleteProductInput): Promise<DeleteProductOutput>;
|
|
13
15
|
updateVariants(args: UpdateVariantsInput): Promise<UpdateVariantsOutput>;
|
|
14
16
|
getMedia(args: GetProductMediaInput): Promise<GetProductMediaOutput>;
|
|
15
17
|
deleteMedia(args: DeleteProductMediaInput): Promise<DeleteProductMediaOutput>;
|
|
@@ -19,6 +21,7 @@ export declare class AdminProductsAPI extends APIBase<AdminApiClient> implements
|
|
|
19
21
|
search(args: SearchProductsInput): Promise<SearchProductsOutput>;
|
|
20
22
|
get(args: GetProductInput): Promise<GetProductOutput>;
|
|
21
23
|
update(args: UpdateProductInput): Promise<UpdateProductOutput>;
|
|
24
|
+
delete(args: DeleteProductInput): Promise<DeleteProductOutput>;
|
|
22
25
|
updateVariants(args: UpdateVariantsInput): Promise<UpdateVariantsOutput>;
|
|
23
26
|
getMedia(args: GetProductMediaInput): Promise<GetProductMediaOutput>;
|
|
24
27
|
deleteMedia(args: DeleteProductMediaInput): Promise<DeleteProductMediaOutput>;
|
|
@@ -17,6 +17,7 @@ const GetProduct_1 = require("./GetProduct");
|
|
|
17
17
|
const SearchProducts_1 = require("./SearchProducts");
|
|
18
18
|
const GetProductMedia_1 = require("./GetProductMedia");
|
|
19
19
|
const DeleteProductMedia_1 = require("./DeleteProductMedia");
|
|
20
|
+
const DeleteProduct_1 = require("./DeleteProduct");
|
|
20
21
|
class AdminProductsAPI extends APIBase_1.APIBase {
|
|
21
22
|
_runAction(Action, args) {
|
|
22
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -39,6 +40,11 @@ class AdminProductsAPI extends APIBase_1.APIBase {
|
|
|
39
40
|
return this._runAction(UpdateProduct_1.UpdateProduct, args);
|
|
40
41
|
});
|
|
41
42
|
}
|
|
43
|
+
delete(args) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
return this._runAction(DeleteProduct_1.DeleteProduct, args);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
42
48
|
updateVariants(args) {
|
|
43
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
50
|
return this._runAction(UpdateVariants_1.UpdateVariants, args);
|