@pintahub/shopify-api 1.6.1 → 1.6.3
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/rest/orders/SearchOrderItems.d.ts +12 -0
- package/dist/classes/rest/orders/SearchOrderItems.js +29 -0
- package/dist/classes/rest/orders/UpdateTracking.d.ts +19 -0
- package/dist/classes/rest/orders/UpdateTracking.js +36 -0
- package/dist/classes/rest/orders/index.d.ts +3 -0
- package/dist/classes/rest/orders/index.js +6 -0
- package/dist/classes/rest/products/GetOrder.d.ts +12 -0
- package/dist/classes/rest/products/GetOrder.js +29 -0
- package/dist/classes/rest/products/index.d.ts +10 -0
- package/dist/classes/rest/products/index.js +28 -0
- package/dist/utils/parseOnlyId.js +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ActionBuilder } from "../../ActionBuilder";
|
|
2
|
+
import { AxiosInstance } from "axios";
|
|
3
|
+
export interface SearchOrderItemsInput extends Record<string, any> {
|
|
4
|
+
id: string;
|
|
5
|
+
}
|
|
6
|
+
export interface SearchOrderItemsOutput extends Record<string, any> {
|
|
7
|
+
id: number;
|
|
8
|
+
order_status_url: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class GetOrder extends ActionBuilder<AxiosInstance, SearchOrderItemsInput, SearchOrderItemsOutput> {
|
|
11
|
+
run(args: SearchOrderItemsInput): Promise<SearchOrderItemsOutput>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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.GetOrder = void 0;
|
|
13
|
+
const ActionBuilder_1 = require("../../ActionBuilder");
|
|
14
|
+
const parseOnlyId_1 = require("../../../utils/parseOnlyId");
|
|
15
|
+
class GetOrder extends ActionBuilder_1.ActionBuilder {
|
|
16
|
+
run(args) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const { id } = args;
|
|
19
|
+
const cleanId = (0, parseOnlyId_1.parseOnlyId)(id);
|
|
20
|
+
const { data } = yield this.client({
|
|
21
|
+
url: `orders/${cleanId}.json`,
|
|
22
|
+
method: 'GET'
|
|
23
|
+
});
|
|
24
|
+
const { order } = Object.assign({}, data);
|
|
25
|
+
return Object.assign({}, order);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.GetOrder = GetOrder;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ActionBuilder } from "../../ActionBuilder";
|
|
2
|
+
import { AxiosInstance } from "axios";
|
|
3
|
+
interface TrackingInfo extends Record<string, any> {
|
|
4
|
+
company: string;
|
|
5
|
+
number: string;
|
|
6
|
+
url?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface UpdateTrackingInput extends Record<string, any> {
|
|
9
|
+
fulfillment_id: string;
|
|
10
|
+
tracking_info: TrackingInfo;
|
|
11
|
+
notify_customer?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface UpdateTrackingOutput extends Record<string, any> {
|
|
14
|
+
id: number;
|
|
15
|
+
}
|
|
16
|
+
export declare class UpdateTracking extends ActionBuilder<AxiosInstance, UpdateTrackingInput, UpdateTrackingOutput> {
|
|
17
|
+
run(args: UpdateTrackingInput): Promise<UpdateTrackingOutput>;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
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.UpdateTracking = void 0;
|
|
13
|
+
const ActionBuilder_1 = require("../../ActionBuilder");
|
|
14
|
+
const parseOnlyId_1 = require("../../../utils/parseOnlyId");
|
|
15
|
+
class UpdateTracking extends ActionBuilder_1.ActionBuilder {
|
|
16
|
+
run(args) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const { notify_customer, tracking_info, fulfillment_id } = args;
|
|
19
|
+
const cleanId = (0, parseOnlyId_1.parseOnlyId)(fulfillment_id);
|
|
20
|
+
const body = {
|
|
21
|
+
fulfillment: {
|
|
22
|
+
tracking_info,
|
|
23
|
+
notify_customer
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const { data } = yield this.client({
|
|
27
|
+
url: `fulfillments/${cleanId}/update_tracking.json`,
|
|
28
|
+
method: 'POST',
|
|
29
|
+
data: body
|
|
30
|
+
});
|
|
31
|
+
const { fulfillment } = Object.assign({}, data);
|
|
32
|
+
return Object.assign({}, fulfillment);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.UpdateTracking = UpdateTracking;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { APIBase } from "../../APIBase";
|
|
2
2
|
import { GetOrderInput, GetOrderOutput } from "./GetOrder";
|
|
3
3
|
import { AxiosInstance } from "axios";
|
|
4
|
+
import { UpdateTrackingInput, UpdateTrackingOutput } from "./UpdateTracking";
|
|
4
5
|
export interface RestOrderAPIInterface {
|
|
5
6
|
get(args: GetOrderInput): Promise<GetOrderOutput>;
|
|
7
|
+
updateTracking(args: UpdateTrackingInput): Promise<UpdateTrackingOutput>;
|
|
6
8
|
}
|
|
7
9
|
export declare class RestOrderAPI extends APIBase<AxiosInstance> implements RestOrderAPIInterface {
|
|
8
10
|
private _runAction;
|
|
9
11
|
get(args?: GetOrderInput): Promise<GetOrderOutput>;
|
|
12
|
+
updateTracking(args?: UpdateTrackingInput): Promise<UpdateTrackingOutput>;
|
|
10
13
|
}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.RestOrderAPI = void 0;
|
|
13
13
|
const APIBase_1 = require("../../APIBase");
|
|
14
14
|
const GetOrder_1 = require("./GetOrder");
|
|
15
|
+
const UpdateTracking_1 = require("./UpdateTracking");
|
|
15
16
|
class RestOrderAPI extends APIBase_1.APIBase {
|
|
16
17
|
_runAction(Action, args) {
|
|
17
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -24,5 +25,10 @@ class RestOrderAPI extends APIBase_1.APIBase {
|
|
|
24
25
|
return this._runAction(GetOrder_1.GetOrder, args);
|
|
25
26
|
});
|
|
26
27
|
}
|
|
28
|
+
updateTracking(args) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
return this._runAction(UpdateTracking_1.UpdateTracking, args);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
27
33
|
}
|
|
28
34
|
exports.RestOrderAPI = RestOrderAPI;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ActionBuilder } from "../../ActionBuilder";
|
|
2
|
+
import { AxiosInstance } from "axios";
|
|
3
|
+
export interface GetOrderInput extends Record<string, any> {
|
|
4
|
+
id: string;
|
|
5
|
+
}
|
|
6
|
+
export interface GetOrderOutput extends Record<string, any> {
|
|
7
|
+
id: number;
|
|
8
|
+
order_status_url: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class GetOrder extends ActionBuilder<AxiosInstance, GetOrderInput, GetOrderOutput> {
|
|
11
|
+
run(args: GetOrderInput): Promise<GetOrderOutput>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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.GetOrder = void 0;
|
|
13
|
+
const ActionBuilder_1 = require("../../ActionBuilder");
|
|
14
|
+
const parseOnlyId_1 = require("../../../utils/parseOnlyId");
|
|
15
|
+
class GetOrder extends ActionBuilder_1.ActionBuilder {
|
|
16
|
+
run(args) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const { id } = args;
|
|
19
|
+
const cleanId = (0, parseOnlyId_1.parseOnlyId)(id);
|
|
20
|
+
const { data } = yield this.client({
|
|
21
|
+
url: `orders/${cleanId}.json`,
|
|
22
|
+
method: 'GET'
|
|
23
|
+
});
|
|
24
|
+
const { order } = Object.assign({}, data);
|
|
25
|
+
return Object.assign({}, order);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.GetOrder = GetOrder;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { APIBase } from "../../APIBase";
|
|
2
|
+
import { GetOrderInput, GetOrderOutput } from "./GetOrder";
|
|
3
|
+
import { AxiosInstance } from "axios";
|
|
4
|
+
export interface RestOrderAPIInterface {
|
|
5
|
+
get(args: GetOrderInput): Promise<GetOrderOutput>;
|
|
6
|
+
}
|
|
7
|
+
export declare class RestOrderAPI extends APIBase<AxiosInstance> implements RestOrderAPIInterface {
|
|
8
|
+
private _runAction;
|
|
9
|
+
get(args?: GetOrderInput): Promise<GetOrderOutput>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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.RestOrderAPI = void 0;
|
|
13
|
+
const APIBase_1 = require("../../APIBase");
|
|
14
|
+
const GetOrder_1 = require("./GetOrder");
|
|
15
|
+
class RestOrderAPI extends APIBase_1.APIBase {
|
|
16
|
+
_runAction(Action, args) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const action = new Action(this.client);
|
|
19
|
+
return action.run(args);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
get(args) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
return this._runAction(GetOrder_1.GetOrder, args);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.RestOrderAPI = RestOrderAPI;
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseOnlyId = void 0;
|
|
4
4
|
const parseOnlyId = (id) => {
|
|
5
|
-
const lastStr = (id || '')
|
|
5
|
+
const lastStr = (id || '')
|
|
6
|
+
.toString()
|
|
7
|
+
.split('/')
|
|
6
8
|
.pop();
|
|
7
9
|
return (lastStr || '').trim();
|
|
8
10
|
};
|