@incanta/node-paddle-sdk
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -62,6 +62,6 @@ "use strict"; | ||
const res = yield (0, got_1.default)(url, options).json(); | ||
if (res.success === true) { | ||
return res.response; | ||
if ('error' in res) { | ||
throw new PaddleHttpError(res.error.code, JSON.stringify(res.error)); | ||
} | ||
throw new PaddleHttpError(res.error.code, res.error.message); | ||
return res.data; | ||
}); | ||
@@ -68,0 +68,0 @@ } |
@@ -42,6 +42,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
const res = yield got(url, options).json(); | ||
if (res.success === true) { | ||
return res.response; | ||
if ('error' in res) { | ||
throw new PaddleHttpError(res.error.code, JSON.stringify(res.error)); | ||
} | ||
throw new PaddleHttpError(res.error.code, res.error.message); | ||
return res.data; | ||
}); | ||
@@ -48,0 +48,0 @@ } |
{ | ||
"name": "@incanta/node-paddle-sdk", | ||
"private": false, | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "A fully typed NodeJS library for integration with Paddle.", | ||
@@ -6,0 +6,0 @@ "exports": { |
@@ -9,11 +9,21 @@ import got, { OptionsOfTextResponseBody } from 'got'; | ||
| { | ||
success: true; | ||
response: T; | ||
data: T; | ||
meta: { | ||
request_id: string; | ||
}; | ||
} | ||
| { | ||
success: false; | ||
error: { | ||
type: string; | ||
code: number; | ||
message: string; | ||
detail: string; | ||
documentation_url: string; | ||
errors: { | ||
field: string; | ||
message: string; | ||
}[]; | ||
}; | ||
meta: { | ||
request_id: string; | ||
}; | ||
}; | ||
@@ -62,7 +72,7 @@ | ||
if (res.success === true) { | ||
return res.response; | ||
if ('error' in res) { | ||
throw new PaddleHttpError(res.error.code, JSON.stringify(res.error)); | ||
} | ||
throw new PaddleHttpError(res.error.code, res.error.message); | ||
return res.data; | ||
} | ||
@@ -69,0 +79,0 @@ |
199112
5635