@pintahub/shopify-api 1.2.8 → 1.3.0
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.
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/types";
|
|
2
|
+
import { ActionBuilder } from "../../ActionBuilder";
|
|
3
|
+
export interface CreateProductInput extends Record<string, any> {
|
|
4
|
+
title: string;
|
|
5
|
+
tags?: string;
|
|
6
|
+
productType?: string;
|
|
7
|
+
options?: Array<string>;
|
|
8
|
+
variants?: Array<Record<string, any>>;
|
|
9
|
+
}
|
|
10
|
+
export interface CreateProductOutput extends Record<string, any> {
|
|
11
|
+
}
|
|
12
|
+
export declare class CreateProduct extends ActionBuilder<AdminApiClient, CreateProductInput, CreateProductOutput> {
|
|
13
|
+
run(args: CreateProductInput): Promise<CreateProductOutput>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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.CreateProduct = void 0;
|
|
13
|
+
const ActionBuilder_1 = require("../../ActionBuilder");
|
|
14
|
+
class CreateProduct extends ActionBuilder_1.ActionBuilder {
|
|
15
|
+
run(args) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
console.log('JSON.stringify(args)', JSON.stringify(args));
|
|
18
|
+
const query = `
|
|
19
|
+
mutation {
|
|
20
|
+
productCreate(
|
|
21
|
+
input: ${JSON.stringify(args)}) {
|
|
22
|
+
product {
|
|
23
|
+
id
|
|
24
|
+
}
|
|
25
|
+
userErrors {
|
|
26
|
+
field
|
|
27
|
+
message
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
const result = yield this.client.request(query);
|
|
33
|
+
console.log('result', JSON.stringify(result, null, 2));
|
|
34
|
+
return {};
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.CreateProduct = CreateProduct;
|
|
@@ -43,6 +43,7 @@ class GetProduct extends ActionBuilder_1.ActionBuilder {
|
|
|
43
43
|
}
|
|
44
44
|
productType
|
|
45
45
|
title
|
|
46
|
+
description
|
|
46
47
|
descriptionHtml
|
|
47
48
|
tags
|
|
48
49
|
productCategory {
|
|
@@ -68,7 +69,9 @@ class GetProduct extends ActionBuilder_1.ActionBuilder {
|
|
|
68
69
|
`;
|
|
69
70
|
const { data } = yield this.client.request(query);
|
|
70
71
|
const { product } = Object.assign({}, data);
|
|
71
|
-
return Object.assign({
|
|
72
|
+
return Object.assign({
|
|
73
|
+
status: 'DELETED'
|
|
74
|
+
}, product);
|
|
72
75
|
});
|
|
73
76
|
}
|
|
74
77
|
}
|