iptuapi 2.1.0 → 2.1.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/dist/index.d.mts +398 -435
- package/dist/index.d.ts +398 -435
- package/dist/index.js +487 -431
- package/dist/index.mjs +487 -430
- package/package.json +27 -29
package/dist/index.d.mts
CHANGED
|
@@ -1,518 +1,481 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* IPTU API - JavaScript/TypeScript SDK
|
|
3
|
+
*
|
|
4
|
+
* SDK oficial para integração com a IPTU API.
|
|
5
|
+
* Suporta retry automático, logging e rate limit tracking.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { IPTUClient } from 'iptuapi';
|
|
10
|
+
*
|
|
11
|
+
* const client = new IPTUClient('sua_api_key');
|
|
12
|
+
* const resultado = await client.consultaEndereco('Avenida Paulista', '1000');
|
|
13
|
+
* console.log(resultado);
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Com configuração customizada
|
|
19
|
+
* const client = new IPTUClient('sua_api_key', {
|
|
20
|
+
* timeout: 60000,
|
|
21
|
+
* retries: 5,
|
|
22
|
+
* logger: console,
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
3
25
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
interface ClientOptions {
|
|
17
|
-
baseUrl?: string;
|
|
18
|
-
timeout?: number;
|
|
19
|
-
retryConfig?: Partial<RetryConfig>;
|
|
20
|
-
}
|
|
26
|
+
type Cidade = 'sp' | 'bh' | 'recife' | 'poa' | 'fortaleza' | 'curitiba' | 'rj' | 'brasilia';
|
|
27
|
+
declare const CidadeEnum: {
|
|
28
|
+
readonly SAO_PAULO: Cidade;
|
|
29
|
+
readonly BELO_HORIZONTE: Cidade;
|
|
30
|
+
readonly RECIFE: Cidade;
|
|
31
|
+
readonly PORTO_ALEGRE: Cidade;
|
|
32
|
+
readonly FORTALEZA: Cidade;
|
|
33
|
+
readonly CURITIBA: Cidade;
|
|
34
|
+
readonly RIO_DE_JANEIRO: Cidade;
|
|
35
|
+
readonly BRASILIA: Cidade;
|
|
36
|
+
};
|
|
21
37
|
interface RateLimitInfo {
|
|
22
38
|
limit: number;
|
|
23
39
|
remaining: number;
|
|
24
|
-
|
|
40
|
+
reset: number;
|
|
41
|
+
resetDate: Date;
|
|
25
42
|
}
|
|
26
|
-
interface
|
|
43
|
+
interface ConsultaEnderecoParams {
|
|
44
|
+
logradouro: string;
|
|
45
|
+
numero?: string;
|
|
46
|
+
complemento?: string;
|
|
47
|
+
cidade?: Cidade;
|
|
48
|
+
incluirHistorico?: boolean;
|
|
49
|
+
incluirComparaveis?: boolean;
|
|
50
|
+
incluirZoneamento?: boolean;
|
|
51
|
+
}
|
|
52
|
+
interface ConsultaEnderecoResult {
|
|
27
53
|
sql: string;
|
|
28
54
|
logradouro: string;
|
|
29
|
-
numero
|
|
30
|
-
|
|
55
|
+
numero?: string;
|
|
56
|
+
complemento?: string;
|
|
57
|
+
bairro?: string;
|
|
31
58
|
cep?: string;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
testada?: number;
|
|
41
|
-
fracaoIdeal?: number;
|
|
42
|
-
quantidadePavimentos?: number;
|
|
43
|
-
}
|
|
44
|
-
interface Zoneamento {
|
|
45
|
-
zona: string;
|
|
46
|
-
usoPermitido: string;
|
|
47
|
-
coeficienteAproveitamento?: number;
|
|
48
|
-
taxaOcupacao?: number;
|
|
49
|
-
gabarito?: number;
|
|
50
|
-
recuoFrontal?: number;
|
|
51
|
-
legislacao?: string;
|
|
52
|
-
}
|
|
53
|
-
interface Valuation {
|
|
54
|
-
valorEstimado: number;
|
|
55
|
-
valorMinimo: number;
|
|
56
|
-
valorMaximo: number;
|
|
57
|
-
confianca: number;
|
|
58
|
-
valorM2: number;
|
|
59
|
-
metodologia: string;
|
|
60
|
-
dataReferencia: string;
|
|
61
|
-
}
|
|
62
|
-
interface ValuationParams {
|
|
63
|
-
areaTerreno: number;
|
|
64
|
-
areaConstruida: number;
|
|
65
|
-
bairro: string;
|
|
66
|
-
cidade?: string;
|
|
59
|
+
area_terreno?: number;
|
|
60
|
+
area_construida?: number;
|
|
61
|
+
valor_venal_terreno?: number;
|
|
62
|
+
valor_venal_construcao?: number;
|
|
63
|
+
valor_venal_total?: number;
|
|
64
|
+
iptu_valor?: number;
|
|
65
|
+
ano_construcao?: number;
|
|
66
|
+
tipo_uso?: string;
|
|
67
67
|
zona?: string;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
historico?: HistoricoItem[];
|
|
69
|
+
comparaveis?: ComparavelItem[];
|
|
70
|
+
zoneamento?: ZoneamentoResult;
|
|
71
71
|
}
|
|
72
|
-
interface
|
|
72
|
+
interface ConsultaSQLResult {
|
|
73
73
|
sql: string;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
bairro
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
cidade?: string;
|
|
86
|
-
limit?: number;
|
|
87
|
-
}
|
|
88
|
-
interface ITBIStatus {
|
|
89
|
-
protocolo: string;
|
|
90
|
-
status: string;
|
|
91
|
-
dataSolicitacao: string;
|
|
92
|
-
valorTransacao: number;
|
|
93
|
-
valorVenalReferencia: number;
|
|
94
|
-
baseCalculo: number;
|
|
95
|
-
aliquota: number;
|
|
96
|
-
valorITBI: number;
|
|
97
|
-
dataAprovacao?: string;
|
|
74
|
+
ano?: number;
|
|
75
|
+
valor_venal?: number;
|
|
76
|
+
valor_venal_terreno?: number;
|
|
77
|
+
valor_venal_construcao?: number;
|
|
78
|
+
valor_venal_total?: number;
|
|
79
|
+
iptu_valor?: number;
|
|
80
|
+
logradouro?: string;
|
|
81
|
+
numero?: string;
|
|
82
|
+
bairro?: string;
|
|
83
|
+
area_terreno?: number;
|
|
84
|
+
area_construida?: number;
|
|
98
85
|
}
|
|
99
|
-
interface
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
valorITBI: number;
|
|
106
|
-
isencaoAplicavel: boolean;
|
|
107
|
-
fundamentacaoLegal: string;
|
|
86
|
+
interface HistoricoItem {
|
|
87
|
+
ano: number;
|
|
88
|
+
valor_venal_terreno?: number;
|
|
89
|
+
valor_venal_construcao?: number;
|
|
90
|
+
valor_venal_total?: number;
|
|
91
|
+
iptu_valor?: number;
|
|
108
92
|
}
|
|
109
|
-
interface
|
|
110
|
-
sql
|
|
111
|
-
|
|
112
|
-
|
|
93
|
+
interface ComparavelItem {
|
|
94
|
+
sql?: string;
|
|
95
|
+
logradouro?: string;
|
|
96
|
+
numero?: string;
|
|
97
|
+
bairro?: string;
|
|
98
|
+
area_terreno?: number;
|
|
99
|
+
area_construida?: number;
|
|
100
|
+
valor_venal_total?: number;
|
|
101
|
+
distancia_metros?: number;
|
|
113
102
|
}
|
|
114
|
-
interface
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
103
|
+
interface ZoneamentoResult {
|
|
104
|
+
zona?: string;
|
|
105
|
+
zona_descricao?: string;
|
|
106
|
+
coeficiente_aproveitamento_basico?: number;
|
|
107
|
+
coeficiente_aproveitamento_maximo?: number;
|
|
108
|
+
taxa_ocupacao_maxima?: number;
|
|
109
|
+
gabarito_maximo?: number;
|
|
120
110
|
}
|
|
121
|
-
interface
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
111
|
+
interface ValuationParams {
|
|
112
|
+
area_terreno: number;
|
|
113
|
+
area_construida: number;
|
|
114
|
+
bairro: string;
|
|
115
|
+
zona: string;
|
|
116
|
+
tipo_uso: string;
|
|
117
|
+
tipo_padrao: string;
|
|
118
|
+
ano_construcao?: number;
|
|
119
|
+
cidade?: Cidade;
|
|
120
|
+
}
|
|
121
|
+
interface ValuationResult {
|
|
122
|
+
valor_estimado: number;
|
|
123
|
+
valor_minimo?: number;
|
|
124
|
+
valor_maximo?: number;
|
|
125
|
+
confianca?: number;
|
|
126
|
+
metodo?: string;
|
|
127
|
+
comparaveis_utilizados?: number;
|
|
128
|
+
data_avaliacao?: string;
|
|
129
|
+
}
|
|
130
|
+
interface BatchValuationResult {
|
|
131
|
+
resultados: ValuationResult[];
|
|
132
|
+
total_processados: number;
|
|
133
|
+
total_erros: number;
|
|
134
|
+
erros?: Array<{
|
|
135
|
+
index: number;
|
|
136
|
+
error: string;
|
|
137
|
+
}>;
|
|
128
138
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
139
|
+
declare class IPTUAPIError extends Error {
|
|
140
|
+
readonly statusCode?: number;
|
|
141
|
+
readonly requestId?: string;
|
|
142
|
+
readonly responseBody?: Record<string, unknown>;
|
|
143
|
+
constructor(message: string, statusCode?: number, requestId?: string, responseBody?: Record<string, unknown>);
|
|
144
|
+
get isRetryable(): boolean;
|
|
134
145
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
documento: string;
|
|
138
|
-
email?: string;
|
|
146
|
+
declare class AuthenticationError extends IPTUAPIError {
|
|
147
|
+
constructor(message?: string, requestId?: string, responseBody?: Record<string, unknown>);
|
|
139
148
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
comprador: Pessoa;
|
|
144
|
-
vendedor: Pessoa;
|
|
145
|
-
cidade?: string;
|
|
149
|
+
declare class ForbiddenError extends IPTUAPIError {
|
|
150
|
+
readonly requiredPlan?: string;
|
|
151
|
+
constructor(message?: string, requiredPlan?: string, requestId?: string, responseBody?: Record<string, unknown>);
|
|
146
152
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
codigoBarras: string;
|
|
150
|
-
linhaDigitavel: string;
|
|
151
|
-
dataEmissao: string;
|
|
152
|
-
dataVencimento: string;
|
|
153
|
-
valorITBI: number;
|
|
153
|
+
declare class NotFoundError extends IPTUAPIError {
|
|
154
|
+
constructor(message?: string, requestId?: string, responseBody?: Record<string, unknown>);
|
|
154
155
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
156
|
+
declare class RateLimitError extends IPTUAPIError {
|
|
157
|
+
readonly retryAfter?: number;
|
|
158
|
+
readonly limit?: number;
|
|
159
|
+
readonly remaining?: number;
|
|
160
|
+
constructor(message?: string, retryAfter?: number, limit?: number, remaining?: number, requestId?: string, responseBody?: Record<string, unknown>);
|
|
161
|
+
get isRetryable(): boolean;
|
|
161
162
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
declare class ValidationError extends IPTUAPIError {
|
|
164
|
+
readonly errors?: Array<{
|
|
165
|
+
field: string;
|
|
166
|
+
message: string;
|
|
167
|
+
}>;
|
|
168
|
+
constructor(message?: string, errors?: Array<{
|
|
169
|
+
field: string;
|
|
170
|
+
message: string;
|
|
171
|
+
}>, requestId?: string, responseBody?: Record<string, unknown>);
|
|
167
172
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
valorNaoFinanciado: number;
|
|
172
|
-
aliquotaSFH: number;
|
|
173
|
-
aliquotaPadrao: number;
|
|
174
|
-
valorITBIFinanciado: number;
|
|
175
|
-
valorITBINaoFinanciado: number;
|
|
176
|
-
valorITBITotal: number;
|
|
177
|
-
economiaSFH: number;
|
|
173
|
+
declare class ServerError extends IPTUAPIError {
|
|
174
|
+
constructor(message?: string, statusCode?: number, requestId?: string, responseBody?: Record<string, unknown>);
|
|
175
|
+
get isRetryable(): boolean;
|
|
178
176
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
logradouro?: string;
|
|
184
|
-
/** Numero do imovel */
|
|
185
|
-
numero?: number;
|
|
186
|
-
/** Apartamento, sala, etc. */
|
|
187
|
-
complemento?: string;
|
|
188
|
-
/** Bairro */
|
|
189
|
-
bairro?: string;
|
|
190
|
-
/** Codigo da cidade (sp, bh) */
|
|
191
|
-
cidade?: string;
|
|
192
|
-
/** Incluir estimativa baseada em ITBI */
|
|
193
|
-
incluirItbi?: boolean;
|
|
194
|
-
/** Incluir lista de imoveis comparaveis */
|
|
195
|
-
incluirComparaveis?: boolean;
|
|
177
|
+
declare class TimeoutError extends IPTUAPIError {
|
|
178
|
+
readonly timeoutMs?: number;
|
|
179
|
+
constructor(message?: string, timeoutMs?: number);
|
|
180
|
+
get isRetryable(): boolean;
|
|
196
181
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
valorMinimo: number;
|
|
202
|
-
/** Valor maximo do intervalo */
|
|
203
|
-
valorMaximo: number;
|
|
204
|
-
/** Valor por m2 */
|
|
205
|
-
valorM2: number;
|
|
206
|
-
/** Nivel de confianca (0-1) */
|
|
207
|
-
confianca: number;
|
|
208
|
-
/** Versao do modelo */
|
|
209
|
-
modeloVersao: string;
|
|
182
|
+
declare class NetworkError extends IPTUAPIError {
|
|
183
|
+
readonly originalError?: Error;
|
|
184
|
+
constructor(message?: string, originalError?: Error);
|
|
185
|
+
get isRetryable(): boolean;
|
|
210
186
|
}
|
|
211
|
-
interface
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
/** Valor maximo da faixa */
|
|
217
|
-
faixaMaxima: number;
|
|
218
|
-
/** Valor por m2 (mediana) */
|
|
219
|
-
valorM2Mediana: number;
|
|
220
|
-
/** Total de transacoes analisadas */
|
|
221
|
-
totalTransacoes: number;
|
|
222
|
-
/** Periodo considerado */
|
|
223
|
-
periodo: string;
|
|
224
|
-
/** Fonte dos dados */
|
|
225
|
-
fonte: string;
|
|
187
|
+
interface Logger {
|
|
188
|
+
debug?(message: string, ...args: unknown[]): void;
|
|
189
|
+
info?(message: string, ...args: unknown[]): void;
|
|
190
|
+
warn?(message: string, ...args: unknown[]): void;
|
|
191
|
+
error?(message: string, ...args: unknown[]): void;
|
|
226
192
|
}
|
|
227
|
-
interface
|
|
228
|
-
/**
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
|
|
238
|
-
/** Peso do ITBI no calculo (0-1) */
|
|
239
|
-
pesoItbi: number;
|
|
240
|
-
/** Nivel de confianca */
|
|
241
|
-
confianca: number;
|
|
242
|
-
/** Nota explicativa */
|
|
243
|
-
nota?: string;
|
|
193
|
+
interface RetryConfig {
|
|
194
|
+
/** Maximum number of retry attempts (default: 3) */
|
|
195
|
+
maxRetries: number;
|
|
196
|
+
/** Initial delay in ms between retries (default: 500) */
|
|
197
|
+
initialDelay: number;
|
|
198
|
+
/** Maximum delay in ms between retries (default: 10000) */
|
|
199
|
+
maxDelay: number;
|
|
200
|
+
/** Backoff factor (default: 2) */
|
|
201
|
+
backoffFactor: number;
|
|
202
|
+
/** Status codes that trigger retry (default: [429, 500, 502, 503, 504]) */
|
|
203
|
+
retryableStatuses: number[];
|
|
244
204
|
}
|
|
245
|
-
interface
|
|
246
|
-
/**
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
205
|
+
interface IPTUClientOptions {
|
|
206
|
+
/** Base URL for the API (default: https://iptuapi.com.br/api/v1) */
|
|
207
|
+
baseUrl?: string;
|
|
208
|
+
/** Request timeout in milliseconds (default: 30000) */
|
|
209
|
+
timeout?: number;
|
|
210
|
+
/** Retry configuration */
|
|
211
|
+
retry?: Partial<RetryConfig>;
|
|
212
|
+
/** Logger instance for debugging */
|
|
213
|
+
logger?: Logger;
|
|
214
|
+
/** Enable request logging (default: false) */
|
|
215
|
+
logRequests?: boolean;
|
|
216
|
+
/** Enable response logging (default: false) */
|
|
217
|
+
logResponses?: boolean;
|
|
218
|
+
/** Custom User-Agent header */
|
|
219
|
+
userAgent?: string;
|
|
220
|
+
}
|
|
221
|
+
interface RequestOptions {
|
|
222
|
+
/** AbortSignal for request cancellation */
|
|
223
|
+
signal?: AbortSignal;
|
|
224
|
+
/** Override timeout for this specific request (in milliseconds) */
|
|
225
|
+
timeout?: number;
|
|
264
226
|
}
|
|
265
|
-
type Cidade = 'sp' | 'bh' | 'recife' | 'poa' | 'fortaleza' | 'curitiba' | 'rj' | 'brasilia';
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Cliente principal para a IPTU API.
|
|
269
|
-
*/
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Cliente para interagir com a IPTU API.
|
|
273
|
-
*/
|
|
274
227
|
declare class IPTUClient {
|
|
275
228
|
private readonly apiKey;
|
|
276
|
-
private readonly
|
|
277
|
-
private
|
|
278
|
-
private
|
|
229
|
+
private readonly baseUrl;
|
|
230
|
+
private readonly timeout;
|
|
231
|
+
private readonly retryConfig;
|
|
232
|
+
private readonly logger?;
|
|
233
|
+
private readonly logRequests;
|
|
234
|
+
private readonly logResponses;
|
|
235
|
+
private readonly userAgent;
|
|
236
|
+
private _rateLimit?;
|
|
237
|
+
private _lastRequestId?;
|
|
238
|
+
constructor(apiKey: string, options?: IPTUClientOptions);
|
|
239
|
+
/** Rate limit info from last request */
|
|
240
|
+
get rateLimit(): RateLimitInfo | undefined;
|
|
241
|
+
/** Request ID from last request (useful for support) */
|
|
242
|
+
get lastRequestId(): string | undefined;
|
|
243
|
+
private log;
|
|
244
|
+
private sleep;
|
|
245
|
+
private combineSignals;
|
|
246
|
+
private calculateDelay;
|
|
247
|
+
private extractRateLimit;
|
|
248
|
+
private handleErrorResponse;
|
|
249
|
+
private request;
|
|
279
250
|
/**
|
|
280
|
-
*
|
|
251
|
+
* Busca dados de IPTU por endereço.
|
|
281
252
|
*
|
|
282
|
-
* @param
|
|
283
|
-
* @param options -
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
*
|
|
288
|
-
|
|
289
|
-
get rateLimitInfo(): RateLimitInfo | null;
|
|
290
|
-
/**
|
|
291
|
-
* Retorna o ID da ultima requisicao.
|
|
253
|
+
* @param params - Parâmetros da consulta
|
|
254
|
+
* @param options - Opções de request (signal para cancelamento, timeout)
|
|
255
|
+
* @returns Dados do imóvel encontrado
|
|
256
|
+
* @throws {NotFoundError} Se o imóvel não for encontrado
|
|
257
|
+
* @throws {ValidationError} Se os parâmetros forem inválidos
|
|
258
|
+
* @throws {AuthenticationError} Se a API Key for inválida
|
|
259
|
+
* @throws {RateLimitError} Se exceder o limite de requisições
|
|
292
260
|
*/
|
|
293
|
-
|
|
261
|
+
consultaEndereco(params: ConsultaEnderecoParams, options?: RequestOptions): Promise<ConsultaEnderecoResult>;
|
|
262
|
+
consultaEndereco(logradouro: string, numero?: string, cidade?: Cidade, options?: RequestOptions): Promise<ConsultaEnderecoResult>;
|
|
294
263
|
/**
|
|
295
|
-
*
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
*
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* Converte resposta HTTP em excecao apropriada.
|
|
304
|
-
*/
|
|
305
|
-
private handleError;
|
|
306
|
-
/**
|
|
307
|
-
* Aguarda um tempo em milissegundos.
|
|
264
|
+
* Busca dados de IPTU por número SQL (contribuinte).
|
|
265
|
+
*
|
|
266
|
+
* @param sql - Número SQL do imóvel
|
|
267
|
+
* @param cidade - Cidade da consulta
|
|
268
|
+
* @param options - Opções adicionais (incluirHistorico, incluirComparaveis)
|
|
269
|
+
* @param requestOptions - Opções de request (signal para cancelamento, timeout)
|
|
270
|
+
* @returns Dados completos do imóvel
|
|
308
271
|
*/
|
|
309
|
-
|
|
272
|
+
consultaSQL(sql: string, cidade?: Cidade, options?: {
|
|
273
|
+
incluirHistorico?: boolean;
|
|
274
|
+
incluirComparaveis?: boolean;
|
|
275
|
+
}, requestOptions?: RequestOptions): Promise<ConsultaSQLResult>;
|
|
310
276
|
/**
|
|
311
|
-
*
|
|
277
|
+
* Busca imóveis por CEP.
|
|
312
278
|
*
|
|
313
|
-
* @param
|
|
314
|
-
* @param
|
|
315
|
-
* @param
|
|
316
|
-
* @returns Lista de
|
|
279
|
+
* @param cep - CEP do imóvel
|
|
280
|
+
* @param cidade - Cidade da consulta
|
|
281
|
+
* @param requestOptions - Opções de request (signal para cancelamento, timeout)
|
|
282
|
+
* @returns Lista de imóveis no CEP
|
|
317
283
|
*/
|
|
318
|
-
|
|
284
|
+
consultaCEP(cep: string, cidade?: Cidade, requestOptions?: RequestOptions): Promise<ConsultaEnderecoResult[]>;
|
|
319
285
|
/**
|
|
320
|
-
* Consulta
|
|
321
|
-
* Requer plano Starter ou superior.
|
|
286
|
+
* Consulta zoneamento por coordenadas.
|
|
322
287
|
*
|
|
323
|
-
* @param
|
|
324
|
-
* @param
|
|
325
|
-
* @
|
|
288
|
+
* @param latitude - Latitude do ponto
|
|
289
|
+
* @param longitude - Longitude do ponto
|
|
290
|
+
* @param requestOptions - Opções de request (signal para cancelamento, timeout)
|
|
291
|
+
* @returns Dados de zoneamento
|
|
326
292
|
*/
|
|
327
|
-
|
|
293
|
+
consultaZoneamento(latitude: number, longitude: number, requestOptions?: RequestOptions): Promise<ZoneamentoResult>;
|
|
328
294
|
/**
|
|
329
|
-
*
|
|
295
|
+
* Estima o valor de mercado do imóvel usando ML.
|
|
296
|
+
* Disponível apenas para planos Pro e Enterprise.
|
|
330
297
|
*
|
|
331
|
-
* @param
|
|
332
|
-
* @param
|
|
333
|
-
* @returns
|
|
298
|
+
* @param params - Parâmetros do imóvel
|
|
299
|
+
* @param requestOptions - Opções de request (signal para cancelamento, timeout)
|
|
300
|
+
* @returns Estimativa de valor
|
|
301
|
+
* @throws {ForbiddenError} Se o plano não permitir
|
|
334
302
|
*/
|
|
335
|
-
|
|
303
|
+
valuationEstimate(params: ValuationParams, requestOptions?: RequestOptions): Promise<ValuationResult>;
|
|
336
304
|
/**
|
|
337
|
-
*
|
|
305
|
+
* Valuation em lote (até 100 imóveis).
|
|
306
|
+
* Disponível apenas para plano Enterprise.
|
|
338
307
|
*
|
|
339
|
-
* @param
|
|
340
|
-
* @param
|
|
341
|
-
* @returns
|
|
308
|
+
* @param imoveis - Lista de imóveis para avaliar
|
|
309
|
+
* @param requestOptions - Opções de request (signal para cancelamento, timeout)
|
|
310
|
+
* @returns Resultados de valuation para cada imóvel
|
|
342
311
|
*/
|
|
343
|
-
|
|
312
|
+
valuationBatch(imoveis: ValuationParams[], requestOptions?: RequestOptions): Promise<BatchValuationResult>;
|
|
344
313
|
/**
|
|
345
|
-
*
|
|
346
|
-
* Requer plano Pro ou superior.
|
|
314
|
+
* Busca imóveis comparáveis para análise.
|
|
347
315
|
*
|
|
348
|
-
* @param
|
|
349
|
-
* @
|
|
316
|
+
* @param bairro - Nome do bairro
|
|
317
|
+
* @param areaMin - Área mínima em m²
|
|
318
|
+
* @param areaMax - Área máxima em m²
|
|
319
|
+
* @param options - Opções adicionais
|
|
320
|
+
* @param requestOptions - Opções de request (signal para cancelamento, timeout)
|
|
321
|
+
* @returns Lista de imóveis comparáveis
|
|
350
322
|
*/
|
|
351
|
-
|
|
323
|
+
valuationComparables(bairro: string, areaMin: number, areaMax: number, options?: {
|
|
324
|
+
tipoUso?: string;
|
|
325
|
+
cidade?: Cidade;
|
|
326
|
+
limit?: number;
|
|
327
|
+
}, requestOptions?: RequestOptions): Promise<ComparavelItem[]>;
|
|
352
328
|
/**
|
|
353
|
-
*
|
|
354
|
-
* Requer plano Pro ou superior.
|
|
329
|
+
* Estatísticas de valores por bairro.
|
|
355
330
|
*
|
|
356
|
-
* @param
|
|
357
|
-
* @
|
|
331
|
+
* @param bairro - Nome do bairro
|
|
332
|
+
* @param cidade - Cidade da consulta
|
|
333
|
+
* @param requestOptions - Opções de request (signal para cancelamento, timeout)
|
|
334
|
+
* @returns Estatísticas: média, mediana, min, max, etc
|
|
358
335
|
*/
|
|
359
|
-
|
|
336
|
+
valuationStatistics(bairro: string, cidade?: Cidade, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
|
|
360
337
|
/**
|
|
361
|
-
*
|
|
362
|
-
* Combina dados do modelo AVM (ML) com transacoes ITBI reais.
|
|
363
|
-
* Requer plano Pro ou superior.
|
|
338
|
+
* Histórico de valores IPTU de um imóvel.
|
|
364
339
|
*
|
|
365
|
-
* @param
|
|
366
|
-
* @
|
|
340
|
+
* @param sql - Número SQL do imóvel
|
|
341
|
+
* @param cidade - Cidade da consulta
|
|
342
|
+
* @param requestOptions - Opções de request (signal para cancelamento, timeout)
|
|
343
|
+
* @returns Lista com histórico anual
|
|
367
344
|
*/
|
|
368
|
-
|
|
345
|
+
dadosIPTUHistorico(sql: string, cidade?: Cidade, requestOptions?: RequestOptions): Promise<HistoricoItem[]>;
|
|
369
346
|
/**
|
|
370
|
-
* Consulta
|
|
347
|
+
* Consulta dados de empresa por CNPJ.
|
|
371
348
|
*
|
|
372
|
-
* @param
|
|
373
|
-
* @param
|
|
374
|
-
* @returns
|
|
349
|
+
* @param cnpj - CNPJ da empresa
|
|
350
|
+
* @param requestOptions - Opções de request (signal para cancelamento, timeout)
|
|
351
|
+
* @returns Dados cadastrais
|
|
375
352
|
*/
|
|
376
|
-
|
|
353
|
+
dadosCNPJ(cnpj: string, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
|
|
377
354
|
/**
|
|
378
|
-
*
|
|
355
|
+
* Índice IPCA histórico.
|
|
379
356
|
*
|
|
380
|
-
* @param
|
|
381
|
-
* @
|
|
357
|
+
* @param dataInicio - Data inicial (YYYY-MM)
|
|
358
|
+
* @param dataFim - Data final (YYYY-MM)
|
|
359
|
+
* @param requestOptions - Opções de request (signal para cancelamento, timeout)
|
|
360
|
+
* @returns Série histórica do IPCA
|
|
382
361
|
*/
|
|
383
|
-
|
|
362
|
+
dadosIPCA(dataInicio?: string, dataFim?: string, requestOptions?: RequestOptions): Promise<Array<Record<string, unknown>>>;
|
|
384
363
|
/**
|
|
385
|
-
*
|
|
386
|
-
* Requer plano Starter ou superior.
|
|
364
|
+
* Correção monetária pelo IPCA.
|
|
387
365
|
*
|
|
388
|
-
* @param
|
|
389
|
-
* @param
|
|
390
|
-
* @
|
|
366
|
+
* @param valor - Valor a corrigir
|
|
367
|
+
* @param dataOrigem - Data do valor original (YYYY-MM)
|
|
368
|
+
* @param dataDestino - Data destino (default: atual)
|
|
369
|
+
* @param requestOptions - Opções de request (signal para cancelamento, timeout)
|
|
370
|
+
* @returns Valor corrigido e fator de correção
|
|
391
371
|
*/
|
|
392
|
-
|
|
372
|
+
dadosIPCACorrigir(valor: number, dataOrigem: string, dataDestino?: string, requestOptions?: RequestOptions): Promise<{
|
|
373
|
+
valor_corrigido: number;
|
|
374
|
+
fator: number;
|
|
375
|
+
}>;
|
|
393
376
|
/**
|
|
394
|
-
*
|
|
377
|
+
* Lista todas as cidades com calendario de IPTU disponivel.
|
|
395
378
|
*
|
|
396
|
-
* @param
|
|
397
|
-
* @returns
|
|
379
|
+
* @param requestOptions - Opções de request (signal para cancelamento, timeout)
|
|
380
|
+
* @returns Lista de cidades com codigo, nome, desconto e parcelas
|
|
398
381
|
*/
|
|
399
|
-
|
|
382
|
+
iptuToolsCidades(requestOptions?: RequestOptions): Promise<{
|
|
383
|
+
cidades: Array<{
|
|
384
|
+
codigo: string;
|
|
385
|
+
nome: string;
|
|
386
|
+
ano: number;
|
|
387
|
+
desconto_vista: string;
|
|
388
|
+
parcelas_max: number;
|
|
389
|
+
site_oficial: string;
|
|
390
|
+
}>;
|
|
391
|
+
total: number;
|
|
392
|
+
}>;
|
|
400
393
|
/**
|
|
401
|
-
*
|
|
394
|
+
* Retorna o calendario completo de IPTU para a cidade especificada.
|
|
402
395
|
*
|
|
403
|
-
* @param cidade - Codigo da cidade (sp, bh, recife)
|
|
404
|
-
* @
|
|
396
|
+
* @param cidade - Codigo da cidade (sp, bh, rj, recife, curitiba, poa, fortaleza)
|
|
397
|
+
* @param requestOptions - Opções de request (signal para cancelamento, timeout)
|
|
398
|
+
* @returns Calendario com vencimentos, descontos, alertas e novidades
|
|
405
399
|
*/
|
|
406
|
-
|
|
400
|
+
iptuToolsCalendario(cidade?: Cidade, requestOptions?: RequestOptions): Promise<{
|
|
401
|
+
cidade: string;
|
|
402
|
+
ano: number;
|
|
403
|
+
desconto_vista_percentual: number;
|
|
404
|
+
desconto_vista_texto: string;
|
|
405
|
+
parcelas_max: number;
|
|
406
|
+
valor_minimo_parcela: number;
|
|
407
|
+
isencao_valor_venal?: number;
|
|
408
|
+
isencao_texto?: string;
|
|
409
|
+
site_oficial: string;
|
|
410
|
+
novidades?: string[];
|
|
411
|
+
alertas?: string[];
|
|
412
|
+
formas_pagamento?: string[];
|
|
413
|
+
vencimentos_cota_unica: string[];
|
|
414
|
+
vencimentos_parcelado: string[];
|
|
415
|
+
proximo_vencimento?: string;
|
|
416
|
+
dias_para_proximo_vencimento?: number;
|
|
417
|
+
}>;
|
|
407
418
|
/**
|
|
408
|
-
*
|
|
409
|
-
* Requer plano Starter ou superior.
|
|
419
|
+
* Simula as opcoes de pagamento do IPTU (a vista vs parcelado).
|
|
410
420
|
*
|
|
411
|
-
* @param
|
|
412
|
-
* @
|
|
421
|
+
* @param valorIptu - Valor total do IPTU
|
|
422
|
+
* @param cidade - Codigo da cidade
|
|
423
|
+
* @param valorVenal - Valor venal do imovel (para verificar isencao)
|
|
424
|
+
* @param requestOptions - Opções de request (signal para cancelamento, timeout)
|
|
425
|
+
* @returns Comparativo entre pagamento a vista e parcelado com recomendacao
|
|
413
426
|
*/
|
|
414
|
-
|
|
427
|
+
iptuToolsSimulador(valorIptu: number, cidade?: Cidade, valorVenal?: number, requestOptions?: RequestOptions): Promise<{
|
|
428
|
+
valor_original: number;
|
|
429
|
+
valor_vista: number;
|
|
430
|
+
desconto_vista: number;
|
|
431
|
+
desconto_percentual: number;
|
|
432
|
+
parcelas: number;
|
|
433
|
+
valor_parcela: number;
|
|
434
|
+
valor_total_parcelado: number;
|
|
435
|
+
economia_vista: number;
|
|
436
|
+
economia_percentual: number;
|
|
437
|
+
recomendacao: string;
|
|
438
|
+
elegivel_isencao: boolean;
|
|
439
|
+
isencao_mensagem?: string;
|
|
440
|
+
cidade: string;
|
|
441
|
+
ano: number;
|
|
442
|
+
proximo_vencimento?: string;
|
|
443
|
+
}>;
|
|
415
444
|
/**
|
|
416
|
-
*
|
|
445
|
+
* Verifica se um imovel e elegivel para isencao de IPTU.
|
|
417
446
|
*
|
|
418
|
-
* @param
|
|
419
|
-
* @param cidade - Codigo da cidade
|
|
420
|
-
* @
|
|
447
|
+
* @param valorVenal - Valor venal do imovel
|
|
448
|
+
* @param cidade - Codigo da cidade
|
|
449
|
+
* @param requestOptions - Opções de request (signal para cancelamento, timeout)
|
|
450
|
+
* @returns Elegibilidade para isencao total ou parcial
|
|
421
451
|
*/
|
|
422
|
-
|
|
452
|
+
iptuToolsIsencao(valorVenal: number, cidade?: Cidade, requestOptions?: RequestOptions): Promise<{
|
|
453
|
+
cidade: string;
|
|
454
|
+
valor_venal: number;
|
|
455
|
+
limite_isencao: number;
|
|
456
|
+
elegivel_isencao_total: boolean;
|
|
457
|
+
elegivel_desconto_parcial: boolean;
|
|
458
|
+
desconto_estimado_percentual?: number;
|
|
459
|
+
mensagem: string;
|
|
460
|
+
requisitos_adicionais: string[];
|
|
461
|
+
}>;
|
|
423
462
|
/**
|
|
424
|
-
*
|
|
463
|
+
* Retorna informacoes sobre o proximo vencimento do IPTU.
|
|
425
464
|
*
|
|
426
|
-
* @param
|
|
427
|
-
* @
|
|
465
|
+
* @param cidade - Codigo da cidade
|
|
466
|
+
* @param parcela - Numero da parcela (1-12)
|
|
467
|
+
* @param requestOptions - Opções de request (signal para cancelamento, timeout)
|
|
468
|
+
* @returns Data de vencimento, dias restantes e status
|
|
428
469
|
*/
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
statusCode?: number;
|
|
439
|
-
requestId?: string;
|
|
440
|
-
retryable: boolean;
|
|
441
|
-
[key: string]: unknown;
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* Excecao base para todos os erros da IPTU API.
|
|
445
|
-
*/
|
|
446
|
-
declare class IPTUAPIError extends Error {
|
|
447
|
-
readonly statusCode?: number;
|
|
448
|
-
readonly requestId?: string;
|
|
449
|
-
readonly responseData: Record<string, unknown>;
|
|
450
|
-
constructor(message: string, statusCode?: number, requestId?: string, responseData?: Record<string, unknown>);
|
|
451
|
-
isRetryable(): boolean;
|
|
452
|
-
toJSON(): ErrorDetails;
|
|
453
|
-
}
|
|
454
|
-
/**
|
|
455
|
-
* Erro de autenticacao (401). API Key invalida ou ausente.
|
|
456
|
-
*/
|
|
457
|
-
declare class AuthenticationError extends IPTUAPIError {
|
|
458
|
-
constructor(message?: string, requestId?: string);
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* Erro de autorizacao (403). Plano nao permite acesso ao recurso.
|
|
462
|
-
*/
|
|
463
|
-
declare class ForbiddenError extends IPTUAPIError {
|
|
464
|
-
readonly requiredPlan?: string;
|
|
465
|
-
constructor(message?: string, requiredPlan?: string, requestId?: string);
|
|
466
|
-
toJSON(): ErrorDetails;
|
|
467
|
-
}
|
|
468
|
-
/**
|
|
469
|
-
* Erro de recurso nao encontrado (404).
|
|
470
|
-
*/
|
|
471
|
-
declare class NotFoundError extends IPTUAPIError {
|
|
472
|
-
readonly resource?: string;
|
|
473
|
-
constructor(message?: string, resource?: string, requestId?: string);
|
|
474
|
-
toJSON(): ErrorDetails;
|
|
475
|
-
}
|
|
476
|
-
/**
|
|
477
|
-
* Erro de rate limit excedido (429).
|
|
478
|
-
*/
|
|
479
|
-
declare class RateLimitError extends IPTUAPIError {
|
|
480
|
-
readonly retryAfter: number;
|
|
481
|
-
constructor(message?: string, retryAfter?: number, requestId?: string);
|
|
482
|
-
isRetryable(): boolean;
|
|
483
|
-
toJSON(): ErrorDetails;
|
|
484
|
-
}
|
|
485
|
-
/**
|
|
486
|
-
* Erro de validacao de parametros (400, 422).
|
|
487
|
-
*/
|
|
488
|
-
declare class ValidationError extends IPTUAPIError {
|
|
489
|
-
readonly errors: Record<string, string[]>;
|
|
490
|
-
constructor(message?: string, errors?: Record<string, string[]>, statusCode?: number, requestId?: string);
|
|
491
|
-
toJSON(): ErrorDetails;
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Erro interno do servidor (5xx). Retryable.
|
|
495
|
-
*/
|
|
496
|
-
declare class ServerError extends IPTUAPIError {
|
|
497
|
-
constructor(message?: string, statusCode?: number, requestId?: string);
|
|
498
|
-
isRetryable(): boolean;
|
|
499
|
-
}
|
|
500
|
-
/**
|
|
501
|
-
* Erro de timeout na requisicao.
|
|
502
|
-
*/
|
|
503
|
-
declare class TimeoutError extends IPTUAPIError {
|
|
504
|
-
readonly timeoutSeconds?: number;
|
|
505
|
-
constructor(message?: string, timeoutSeconds?: number, requestId?: string);
|
|
506
|
-
isRetryable(): boolean;
|
|
507
|
-
toJSON(): ErrorDetails;
|
|
508
|
-
}
|
|
509
|
-
/**
|
|
510
|
-
* Erro de conexao de rede.
|
|
511
|
-
*/
|
|
512
|
-
declare class NetworkError extends IPTUAPIError {
|
|
513
|
-
readonly originalError?: Error;
|
|
514
|
-
constructor(message?: string, originalError?: Error);
|
|
515
|
-
isRetryable(): boolean;
|
|
470
|
+
iptuToolsProximoVencimento(cidade?: Cidade, parcela?: number, requestOptions?: RequestOptions): Promise<{
|
|
471
|
+
cidade: string;
|
|
472
|
+
data_vencimento: string;
|
|
473
|
+
dias_restantes: number;
|
|
474
|
+
status: "em_dia" | "proximo" | "vence_hoje" | "vencido";
|
|
475
|
+
mensagem: string;
|
|
476
|
+
multa_estimada?: number;
|
|
477
|
+
juros_estimados?: number;
|
|
478
|
+
}>;
|
|
516
479
|
}
|
|
517
480
|
|
|
518
|
-
export {
|
|
481
|
+
export { AuthenticationError, type BatchValuationResult, type Cidade, CidadeEnum, type ComparavelItem, type ConsultaEnderecoParams, type ConsultaEnderecoResult, type ConsultaSQLResult, ForbiddenError, type HistoricoItem, IPTUAPIError, IPTUClient, type IPTUClientOptions, type Logger, NetworkError, NotFoundError, RateLimitError, type RateLimitInfo, type RequestOptions, type RetryConfig, ServerError, TimeoutError, ValidationError, type ValuationParams, type ValuationResult, type ZoneamentoResult, IPTUClient as default };
|