node-shopify
Advanced tools
Comparing version 2.4.0 to 2.5.0
@@ -6,3 +6,3 @@ import { ResultOK, ResultFAIL } from 'node-result'; | ||
import { Shop } from './types/shop'; | ||
import { OrderId, UpdateOrder } from './types/order'; | ||
import { OrderId, UpdateOrder, OrderMetafieldId } from './types/order'; | ||
export declare class Shopify { | ||
@@ -28,2 +28,5 @@ private readonly instance; | ||
deleteOrder(id: OrderId): Promise<ResultOK<any> | ResultFAIL<any>>; | ||
getOrderMetafields(id: OrderId): Promise<ResultOK<any> | ResultFAIL<any>>; | ||
getOrderMetafield(orderId: OrderId, metafieldId: OrderMetafieldId): Promise<ResultOK<any> | ResultFAIL<any>>; | ||
updateOrderMetafield(orderId: OrderId, metafieldId: OrderMetafieldId, updateOrderMetafield: object): Promise<ResultOK<any> | ResultFAIL<any>>; | ||
} |
@@ -222,3 +222,39 @@ "use strict"; | ||
} | ||
getOrderMetafields(id) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const { data: { metafields }, } = yield this.instance.get(`/admin/orders/${id}/metafields.json`); | ||
return node_result_1.ResultOk(metafields); | ||
} | ||
catch (error) { | ||
return node_result_1.ResultFail(error); | ||
} | ||
}); | ||
} | ||
getOrderMetafield(orderId, metafieldId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const { data: { metafield }, } = yield this.instance.get(`/admin/orders/${orderId}/metafields/${metafieldId}.json`); | ||
return node_result_1.ResultOk(metafield); | ||
} | ||
catch (error) { | ||
return node_result_1.ResultFail(error); | ||
} | ||
}); | ||
} | ||
updateOrderMetafield(orderId, metafieldId, updateOrderMetafield) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const payload = { | ||
metafield: Object.assign({ id: metafieldId }, updateOrderMetafield), | ||
}; | ||
const { data: { metafield }, } = yield this.instance.put(`/admin/orders/${orderId}/metafields/${metafieldId}.json`, payload); | ||
return node_result_1.ResultOk(metafield); | ||
} | ||
catch (error) { | ||
return node_result_1.ResultFail(error); | ||
} | ||
}); | ||
} | ||
} | ||
exports.Shopify = Shopify; |
@@ -7,17 +7,14 @@ export declare type OrderId = number; | ||
export declare type UpdateOrderTags = { | ||
id: OrderId; | ||
tags: OrderTags; | ||
}; | ||
export declare type UpdateOrderNote = { | ||
id: OrderId; | ||
note: OrderNote; | ||
}; | ||
export declare type UpdateOrderEmail = { | ||
id: OrderId; | ||
email: OrderEmail; | ||
}; | ||
export declare type UpdateOrderPhone = { | ||
id: OrderId; | ||
phone: OrderPhone; | ||
}; | ||
export declare type UpdateOrder = UpdateOrderTags | UpdateOrderNote | UpdateOrderEmail | UpdateOrderPhone; | ||
export declare type OrderMetafieldId = number; |
{ | ||
"name": "node-shopify", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"description": "shopify", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18670
403