Comparing version 1.3.3 to 1.3.4
@@ -0,1 +1,5 @@ | ||
declare type RequestParam = { | ||
key: string; | ||
value: number | string | boolean; | ||
}; | ||
/** | ||
@@ -11,2 +15,6 @@ * Основной класс ошибок которые могут произойти в модуле | ||
/** | ||
* Параметры запроса | ||
*/ | ||
params: RequestParam[]; | ||
/** | ||
* Уровень критичности ошибки | ||
@@ -23,3 +31,3 @@ */ | ||
err_msg: string; | ||
}); | ||
}, params: RequestParam[]); | ||
get [Symbol.toStringTag](): string; | ||
@@ -26,0 +34,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const MODULE_VERSION = "1.3.3"; | ||
const MODULE_VERSION = "1.3.4"; | ||
const DEFAULT_API_URL = "https://api.dev-up.ru/method/"; | ||
@@ -10,6 +10,7 @@ /** | ||
class DevUpError extends Error { | ||
constructor({ err_code: code, err_critical_lvl: level, err_msg: message, }) { | ||
constructor({ err_code: code, err_critical_lvl: level, err_msg: message, }, params) { | ||
super(message); | ||
this.code = code; | ||
this.level = level; | ||
this.params = params; | ||
this.name = this.constructor.name; | ||
@@ -16,0 +17,0 @@ } |
@@ -39,10 +39,18 @@ "use strict"; | ||
data) { | ||
var _a, _b; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const Response = yield axios_1.default.post(this.apiURL + method, Object.assign({ key: this.token }, data), this.RequestConfig); | ||
if (Response.data.err) { | ||
throw new core_1.default.error(Response.data.err, Response.data.params || []); | ||
} | ||
return Response.data; | ||
} | ||
catch (error) { | ||
console.log(error.response.data.err); | ||
throw new core_1.default.error(error.response.data.err); | ||
if ((_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.err) { | ||
throw new core_1.default.error(error.response.data.err, error.response.data.params || []); | ||
} | ||
else { | ||
console.log(error); | ||
} | ||
} | ||
@@ -49,0 +57,0 @@ }); |
@@ -0,1 +1,5 @@ | ||
declare type RequestParam = { | ||
key: string; | ||
value: number | string | boolean; | ||
}; | ||
/** | ||
@@ -11,2 +15,6 @@ * Основной класс ошибок которые могут произойти в модуле | ||
/** | ||
* Параметры запроса | ||
*/ | ||
params: RequestParam[]; | ||
/** | ||
* Уровень критичности ошибки | ||
@@ -23,3 +31,3 @@ */ | ||
err_msg: string; | ||
}); | ||
}, params: RequestParam[]); | ||
get [Symbol.toStringTag](): string; | ||
@@ -26,0 +34,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
const MODULE_VERSION = "1.3.3"; | ||
const MODULE_VERSION = "1.3.4"; | ||
const DEFAULT_API_URL = "https://api.dev-up.ru/method/"; | ||
@@ -8,6 +8,7 @@ /** | ||
class DevUpError extends Error { | ||
constructor({ err_code: code, err_critical_lvl: level, err_msg: message, }) { | ||
constructor({ err_code: code, err_critical_lvl: level, err_msg: message, }, params) { | ||
super(message); | ||
this.code = code; | ||
this.level = level; | ||
this.params = params; | ||
this.name = this.constructor.name; | ||
@@ -14,0 +15,0 @@ } |
@@ -33,10 +33,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
data) { | ||
var _a, _b; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const Response = yield axios.post(this.apiURL + method, Object.assign({ key: this.token }, data), this.RequestConfig); | ||
if (Response.data.err) { | ||
throw new Core.error(Response.data.err, Response.data.params || []); | ||
} | ||
return Response.data; | ||
} | ||
catch (error) { | ||
console.log(error.response.data.err); | ||
throw new Core.error(error.response.data.err); | ||
if ((_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.err) { | ||
throw new Core.error(error.response.data.err, error.response.data.params || []); | ||
} | ||
else { | ||
console.log(error); | ||
} | ||
} | ||
@@ -43,0 +51,0 @@ }); |
{ | ||
"name": "api-devup", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"description": "This library is intended for interaction with the service https://dev-up.ru", | ||
@@ -5,0 +5,0 @@ "main": "./dist/cjs/main.js", |
@@ -5,4 +5,4 @@ /* eslint-disable */ | ||
const test = new DevUp("te"); | ||
const test = new DevUp("hui"); | ||
test.profile.get(); | ||
test.vk.getStickers({ user_id: 1 }).then((res) => console.log(res)); |
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
56850
1508