@pintahub/shopify-api 1.3.0 → 1.3.1

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.
@@ -2,7 +2,9 @@ import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/types";
2
2
  import { ActionBuilder } from "../../ActionBuilder";
3
3
  export interface CreateProductInput extends Record<string, any> {
4
4
  title: string;
5
- tags?: string;
5
+ descriptionHtml?: string;
6
+ status?: string;
7
+ tags?: string | Array<string>;
6
8
  productType?: string;
7
9
  options?: Array<string>;
8
10
  variants?: Array<Record<string, any>>;
@@ -14,11 +14,9 @@ const ActionBuilder_1 = require("../../ActionBuilder");
14
14
  class CreateProduct extends ActionBuilder_1.ActionBuilder {
15
15
  run(args) {
16
16
  return __awaiter(this, void 0, void 0, function* () {
17
- console.log('JSON.stringify(args)', JSON.stringify(args));
18
17
  const query = `
19
- mutation {
20
- productCreate(
21
- input: ${JSON.stringify(args)}) {
18
+ mutation productCreate($input: ProductInput!) {
19
+ productCreate(input: $input) {
22
20
  product {
23
21
  id
24
22
  }
@@ -29,7 +27,11 @@ class CreateProduct extends ActionBuilder_1.ActionBuilder {
29
27
  }
30
28
  }
31
29
  `;
32
- const result = yield this.client.request(query);
30
+ const result = yield this.client.request(query, {
31
+ variables: {
32
+ input: args
33
+ }
34
+ });
33
35
  console.log('result', JSON.stringify(result, null, 2));
34
36
  return {};
35
37
  });
@@ -4,8 +4,10 @@ import { GetProductInput, GetProductOutput } from "./GetProduct";
4
4
  import { SearchProductsInput, SearchProductsOutput } from "./SearchProducts";
5
5
  import { GetPublicationsInput, GetPublicationsOutput } from "./GetPublications";
6
6
  import { UpdateVariantInput, UpdateVariantOutput } from "./UpdateVariant";
7
+ import { CreateProductInput, CreateProductOutput } from "./CreateProduct";
7
8
  export interface AdminProductAPIInterface {
8
9
  get(args: GetProductInput): Promise<GetProductOutput>;
10
+ create(args: CreateProductInput): Promise<CreateProductOutput>;
9
11
  getPublications(args: GetPublicationsInput): Promise<GetPublicationsOutput>;
10
12
  search(args?: SearchProductsInput): Promise<SearchProductsOutput>;
11
13
  updateVariant(args: UpdateVariantInput): Promise<UpdateVariantOutput>;
@@ -13,6 +15,7 @@ export interface AdminProductAPIInterface {
13
15
  export declare class AdminProductAPI extends APIBase<AdminApiClient> implements AdminProductAPIInterface {
14
16
  private _runAction;
15
17
  get(args: GetProductInput): Promise<GetProductOutput>;
18
+ create(args: CreateProductInput): Promise<CreateProductOutput>;
16
19
  getPublications(args: GetPublicationsInput): Promise<GetPublicationsOutput>;
17
20
  search(args?: SearchProductsInput): Promise<SearchProductsOutput>;
18
21
  updateVariant(args: UpdateVariantInput): Promise<UpdateVariantOutput>;
@@ -15,6 +15,7 @@ const GetProduct_1 = require("./GetProduct");
15
15
  const SearchProducts_1 = require("./SearchProducts");
16
16
  const GetPublications_1 = require("./GetPublications");
17
17
  const UpdateVariant_1 = require("./UpdateVariant");
18
+ const CreateProduct_1 = require("./CreateProduct");
18
19
  class AdminProductAPI extends APIBase_1.APIBase {
19
20
  _runAction(Action, args) {
20
21
  return __awaiter(this, void 0, void 0, function* () {
@@ -27,6 +28,11 @@ class AdminProductAPI extends APIBase_1.APIBase {
27
28
  return this._runAction(GetProduct_1.GetProduct, args);
28
29
  });
29
30
  }
31
+ create(args) {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ return this._runAction(CreateProduct_1.CreateProduct, args);
34
+ });
35
+ }
30
36
  getPublications(args) {
31
37
  return __awaiter(this, void 0, void 0, function* () {
32
38
  return this._runAction(GetPublications_1.GetPublications, args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pintahub/shopify-api",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",