iptuapi 2.0.2 → 2.1.0
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 +502 -128
- package/dist/index.d.mts +451 -271
- package/dist/index.d.ts +451 -271
- package/dist/index.js +443 -345
- package/dist/index.mjs +442 -345
- package/package.json +29 -27
package/dist/index.d.mts
CHANGED
|
@@ -1,338 +1,518 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
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
|
-
* ```
|
|
2
|
+
* Tipos e interfaces para a IPTU API.
|
|
25
3
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
4
|
+
interface RetryConfig {
|
|
5
|
+
maxRetries: number;
|
|
6
|
+
initialDelay: number;
|
|
7
|
+
maxDelay: number;
|
|
8
|
+
backoffFactor: number;
|
|
9
|
+
retryableStatusCodes: number[];
|
|
10
|
+
}
|
|
11
|
+
interface ClientConfig {
|
|
12
|
+
baseUrl: string;
|
|
13
|
+
timeout: number;
|
|
14
|
+
retryConfig: RetryConfig;
|
|
15
|
+
}
|
|
16
|
+
interface ClientOptions {
|
|
17
|
+
baseUrl?: string;
|
|
18
|
+
timeout?: number;
|
|
19
|
+
retryConfig?: Partial<RetryConfig>;
|
|
20
|
+
}
|
|
32
21
|
interface RateLimitInfo {
|
|
33
22
|
limit: number;
|
|
34
23
|
remaining: number;
|
|
35
|
-
|
|
36
|
-
resetDate: Date;
|
|
24
|
+
resetAt: Date;
|
|
37
25
|
}
|
|
38
|
-
interface
|
|
39
|
-
logradouro: string;
|
|
40
|
-
numero?: string;
|
|
41
|
-
complemento?: string;
|
|
42
|
-
cidade?: Cidade;
|
|
43
|
-
incluirHistorico?: boolean;
|
|
44
|
-
incluirComparaveis?: boolean;
|
|
45
|
-
incluirZoneamento?: boolean;
|
|
46
|
-
}
|
|
47
|
-
interface ConsultaEnderecoResult {
|
|
26
|
+
interface Imovel {
|
|
48
27
|
sql: string;
|
|
49
28
|
logradouro: string;
|
|
50
|
-
numero
|
|
51
|
-
|
|
52
|
-
bairro?: string;
|
|
29
|
+
numero: string;
|
|
30
|
+
bairro: string;
|
|
53
31
|
cep?: string;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
32
|
+
areaTerreno?: number;
|
|
33
|
+
areaConstruida?: number;
|
|
34
|
+
valorVenal?: number;
|
|
35
|
+
valorVenalTerreno?: number;
|
|
36
|
+
valorVenalConstrucao?: number;
|
|
37
|
+
anoConstrucao?: number;
|
|
38
|
+
uso?: string;
|
|
39
|
+
padrao?: string;
|
|
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;
|
|
62
67
|
zona?: string;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
tipoUso?: string;
|
|
69
|
+
tipoPadrao?: string;
|
|
70
|
+
anoConstrucao?: number;
|
|
66
71
|
}
|
|
67
|
-
interface
|
|
72
|
+
interface Comparavel {
|
|
68
73
|
sql: string;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
logradouro?: string;
|
|
76
|
-
numero?: string;
|
|
77
|
-
bairro?: string;
|
|
78
|
-
area_terreno?: number;
|
|
79
|
-
area_construida?: number;
|
|
74
|
+
logradouro: string;
|
|
75
|
+
bairro: string;
|
|
76
|
+
areaConstruida: number;
|
|
77
|
+
valorVenal: number;
|
|
78
|
+
valorM2: number;
|
|
79
|
+
distanciaKm?: number;
|
|
80
80
|
}
|
|
81
|
-
interface
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
interface ComparablesParams {
|
|
82
|
+
bairro: string;
|
|
83
|
+
areaMin: number;
|
|
84
|
+
areaMax: number;
|
|
85
|
+
cidade?: string;
|
|
86
|
+
limit?: number;
|
|
87
87
|
}
|
|
88
|
-
interface
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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;
|
|
97
98
|
}
|
|
98
|
-
interface
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
interface ITBICalculo {
|
|
100
|
+
sql: string;
|
|
101
|
+
valorTransacao: number;
|
|
102
|
+
valorVenalReferencia: number;
|
|
103
|
+
baseCalculo: number;
|
|
104
|
+
aliquota: number;
|
|
105
|
+
valorITBI: number;
|
|
106
|
+
isencaoAplicavel: boolean;
|
|
107
|
+
fundamentacaoLegal: string;
|
|
105
108
|
}
|
|
106
|
-
interface
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
zona: string;
|
|
111
|
-
tipo_uso: string;
|
|
112
|
-
tipo_padrao: string;
|
|
113
|
-
ano_construcao?: number;
|
|
114
|
-
cidade?: Cidade;
|
|
115
|
-
}
|
|
116
|
-
interface ValuationResult {
|
|
117
|
-
valor_estimado: number;
|
|
118
|
-
valor_minimo?: number;
|
|
119
|
-
valor_maximo?: number;
|
|
120
|
-
confianca?: number;
|
|
121
|
-
metodo?: string;
|
|
122
|
-
comparaveis_utilizados?: number;
|
|
123
|
-
data_avaliacao?: string;
|
|
124
|
-
}
|
|
125
|
-
interface BatchValuationResult {
|
|
126
|
-
resultados: ValuationResult[];
|
|
127
|
-
total_processados: number;
|
|
128
|
-
total_erros: number;
|
|
129
|
-
erros?: Array<{
|
|
130
|
-
index: number;
|
|
131
|
-
error: string;
|
|
132
|
-
}>;
|
|
109
|
+
interface ITBICalculoParams {
|
|
110
|
+
sql: string;
|
|
111
|
+
valorTransacao: number;
|
|
112
|
+
cidade?: string;
|
|
133
113
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
114
|
+
interface ITBIHistorico {
|
|
115
|
+
protocolo: string;
|
|
116
|
+
dataTransacao: string;
|
|
117
|
+
tipoTransacao: string;
|
|
118
|
+
valorTransacao: number;
|
|
119
|
+
valorITBI: number;
|
|
140
120
|
}
|
|
141
|
-
|
|
142
|
-
|
|
121
|
+
interface ITBIAliquota {
|
|
122
|
+
cidade: string;
|
|
123
|
+
aliquotaPadrao: number;
|
|
124
|
+
aliquotaFinanciamentoSFH: number;
|
|
125
|
+
valorMinimoIsencao: number;
|
|
126
|
+
baseLegal: string;
|
|
127
|
+
vigencia: string;
|
|
143
128
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
129
|
+
interface ITBIIsencao {
|
|
130
|
+
tipo: string;
|
|
131
|
+
descricao: string;
|
|
132
|
+
requisitos: string[];
|
|
133
|
+
baseLegal: string;
|
|
147
134
|
}
|
|
148
|
-
|
|
149
|
-
|
|
135
|
+
interface Pessoa {
|
|
136
|
+
nome: string;
|
|
137
|
+
documento: string;
|
|
138
|
+
email?: string;
|
|
150
139
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
140
|
+
interface ITBIGuiaParams {
|
|
141
|
+
sql: string;
|
|
142
|
+
valorTransacao: number;
|
|
143
|
+
comprador: Pessoa;
|
|
144
|
+
vendedor: Pessoa;
|
|
145
|
+
cidade?: string;
|
|
157
146
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
message: string;
|
|
166
|
-
}>, requestId?: string, responseBody?: Record<string, unknown>);
|
|
147
|
+
interface ITBIGuia {
|
|
148
|
+
protocolo: string;
|
|
149
|
+
codigoBarras: string;
|
|
150
|
+
linhaDigitavel: string;
|
|
151
|
+
dataEmissao: string;
|
|
152
|
+
dataVencimento: string;
|
|
153
|
+
valorITBI: number;
|
|
167
154
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
155
|
+
interface ITBIValidacao {
|
|
156
|
+
protocolo: string;
|
|
157
|
+
valido: boolean;
|
|
158
|
+
pago: boolean;
|
|
159
|
+
dataPagamento?: string;
|
|
160
|
+
valorPago?: number;
|
|
171
161
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
162
|
+
interface ITBISimularParams {
|
|
163
|
+
valorTransacao: number;
|
|
164
|
+
cidade?: string;
|
|
165
|
+
tipoFinanciamento?: 'sfh' | 'nao_sfh';
|
|
166
|
+
valorFinanciado?: number;
|
|
176
167
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
168
|
+
interface ITBISimulacao {
|
|
169
|
+
valorTransacao: number;
|
|
170
|
+
valorFinanciado: number;
|
|
171
|
+
valorNaoFinanciado: number;
|
|
172
|
+
aliquotaSFH: number;
|
|
173
|
+
aliquotaPadrao: number;
|
|
174
|
+
valorITBIFinanciado: number;
|
|
175
|
+
valorITBINaoFinanciado: number;
|
|
176
|
+
valorITBITotal: number;
|
|
177
|
+
economiaSFH: number;
|
|
181
178
|
}
|
|
182
|
-
interface
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
179
|
+
interface EvaluateParams {
|
|
180
|
+
/** Numero SQL do imovel (alternativa ao endereco) */
|
|
181
|
+
sql?: string;
|
|
182
|
+
/** Nome da rua/avenida (alternativa ao SQL) */
|
|
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;
|
|
187
196
|
}
|
|
188
|
-
interface
|
|
189
|
-
/**
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
|
|
197
|
+
interface AVMEstimate {
|
|
198
|
+
/** Valor estimado em R$ */
|
|
199
|
+
valorEstimado: number;
|
|
200
|
+
/** Valor minimo do intervalo */
|
|
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;
|
|
199
210
|
}
|
|
200
|
-
interface
|
|
201
|
-
/**
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
|
|
211
|
+
interface ITBIMarketEstimate {
|
|
212
|
+
/** Valor estimado em R$ */
|
|
213
|
+
valorEstimado: number;
|
|
214
|
+
/** Valor minimo da faixa */
|
|
215
|
+
faixaMinima: number;
|
|
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;
|
|
226
|
+
}
|
|
227
|
+
interface FinalValuation {
|
|
228
|
+
/** Valor estimado final */
|
|
229
|
+
estimado: number;
|
|
230
|
+
/** Valor minimo */
|
|
231
|
+
minimo: number;
|
|
232
|
+
/** Valor maximo */
|
|
233
|
+
maximo: number;
|
|
234
|
+
/** Metodo utilizado (blend_avm_itbi, avm_only, itbi_only) */
|
|
235
|
+
metodo: string;
|
|
236
|
+
/** Peso do AVM no calculo (0-1) */
|
|
237
|
+
pesoAvm: number;
|
|
238
|
+
/** Peso do ITBI no calculo (0-1) */
|
|
239
|
+
pesoItbi: number;
|
|
240
|
+
/** Nivel de confianca */
|
|
241
|
+
confianca: number;
|
|
242
|
+
/** Nota explicativa */
|
|
243
|
+
nota?: string;
|
|
215
244
|
}
|
|
245
|
+
interface PropertyEvaluation {
|
|
246
|
+
/** Se a avaliacao foi bem sucedida */
|
|
247
|
+
success: boolean;
|
|
248
|
+
/** Dados cadastrais do imovel */
|
|
249
|
+
imovel: Record<string, unknown>;
|
|
250
|
+
/** Avaliacao pelo modelo ML (AVM) */
|
|
251
|
+
avaliacaoAvm?: AVMEstimate;
|
|
252
|
+
/** Avaliacao por transacoes ITBI reais */
|
|
253
|
+
avaliacaoItbi?: ITBIMarketEstimate;
|
|
254
|
+
/** Valor final combinado */
|
|
255
|
+
valorFinal: FinalValuation;
|
|
256
|
+
/** Imoveis comparaveis */
|
|
257
|
+
comparaveis?: Record<string, unknown>;
|
|
258
|
+
/** Metadados da avaliacao */
|
|
259
|
+
metadata: {
|
|
260
|
+
processadoEm: string;
|
|
261
|
+
fontes: string[];
|
|
262
|
+
cidade: string;
|
|
263
|
+
};
|
|
264
|
+
}
|
|
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
|
+
*/
|
|
216
274
|
declare class IPTUClient {
|
|
217
275
|
private readonly apiKey;
|
|
218
|
-
private readonly
|
|
219
|
-
private
|
|
220
|
-
private
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
constructor(apiKey: string, options?:
|
|
228
|
-
/**
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
get
|
|
232
|
-
|
|
276
|
+
private readonly config;
|
|
277
|
+
private _rateLimitInfo;
|
|
278
|
+
private _lastRequestId;
|
|
279
|
+
/**
|
|
280
|
+
* Cria uma nova instancia do cliente.
|
|
281
|
+
*
|
|
282
|
+
* @param apiKey - Chave de API para autenticacao
|
|
283
|
+
* @param options - Opcoes de configuracao
|
|
284
|
+
*/
|
|
285
|
+
constructor(apiKey: string, options?: ClientOptions);
|
|
286
|
+
/**
|
|
287
|
+
* Retorna informacoes do rate limit da ultima requisicao.
|
|
288
|
+
*/
|
|
289
|
+
get rateLimitInfo(): RateLimitInfo | null;
|
|
290
|
+
/**
|
|
291
|
+
* Retorna o ID da ultima requisicao.
|
|
292
|
+
*/
|
|
293
|
+
get lastRequestId(): string | null;
|
|
294
|
+
/**
|
|
295
|
+
* Executa uma requisicao HTTP com retry.
|
|
296
|
+
*/
|
|
297
|
+
private makeRequest;
|
|
298
|
+
/**
|
|
299
|
+
* Atualiza informacoes de rate limit a partir dos headers.
|
|
300
|
+
*/
|
|
301
|
+
private updateRateLimitInfo;
|
|
302
|
+
/**
|
|
303
|
+
* Converte resposta HTTP em excecao apropriada.
|
|
304
|
+
*/
|
|
305
|
+
private handleError;
|
|
306
|
+
/**
|
|
307
|
+
* Aguarda um tempo em milissegundos.
|
|
308
|
+
*/
|
|
233
309
|
private sleep;
|
|
234
|
-
private calculateDelay;
|
|
235
|
-
private extractRateLimit;
|
|
236
|
-
private handleErrorResponse;
|
|
237
|
-
private request;
|
|
238
310
|
/**
|
|
239
|
-
*
|
|
311
|
+
* Consulta imoveis por endereco.
|
|
240
312
|
*
|
|
241
|
-
* @param
|
|
242
|
-
* @
|
|
243
|
-
* @
|
|
244
|
-
* @
|
|
245
|
-
* @throws {AuthenticationError} Se a API Key for inválida
|
|
246
|
-
* @throws {RateLimitError} Se exceder o limite de requisições
|
|
313
|
+
* @param logradouro - Nome da rua/avenida
|
|
314
|
+
* @param numero - Numero do imovel
|
|
315
|
+
* @param cidade - Codigo da cidade (sp, bh, recife)
|
|
316
|
+
* @returns Lista de imoveis encontrados
|
|
247
317
|
*/
|
|
248
|
-
consultaEndereco(
|
|
249
|
-
consultaEndereco(logradouro: string, numero?: string, cidade?: Cidade): Promise<ConsultaEnderecoResult>;
|
|
318
|
+
consultaEndereco(logradouro: string, numero: string, cidade?: Cidade): Promise<Imovel[]>;
|
|
250
319
|
/**
|
|
251
|
-
*
|
|
320
|
+
* Consulta imovel por numero SQL/Indice Cadastral.
|
|
321
|
+
* Requer plano Starter ou superior.
|
|
252
322
|
*
|
|
253
|
-
* @param sql -
|
|
254
|
-
* @param cidade -
|
|
255
|
-
* @
|
|
256
|
-
* @returns Dados completos do imóvel
|
|
323
|
+
* @param sql - Numero SQL (SP), Indice Cadastral (BH) ou Sequencial (Recife)
|
|
324
|
+
* @param cidade - Codigo da cidade (sp, bh, recife)
|
|
325
|
+
* @returns Lista de imoveis encontrados
|
|
257
326
|
*/
|
|
258
|
-
consultaSQL(sql: string, cidade?: Cidade
|
|
259
|
-
incluirHistorico?: boolean;
|
|
260
|
-
incluirComparaveis?: boolean;
|
|
261
|
-
}): Promise<ConsultaSQLResult>;
|
|
327
|
+
consultaSQL(sql: string, cidade?: Cidade): Promise<Imovel[]>;
|
|
262
328
|
/**
|
|
263
|
-
*
|
|
329
|
+
* Consulta imoveis por CEP.
|
|
264
330
|
*
|
|
265
|
-
* @param cep - CEP do
|
|
266
|
-
* @param cidade -
|
|
267
|
-
* @returns Lista de
|
|
331
|
+
* @param cep - CEP do endereco
|
|
332
|
+
* @param cidade - Codigo da cidade (sp, bh, recife)
|
|
333
|
+
* @returns Lista de imoveis encontrados
|
|
268
334
|
*/
|
|
269
|
-
consultaCEP(cep: string, cidade?: Cidade): Promise<
|
|
335
|
+
consultaCEP(cep: string, cidade?: Cidade): Promise<Imovel[]>;
|
|
270
336
|
/**
|
|
271
337
|
* Consulta zoneamento por coordenadas.
|
|
272
338
|
*
|
|
273
339
|
* @param latitude - Latitude do ponto
|
|
274
340
|
* @param longitude - Longitude do ponto
|
|
275
|
-
* @returns
|
|
341
|
+
* @returns Informacoes de zoneamento
|
|
342
|
+
*/
|
|
343
|
+
consultaZoneamento(latitude: number, longitude: number): Promise<Zoneamento>;
|
|
344
|
+
/**
|
|
345
|
+
* Calcula estimativa de valor de mercado.
|
|
346
|
+
* Requer plano Pro ou superior.
|
|
347
|
+
*
|
|
348
|
+
* @param params - Parametros da avaliacao
|
|
349
|
+
* @returns Avaliacao de mercado
|
|
350
|
+
*/
|
|
351
|
+
valuationEstimate(params: ValuationParams): Promise<Valuation>;
|
|
352
|
+
/**
|
|
353
|
+
* Busca imoveis comparaveis.
|
|
354
|
+
* Requer plano Pro ou superior.
|
|
355
|
+
*
|
|
356
|
+
* @param params - Parametros da busca
|
|
357
|
+
* @returns Lista de imoveis comparaveis
|
|
276
358
|
*/
|
|
277
|
-
|
|
359
|
+
valuationComparables(params: ComparablesParams): Promise<Comparavel[]>;
|
|
278
360
|
/**
|
|
279
|
-
*
|
|
280
|
-
*
|
|
361
|
+
* Avalia imovel por endereco OU SQL.
|
|
362
|
+
* Combina dados do modelo AVM (ML) com transacoes ITBI reais.
|
|
363
|
+
* Requer plano Pro ou superior.
|
|
281
364
|
*
|
|
282
|
-
* @param params -
|
|
283
|
-
* @returns
|
|
284
|
-
* @throws {ForbiddenError} Se o plano não permitir
|
|
365
|
+
* @param params - Parametros da avaliacao (sql OU logradouro+numero)
|
|
366
|
+
* @returns Avaliacao completa do imovel
|
|
285
367
|
*/
|
|
286
|
-
|
|
368
|
+
valuationEvaluate(params: EvaluateParams): Promise<PropertyEvaluation>;
|
|
287
369
|
/**
|
|
288
|
-
*
|
|
289
|
-
* Disponível apenas para plano Enterprise.
|
|
370
|
+
* Consulta status de transacao ITBI.
|
|
290
371
|
*
|
|
291
|
-
* @param
|
|
292
|
-
* @
|
|
372
|
+
* @param protocolo - Numero do protocolo ITBI
|
|
373
|
+
* @param cidade - Codigo da cidade (sp, bh, recife)
|
|
374
|
+
* @returns Status da transacao
|
|
293
375
|
*/
|
|
294
|
-
|
|
376
|
+
itbiStatus(protocolo: string, cidade?: Cidade): Promise<ITBIStatus>;
|
|
295
377
|
/**
|
|
296
|
-
*
|
|
378
|
+
* Calcula valor do ITBI.
|
|
297
379
|
*
|
|
298
|
-
* @param
|
|
299
|
-
* @
|
|
300
|
-
* @param areaMax - Área máxima em m²
|
|
301
|
-
* @param options - Opções adicionais
|
|
302
|
-
* @returns Lista de imóveis comparáveis
|
|
380
|
+
* @param params - Parametros do calculo
|
|
381
|
+
* @returns Calculo do ITBI
|
|
303
382
|
*/
|
|
304
|
-
|
|
305
|
-
tipoUso?: string;
|
|
306
|
-
cidade?: Cidade;
|
|
307
|
-
limit?: number;
|
|
308
|
-
}): Promise<ComparavelItem[]>;
|
|
383
|
+
itbiCalcular(params: ITBICalculoParams): Promise<ITBICalculo>;
|
|
309
384
|
/**
|
|
310
|
-
*
|
|
385
|
+
* Consulta historico de transacoes ITBI de um imovel.
|
|
386
|
+
* Requer plano Starter ou superior.
|
|
311
387
|
*
|
|
312
|
-
* @param sql -
|
|
313
|
-
* @param cidade -
|
|
314
|
-
* @returns Lista
|
|
388
|
+
* @param sql - Numero SQL do imovel
|
|
389
|
+
* @param cidade - Codigo da cidade (sp, bh, recife)
|
|
390
|
+
* @returns Lista de transacoes historicas
|
|
315
391
|
*/
|
|
316
|
-
|
|
392
|
+
itbiHistorico(sql: string, cidade?: Cidade): Promise<ITBIHistorico[]>;
|
|
317
393
|
/**
|
|
318
|
-
* Consulta
|
|
394
|
+
* Consulta aliquotas ITBI vigentes.
|
|
319
395
|
*
|
|
320
|
-
* @param
|
|
321
|
-
* @returns
|
|
396
|
+
* @param cidade - Codigo da cidade (sp, bh, recife)
|
|
397
|
+
* @returns Aliquotas vigentes
|
|
322
398
|
*/
|
|
323
|
-
|
|
399
|
+
itbiAliquotas(cidade?: Cidade): Promise<ITBIAliquota>;
|
|
324
400
|
/**
|
|
325
|
-
*
|
|
401
|
+
* Consulta isencoes ITBI disponiveis.
|
|
326
402
|
*
|
|
327
|
-
* @param
|
|
328
|
-
* @
|
|
329
|
-
* @param dataDestino - Data destino (default: atual)
|
|
330
|
-
* @returns Valor corrigido e fator de correção
|
|
403
|
+
* @param cidade - Codigo da cidade (sp, bh, recife)
|
|
404
|
+
* @returns Lista de isencoes disponiveis
|
|
331
405
|
*/
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
406
|
+
itbiIsencoes(cidade?: Cidade): Promise<ITBIIsencao[]>;
|
|
407
|
+
/**
|
|
408
|
+
* Gera guia de pagamento ITBI.
|
|
409
|
+
* Requer plano Starter ou superior.
|
|
410
|
+
*
|
|
411
|
+
* @param params - Parametros da guia
|
|
412
|
+
* @returns Guia de pagamento gerada
|
|
413
|
+
*/
|
|
414
|
+
itbiGuia(params: ITBIGuiaParams): Promise<ITBIGuia>;
|
|
415
|
+
/**
|
|
416
|
+
* Valida autenticidade de uma guia ITBI.
|
|
417
|
+
*
|
|
418
|
+
* @param protocolo - Numero do protocolo da guia
|
|
419
|
+
* @param cidade - Codigo da cidade (sp, bh, recife)
|
|
420
|
+
* @returns Resultado da validacao
|
|
421
|
+
*/
|
|
422
|
+
itbiValidarGuia(protocolo: string, cidade?: Cidade): Promise<ITBIValidacao>;
|
|
423
|
+
/**
|
|
424
|
+
* Simula calculo de ITBI.
|
|
425
|
+
*
|
|
426
|
+
* @param params - Parametros da simulacao
|
|
427
|
+
* @returns Resultado da simulacao
|
|
428
|
+
*/
|
|
429
|
+
itbiSimular(params: ITBISimularParams): Promise<ITBISimulacao>;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Excecoes customizadas para a IPTU API.
|
|
434
|
+
*/
|
|
435
|
+
interface ErrorDetails {
|
|
436
|
+
error: string;
|
|
437
|
+
message: string;
|
|
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;
|
|
336
516
|
}
|
|
337
517
|
|
|
338
|
-
export { AuthenticationError, type
|
|
518
|
+
export { type AVMEstimate, AuthenticationError, type Cidade, type ClientConfig, type ClientOptions, type ComparablesParams, type Comparavel, type EvaluateParams, type FinalValuation, ForbiddenError, IPTUAPIError, IPTUClient, type ITBIAliquota, type ITBICalculo, type ITBICalculoParams, type ITBIGuia, type ITBIGuiaParams, type ITBIHistorico, type ITBIIsencao, type ITBIMarketEstimate, type ITBISimulacao, type ITBISimularParams, type ITBIStatus, type ITBIValidacao, type Imovel, NetworkError, NotFoundError, type Pessoa, type PropertyEvaluation, RateLimitError, type RateLimitInfo, type RetryConfig, ServerError, TimeoutError, ValidationError, type Valuation, type ValuationParams, type Zoneamento };
|