Comparing version 1.2.0 to 1.3.0
@@ -1,4 +0,2 @@ | ||
declare type StoreId = number; | ||
declare type StoreAccessToken = string; | ||
declare type OrderId = number; | ||
import { ResultFAIL, ResultOK } from 'node-result'; | ||
export declare class Ecwid { | ||
@@ -9,12 +7,5 @@ private readonly storeId; | ||
constructor(storeId: StoreId, storeAccessToken: StoreAccessToken, timeout?: number, headers?: object); | ||
/** | ||
* Получить профиль магазина. | ||
*/ | ||
getProfile(): Promise<import("node-result").ResultOK<any> | import("node-result").ResultFAIL<any>>; | ||
/** | ||
* Получить заказ. | ||
* @param {OrderId} id - идентификатор заказа. | ||
*/ | ||
getOrder(id: OrderId): Promise<import("node-result").ResultOK<any> | import("node-result").ResultFAIL<any>>; | ||
getProfile(): Promise<ResultOK<any> | ResultFAIL<any>>; | ||
getOrder(orderId: OrderId): Promise<ResultOK<Order> | ResultFAIL<Error>>; | ||
getPaymentOptions(): Promise<ResultOK<PaymentOption[]> | ResultFAIL<Error>>; | ||
} | ||
export {}; |
@@ -25,5 +25,2 @@ "use strict"; | ||
} | ||
/** | ||
* Получить профиль магазина. | ||
*/ | ||
getProfile() { | ||
@@ -40,10 +37,6 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
/** | ||
* Получить заказ. | ||
* @param {OrderId} id - идентификатор заказа. | ||
*/ | ||
getOrder(id) { | ||
getOrder(orderId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const { data } = yield this.instance.get(`/orders/${id}`); | ||
const { data } = yield this.instance.get(`/orders/${orderId}`); | ||
return node_result_1.ResultOk(data); | ||
@@ -56,3 +49,14 @@ } | ||
} | ||
getPaymentOptions() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const { data } = yield this.instance.get('/profile/paymentOptions'); | ||
return node_result_1.ResultOk(data); | ||
} | ||
catch (error) { | ||
return node_result_1.ResultFail(error); | ||
} | ||
}); | ||
} | ||
} | ||
exports.Ecwid = Ecwid; |
{ | ||
"name": "ecwid", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "ecwid", | ||
@@ -30,3 +30,3 @@ "keywords": [ | ||
"axios": "^0.19.2", | ||
"node-result": "^5.0.0" | ||
"node-result": "^5.3.0" | ||
}, | ||
@@ -33,0 +33,0 @@ "devDependencies": { |
@@ -1,1 +0,23 @@ | ||
# node-ecwid | ||
# node-ecwid | ||
## install | ||
```shell | ||
npm install ecwid | ||
# or | ||
yarn add ecwid | ||
``` | ||
## example | ||
```ts | ||
import {Ecwid} from "ecwid"; | ||
(async () => { | ||
const accessToken = 'secret_xxx'; | ||
const storeId = 1; | ||
const ecwid = new Ecwid(storeId, accessToken); | ||
const storeProfile = (await ecwid.getStore()).unwrap(); | ||
console.log(storeProfile); | ||
})(); | ||
``` |
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
6010
11
93
23
Updatednode-result@^5.3.0