@pintahub/shopify-api 1.7.4 → 1.7.5
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,10 @@
|
|
|
1
|
+
import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/graphql/types";
|
|
2
|
+
import { ActionBuilder } from "../../ActionBuilder";
|
|
3
|
+
export interface GetListBannersInput extends Record<string, any> {
|
|
4
|
+
}
|
|
5
|
+
export interface GetListBannersOutput extends Record<string, any> {
|
|
6
|
+
items: Record<any, any>[];
|
|
7
|
+
}
|
|
8
|
+
export declare class GetListBanners extends ActionBuilder<AdminApiClient, GetListBannersInput, GetListBannersOutput> {
|
|
9
|
+
run(args?: GetListBannersInput): Promise<GetListBannersOutput>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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.GetListBanners = void 0;
|
|
13
|
+
const ActionBuilder_1 = require("../../ActionBuilder");
|
|
14
|
+
class GetListBanners extends ActionBuilder_1.ActionBuilder {
|
|
15
|
+
run(args) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const query = `
|
|
18
|
+
{
|
|
19
|
+
metaobjects(type: "banner", first: 10) {
|
|
20
|
+
nodes {
|
|
21
|
+
fields {
|
|
22
|
+
key
|
|
23
|
+
value
|
|
24
|
+
reference {
|
|
25
|
+
... on MediaImage {
|
|
26
|
+
image {
|
|
27
|
+
altText
|
|
28
|
+
url
|
|
29
|
+
width
|
|
30
|
+
height
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
const { data } = yield this.client.request(query);
|
|
40
|
+
const { metaobjects } = Object.assign({}, data);
|
|
41
|
+
const { nodes } = Object.assign({}, metaobjects);
|
|
42
|
+
const arr = Array.isArray(nodes) ? nodes : [];
|
|
43
|
+
return {
|
|
44
|
+
items: arr
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.GetListBanners = GetListBanners;
|
|
@@ -2,12 +2,15 @@ import { AdminApiClient } from "@shopify/admin-api-client/dist/ts/graphql/types"
|
|
|
2
2
|
import { APIBase } from "../../APIBase";
|
|
3
3
|
import { SearchMetaObjectsInput, SearchMetaObjectsOutput } from "./SearchMetaObjects";
|
|
4
4
|
import { GetMetaObjectInput, GetMetaObjectOutput } from "./GetMetaObject";
|
|
5
|
+
import { GetListBannersInput, GetListBannersOutput } from "./GetListBanners";
|
|
5
6
|
export interface AdminMetaObjectAPIInterface {
|
|
6
7
|
get(args: GetMetaObjectInput): Promise<GetMetaObjectOutput>;
|
|
7
8
|
search(args: SearchMetaObjectsInput): Promise<SearchMetaObjectsOutput>;
|
|
9
|
+
listBanners(args: GetListBannersInput): Promise<GetListBannersOutput>;
|
|
8
10
|
}
|
|
9
11
|
export declare class AdminMetaObjectAPI extends APIBase<AdminApiClient> implements AdminMetaObjectAPIInterface {
|
|
10
12
|
private _runAction;
|
|
11
13
|
get(args: GetMetaObjectInput): Promise<GetMetaObjectOutput>;
|
|
12
14
|
search(args: SearchMetaObjectsInput): Promise<SearchMetaObjectsOutput>;
|
|
15
|
+
listBanners(args: GetListBannersInput): Promise<GetListBannersOutput>;
|
|
13
16
|
}
|
|
@@ -13,6 +13,7 @@ exports.AdminMetaObjectAPI = void 0;
|
|
|
13
13
|
const APIBase_1 = require("../../APIBase");
|
|
14
14
|
const SearchMetaObjects_1 = require("./SearchMetaObjects");
|
|
15
15
|
const GetMetaObject_1 = require("./GetMetaObject");
|
|
16
|
+
const GetListBanners_1 = require("./GetListBanners");
|
|
16
17
|
class AdminMetaObjectAPI extends APIBase_1.APIBase {
|
|
17
18
|
_runAction(Action, args) {
|
|
18
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -30,5 +31,10 @@ class AdminMetaObjectAPI extends APIBase_1.APIBase {
|
|
|
30
31
|
return this._runAction(SearchMetaObjects_1.SearchMetaObjects, args);
|
|
31
32
|
});
|
|
32
33
|
}
|
|
34
|
+
listBanners(args) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
return this._runAction(GetListBanners_1.GetListBanners, args);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
33
39
|
}
|
|
34
40
|
exports.AdminMetaObjectAPI = AdminMetaObjectAPI;
|