iptuapi 2.0.0 → 2.0.2

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # IPTU API - JavaScript/TypeScript SDK
2
2
 
3
- SDK oficial JavaScript/TypeScript para integracao com a IPTU API. Acesso a dados de IPTU de mais de 10 cidades brasileiras.
3
+ SDK oficial JavaScript/TypeScript para integracao com a IPTU API. Acesso a dados de IPTU de Sao Paulo, Belo Horizonte e Recife.
4
4
 
5
5
  [![npm version](https://badge.fury.io/js/iptuapi.svg)](https://www.npmjs.com/package/iptuapi)
6
6
  [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue)](https://www.typescriptlang.org/)
@@ -279,15 +279,8 @@ npm run test:coverage
279
279
  | Codigo | Cidade |
280
280
  |--------|--------|
281
281
  | sp | Sao Paulo |
282
- | rj | Rio de Janeiro |
283
282
  | bh | Belo Horizonte |
284
283
  | recife | Recife |
285
- | curitiba | Curitiba |
286
- | poa | Porto Alegre |
287
- | salvador | Salvador |
288
- | fortaleza | Fortaleza |
289
- | campinas | Campinas |
290
- | santos | Santos |
291
284
 
292
285
  ## Licenca
293
286
 
package/dist/index.js CHANGED
@@ -216,7 +216,14 @@ var IPTUClient = class {
216
216
  } catch {
217
217
  body = { detail: response.statusText };
218
218
  }
219
- const message = body.detail || `HTTP ${response.status}`;
219
+ let message;
220
+ const detail = body.detail;
221
+ if (detail && typeof detail === "object") {
222
+ const detailObj = detail;
223
+ message = detailObj.error || detailObj.detail || detailObj.message || JSON.stringify(detail);
224
+ } else {
225
+ message = detail || `HTTP ${response.status}`;
226
+ }
220
227
  switch (response.status) {
221
228
  case 400:
222
229
  case 422:
package/dist/index.mjs CHANGED
@@ -181,7 +181,14 @@ var IPTUClient = class {
181
181
  } catch {
182
182
  body = { detail: response.statusText };
183
183
  }
184
- const message = body.detail || `HTTP ${response.status}`;
184
+ let message;
185
+ const detail = body.detail;
186
+ if (detail && typeof detail === "object") {
187
+ const detailObj = detail;
188
+ message = detailObj.error || detailObj.detail || detailObj.message || JSON.stringify(detail);
189
+ } else {
190
+ message = detail || `HTTP ${response.status}`;
191
+ }
185
192
  switch (response.status) {
186
193
  case 400:
187
194
  case 422:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iptuapi",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "SDK oficial para a IPTU API - Dados de IPTU de São Paulo, Belo Horizonte e Recife",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",