@kite-sa/sdk 0.6.0 → 0.9.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/CHANGELOG.md +64 -0
- package/README.md +43 -1
- package/dist/generated.d.ts +477 -6
- package/dist/generated.js +94 -3
- package/dist/index.d.ts +27 -3
- package/dist/index.js +49 -18
- package/dist/openapi-zod/client.d.ts +678 -4
- package/dist/openapi-zod/client.js +440 -0
- package/dist/openapi-zod/models.d.ts +172 -2
- package/dist/openapi-zod/models.js +7 -0
- package/dist/openapi.d.ts +176 -7
- package/dist/paginate.d.ts +25 -0
- package/dist/paginate.js +15 -0
- package/dist/webhooks.d.ts +57 -0
- package/dist/webhooks.js +106 -0
- package/package.json +5 -1
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
export interface AggregateLayerExportFilters {
|
|
2
|
+
city?: string[];
|
|
3
|
+
}
|
|
1
4
|
export type CoverageFlag = "full" | "notary_only" | "incomplete";
|
|
2
5
|
export declare const CoverageFlagValues: readonly ["full", "notary_only", "incomplete"];
|
|
6
|
+
export type DealSource = "moj_open_data" | "moj_notary" | "real_estate_registry";
|
|
7
|
+
export declare const DealSourceValues: readonly ["moj_open_data", "moj_notary", "real_estate_registry"];
|
|
3
8
|
export interface Error {
|
|
4
9
|
error: {
|
|
5
10
|
type: "invalid_request" | "authentication_error" | "permission_error" | "not_found" | "method_not_allowed" | "conflict" | "rate_limit_error" | "api_error";
|
|
@@ -13,7 +18,7 @@ export interface Error {
|
|
|
13
18
|
}
|
|
14
19
|
export interface Export {
|
|
15
20
|
id: string;
|
|
16
|
-
dataset: "listings" | "listing_changes" | "registered_transactions" | "registered_rents";
|
|
21
|
+
dataset: "listings" | "listing_changes" | "registered_transactions" | "registered_rents" | "aggregate_layers";
|
|
17
22
|
format: "ndjson" | "csv";
|
|
18
23
|
compression: "gzip" | "none";
|
|
19
24
|
status: "queued" | "running" | "completed" | "failed" | "expired";
|
|
@@ -67,6 +72,9 @@ export type ExportRequest = {
|
|
|
67
72
|
filters?: RentExportFilters;
|
|
68
73
|
format?: "ndjson" | "csv";
|
|
69
74
|
compression?: "gzip" | "none";
|
|
75
|
+
} | {
|
|
76
|
+
dataset: "aggregate_layers";
|
|
77
|
+
filters?: AggregateLayerExportFilters;
|
|
70
78
|
};
|
|
71
79
|
export interface Listing {
|
|
72
80
|
id: number;
|
|
@@ -120,12 +128,21 @@ export interface Listing {
|
|
|
120
128
|
lng: number | null;
|
|
121
129
|
street_width_m: number | null;
|
|
122
130
|
};
|
|
131
|
+
plot: ListingPlot | null;
|
|
123
132
|
compound_name: string | null;
|
|
124
133
|
project_id: number | null;
|
|
125
134
|
images: string[];
|
|
126
135
|
image_count: number;
|
|
127
136
|
advertiser: {
|
|
128
137
|
type: string | null;
|
|
138
|
+
name: string | null;
|
|
139
|
+
name_en: string | null;
|
|
140
|
+
company: string | null;
|
|
141
|
+
logo: string | null;
|
|
142
|
+
fal_number: string | null;
|
|
143
|
+
cr: string | null;
|
|
144
|
+
ad_license: string | null;
|
|
145
|
+
contact_available: boolean;
|
|
129
146
|
};
|
|
130
147
|
verified_by_source: boolean | null;
|
|
131
148
|
source: {
|
|
@@ -173,6 +190,53 @@ export interface ListingExportFilters {
|
|
|
173
190
|
furnished?: boolean;
|
|
174
191
|
updated_since?: string;
|
|
175
192
|
}
|
|
193
|
+
export interface ListingPlot {
|
|
194
|
+
zoning: "residential" | "commercial" | "mixed" | "industrial" | "agricultural" | "public" | "other" | null;
|
|
195
|
+
is_corner: boolean | null;
|
|
196
|
+
frontage_count: number | null;
|
|
197
|
+
facing: "north" | "east" | "south" | "west"[];
|
|
198
|
+
street_width_m: number | null;
|
|
199
|
+
street_width_source: "official" | "measured" | null;
|
|
200
|
+
plot_area_sqm: number | null;
|
|
201
|
+
buildable_area_sqm: number | null;
|
|
202
|
+
buildable_far: number | null;
|
|
203
|
+
price_per_buildable_sqm_sar: number | null;
|
|
204
|
+
urban_growth_phase: string | null;
|
|
205
|
+
urban_growth_year: number | null;
|
|
206
|
+
white_land_fee: {
|
|
207
|
+
band: number | null;
|
|
208
|
+
rate_pct: number | null;
|
|
209
|
+
as_of: string | null;
|
|
210
|
+
} | null;
|
|
211
|
+
last_registered_sale: {
|
|
212
|
+
month: string;
|
|
213
|
+
price_sar: number;
|
|
214
|
+
price_per_sqm_sar: number | null;
|
|
215
|
+
area_sqm: number | null;
|
|
216
|
+
registry: "MOJ" | "Real Estate Registry";
|
|
217
|
+
areas_agree: boolean | null;
|
|
218
|
+
ask_to_last_sale_ratio: number | null;
|
|
219
|
+
months_since: number;
|
|
220
|
+
} | null;
|
|
221
|
+
registered_sale_while_listed: {
|
|
222
|
+
month: string;
|
|
223
|
+
price_sar: number;
|
|
224
|
+
registry: "MOJ" | "Real Estate Registry";
|
|
225
|
+
ask_at_sale_sar: number | null;
|
|
226
|
+
areas_agree: boolean;
|
|
227
|
+
deal_to_ask_ratio: number | null;
|
|
228
|
+
weeks_to_sell: number | null;
|
|
229
|
+
} | null;
|
|
230
|
+
registered_sales_count: number;
|
|
231
|
+
match: {
|
|
232
|
+
method: "plan_parcel_and_pin" | "plan_parcel_and_district";
|
|
233
|
+
confidence: number;
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
export type NeighborhoodTown = {
|
|
237
|
+
name_en: string;
|
|
238
|
+
name_ar: string;
|
|
239
|
+
} | null;
|
|
176
240
|
export interface Pagination {
|
|
177
241
|
limit: number;
|
|
178
242
|
next_cursor: string | null;
|
|
@@ -188,17 +252,21 @@ export interface RentExportFilters {
|
|
|
188
252
|
export interface Transaction {
|
|
189
253
|
id: string;
|
|
190
254
|
month: string;
|
|
191
|
-
|
|
255
|
+
source: DealSource;
|
|
256
|
+
source_quarter: string | null;
|
|
192
257
|
city: string;
|
|
193
258
|
city_name_ar: string | null;
|
|
194
259
|
district_name_ar: string | null;
|
|
195
260
|
neighborhood: TransactionNeighborhood | null;
|
|
196
261
|
land_use: "residential" | "commercial" | "agricultural" | "industrial" | "mixed_use" | "other";
|
|
197
262
|
land_use_ar: string | null;
|
|
263
|
+
land_use_basis: "moj_class" | "zoning";
|
|
264
|
+
property_type: "vacant_land" | "agricultural_land" | "apartment" | "floor" | "villa" | "house" | "residential_building" | "mixed_use_building" | "commercial" | "other" | null;
|
|
198
265
|
area_sqm: number | null;
|
|
199
266
|
price_sar: number;
|
|
200
267
|
price_per_sqm_sar: number | null;
|
|
201
268
|
property_count: number | null;
|
|
269
|
+
token_price: boolean;
|
|
202
270
|
}
|
|
203
271
|
export interface TransactionAttribution {
|
|
204
272
|
notice: string;
|
|
@@ -220,6 +288,12 @@ export interface TransactionAttribution {
|
|
|
220
288
|
url: string;
|
|
221
289
|
}[];
|
|
222
290
|
modifications: string;
|
|
291
|
+
other_sources: {
|
|
292
|
+
source: "moj_notary" | "real_estate_registry";
|
|
293
|
+
publisher: string;
|
|
294
|
+
title_en: string;
|
|
295
|
+
note: string;
|
|
296
|
+
}[];
|
|
223
297
|
}
|
|
224
298
|
export interface TransactionCoverage {
|
|
225
299
|
city: string;
|
|
@@ -228,12 +302,15 @@ export interface TransactionCoverage {
|
|
|
228
302
|
latest_quarter: string | null;
|
|
229
303
|
complete_through_quarter: string | null;
|
|
230
304
|
notary_only_from_quarter: string | null;
|
|
305
|
+
registry_sample_from_quarter: string | null;
|
|
231
306
|
excluded_quarters: {
|
|
232
307
|
quarter: string;
|
|
233
308
|
reason: string;
|
|
234
309
|
}[];
|
|
235
310
|
notes: string[];
|
|
236
311
|
}
|
|
312
|
+
export type TransactionCoverageFlag = "full" | "notary_only" | "incomplete" | "registry_sample";
|
|
313
|
+
export declare const TransactionCoverageFlagValues: readonly ["full", "notary_only", "incomplete", "registry_sample"];
|
|
237
314
|
export interface TransactionExportFilters {
|
|
238
315
|
city?: string[];
|
|
239
316
|
land_use?: "residential" | "commercial" | "agricultural" | "industrial" | "mixed_use" | "other"[];
|
|
@@ -244,4 +321,97 @@ export interface TransactionNeighborhood {
|
|
|
244
321
|
id: number;
|
|
245
322
|
name_ar: string;
|
|
246
323
|
name_en: string;
|
|
324
|
+
town: NeighborhoodTown;
|
|
325
|
+
}
|
|
326
|
+
export interface WebhookListingCreatedEvent {
|
|
327
|
+
id: string;
|
|
328
|
+
type: "listing.created";
|
|
329
|
+
created: string;
|
|
330
|
+
data: WebhookListingData;
|
|
331
|
+
test?: true;
|
|
332
|
+
}
|
|
333
|
+
export interface WebhookListingData {
|
|
334
|
+
listing_id: number;
|
|
335
|
+
city: string | null;
|
|
336
|
+
neighborhood_en: string | null;
|
|
337
|
+
neighborhood_ar: string | null;
|
|
338
|
+
listing_type: string | null;
|
|
339
|
+
listing_category: string | null;
|
|
340
|
+
property_type: string | null;
|
|
341
|
+
price_yearly_sar: number | null;
|
|
342
|
+
price_as_posted_sar: number | null;
|
|
343
|
+
rent_frequency: string | null;
|
|
344
|
+
bedrooms: number | null;
|
|
345
|
+
bathrooms: number | null;
|
|
346
|
+
area_sqm: number | null;
|
|
347
|
+
lat: number | null;
|
|
348
|
+
lng: number | null;
|
|
349
|
+
url: string;
|
|
350
|
+
}
|
|
351
|
+
export interface WebhookListingDelistedEvent {
|
|
352
|
+
id: string;
|
|
353
|
+
type: "listing.delisted";
|
|
354
|
+
created: string;
|
|
355
|
+
data: WebhookListingData;
|
|
356
|
+
test?: true;
|
|
357
|
+
}
|
|
358
|
+
export interface WebhookListingPriceChangedEvent {
|
|
359
|
+
id: string;
|
|
360
|
+
type: "listing.price_changed";
|
|
361
|
+
created: string;
|
|
362
|
+
data: WebhookPriceChangedListingData;
|
|
363
|
+
test?: true;
|
|
364
|
+
}
|
|
365
|
+
export interface WebhookListingRelistedEvent {
|
|
366
|
+
id: string;
|
|
367
|
+
type: "listing.relisted";
|
|
368
|
+
created: string;
|
|
369
|
+
data: WebhookListingData;
|
|
370
|
+
test?: true;
|
|
371
|
+
}
|
|
372
|
+
export interface WebhookListingUpdatedEvent {
|
|
373
|
+
id: string;
|
|
374
|
+
type: "listing.updated";
|
|
375
|
+
created: string;
|
|
376
|
+
data: WebhookUpdatedListingData;
|
|
377
|
+
test?: true;
|
|
378
|
+
}
|
|
379
|
+
export interface WebhookPriceChangedListingData {
|
|
380
|
+
listing_id: number;
|
|
381
|
+
city: string | null;
|
|
382
|
+
neighborhood_en: string | null;
|
|
383
|
+
neighborhood_ar: string | null;
|
|
384
|
+
listing_type: string | null;
|
|
385
|
+
listing_category: string | null;
|
|
386
|
+
property_type: string | null;
|
|
387
|
+
price_yearly_sar: number | null;
|
|
388
|
+
price_as_posted_sar: number | null;
|
|
389
|
+
rent_frequency: string | null;
|
|
390
|
+
bedrooms: number | null;
|
|
391
|
+
bathrooms: number | null;
|
|
392
|
+
area_sqm: number | null;
|
|
393
|
+
lat: number | null;
|
|
394
|
+
lng: number | null;
|
|
395
|
+
url: string;
|
|
396
|
+
previous_price_yearly_sar: number | null;
|
|
397
|
+
}
|
|
398
|
+
export interface WebhookUpdatedListingData {
|
|
399
|
+
listing_id: number;
|
|
400
|
+
city: string | null;
|
|
401
|
+
neighborhood_en: string | null;
|
|
402
|
+
neighborhood_ar: string | null;
|
|
403
|
+
listing_type: string | null;
|
|
404
|
+
listing_category: string | null;
|
|
405
|
+
property_type: string | null;
|
|
406
|
+
price_yearly_sar: number | null;
|
|
407
|
+
price_as_posted_sar: number | null;
|
|
408
|
+
rent_frequency: string | null;
|
|
409
|
+
bedrooms: number | null;
|
|
410
|
+
bathrooms: number | null;
|
|
411
|
+
area_sqm: number | null;
|
|
412
|
+
lat: number | null;
|
|
413
|
+
lng: number | null;
|
|
414
|
+
url: string;
|
|
415
|
+
changed_fields: string[];
|
|
416
|
+
previous_attributes: Record<string, unknown>;
|
|
247
417
|
}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
// This file is auto-generated by openapi-zod-ts - do not edit
|
|
2
2
|
export const CoverageFlagValues = ["full", "notary_only", "incomplete"];
|
|
3
|
+
export const DealSourceValues = ["moj_open_data", "moj_notary", "real_estate_registry"];
|
|
4
|
+
export const TransactionCoverageFlagValues = [
|
|
5
|
+
"full",
|
|
6
|
+
"notary_only",
|
|
7
|
+
"incomplete",
|
|
8
|
+
"registry_sample",
|
|
9
|
+
];
|
package/dist/openapi.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ export interface operations {
|
|
|
70
70
|
};
|
|
71
71
|
"listings.search": {
|
|
72
72
|
parameters: {
|
|
73
|
-
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").listingsSearch>[0]>>, "city" | "listing_type" | "listing_category" | "property_type" | "neighborhood_id" | "beds" | "beds_min" | "beds_max" | "bathrooms_min" | "price_min" | "price_max" | "area_min" | "area_max" | "furnished" | "source" | "bbox" | "updated_since" | "bathrooms" | "bathrooms_max" | "livings_min" | "neighborhood_id_exclude" | "q" | "amenities" | "amenities_exclude" | "photo_features" | "floor" | "source_exclude" | "max_age" | "verified" | "advertiser_type" | "compound" | "in_compound" | "rent_frequency" | "days_on_market_min" | "days_on_market_max" | "sort" | "limit" | "cursor">;
|
|
73
|
+
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").listingsSearch>[0]>>, "city" | "listing_type" | "listing_category" | "property_type" | "neighborhood_id" | "beds" | "beds_min" | "beds_max" | "bathrooms_min" | "price_min" | "price_max" | "area_min" | "area_max" | "furnished" | "source" | "bbox" | "updated_since" | "bathrooms" | "bathrooms_max" | "livings_min" | "neighborhood_id_exclude" | "q" | "amenities" | "amenities_exclude" | "photo_features" | "floor" | "source_exclude" | "max_age" | "verified" | "advertiser_type" | "compound" | "in_compound" | "rent_frequency" | "days_on_market_min" | "days_on_market_max" | "zoning" | "corner" | "street_width_min" | "white_land_fee" | "last_sale_within_months" | "ask_to_last_sale_max" | "plot_sold" | "sort" | "limit" | "cursor" | "updated_after_id">;
|
|
74
74
|
};
|
|
75
75
|
responses: {
|
|
76
76
|
200: {
|
|
@@ -82,7 +82,7 @@ export interface operations {
|
|
|
82
82
|
};
|
|
83
83
|
"listings.count": {
|
|
84
84
|
parameters: {
|
|
85
|
-
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").listingsCount>[0]>>, "city" | "listing_type" | "listing_category" | "property_type" | "neighborhood_id" | "beds" | "beds_min" | "beds_max" | "bathrooms_min" | "price_min" | "price_max" | "area_min" | "area_max" | "furnished" | "source" | "bbox" | "updated_since" | "bathrooms" | "bathrooms_max" | "livings_min" | "neighborhood_id_exclude" | "q" | "amenities" | "amenities_exclude" | "photo_features" | "floor" | "source_exclude" | "max_age" | "verified" | "advertiser_type" | "compound" | "in_compound" | "rent_frequency" | "days_on_market_min" | "days_on_market_max">;
|
|
85
|
+
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").listingsCount>[0]>>, "city" | "listing_type" | "listing_category" | "property_type" | "neighborhood_id" | "beds" | "beds_min" | "beds_max" | "bathrooms_min" | "price_min" | "price_max" | "area_min" | "area_max" | "furnished" | "source" | "bbox" | "updated_since" | "bathrooms" | "bathrooms_max" | "livings_min" | "neighborhood_id_exclude" | "q" | "amenities" | "amenities_exclude" | "photo_features" | "floor" | "source_exclude" | "max_age" | "verified" | "advertiser_type" | "compound" | "in_compound" | "rent_frequency" | "days_on_market_min" | "days_on_market_max" | "zoning" | "corner" | "street_width_min" | "white_land_fee" | "last_sale_within_months" | "ask_to_last_sale_max" | "plot_sold">;
|
|
86
86
|
};
|
|
87
87
|
responses: {
|
|
88
88
|
200: {
|
|
@@ -124,6 +124,16 @@ export interface operations {
|
|
|
124
124
|
};
|
|
125
125
|
};
|
|
126
126
|
};
|
|
127
|
+
"listings.contact": {
|
|
128
|
+
parameters: Record<never, never>;
|
|
129
|
+
responses: {
|
|
130
|
+
200: {
|
|
131
|
+
content: {
|
|
132
|
+
"application/json": Awaited<ReturnType<typeof import("./openapi-zod/client.js").listingsContact>>;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
};
|
|
127
137
|
"market.summary": {
|
|
128
138
|
parameters: {
|
|
129
139
|
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").marketSummary>[0]>>, "city" | "listing_type" | "listing_category" | "property_type" | "beds" | "neighborhood_id">;
|
|
@@ -208,6 +218,42 @@ export interface operations {
|
|
|
208
218
|
};
|
|
209
219
|
};
|
|
210
220
|
};
|
|
221
|
+
"market.land_resale": {
|
|
222
|
+
parameters: {
|
|
223
|
+
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").marketLandResale>[0]>>, "city" | "neighborhood_id" | "group_by" | "kind" | "min_sample_size">;
|
|
224
|
+
};
|
|
225
|
+
responses: {
|
|
226
|
+
200: {
|
|
227
|
+
content: {
|
|
228
|
+
"application/json": Awaited<ReturnType<typeof import("./openapi-zod/client.js").marketLandResale>>;
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
"market.ask_to_deal": {
|
|
234
|
+
parameters: {
|
|
235
|
+
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").marketAskToDeal>[0]>>, "city" | "neighborhood_id" | "group_by" | "kind" | "min_sample_size">;
|
|
236
|
+
};
|
|
237
|
+
responses: {
|
|
238
|
+
200: {
|
|
239
|
+
content: {
|
|
240
|
+
"application/json": Awaited<ReturnType<typeof import("./openapi-zod/client.js").marketAskToDeal>>;
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
"market.area_context": {
|
|
246
|
+
parameters: {
|
|
247
|
+
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").marketAreaContext>[0]>>, "lat" | "lng" | "radius_m" | "city" | "neighborhood_id">;
|
|
248
|
+
};
|
|
249
|
+
responses: {
|
|
250
|
+
200: {
|
|
251
|
+
content: {
|
|
252
|
+
"application/json": Awaited<ReturnType<typeof import("./openapi-zod/client.js").marketAreaContext>>;
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
};
|
|
211
257
|
"official.registered_rents": {
|
|
212
258
|
parameters: {
|
|
213
259
|
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").officialRegisteredRents>[0]>>, "city" | "neighborhood_id" | "property_type" | "period" | "min_sample_size">;
|
|
@@ -324,9 +370,33 @@ export interface operations {
|
|
|
324
370
|
};
|
|
325
371
|
};
|
|
326
372
|
};
|
|
373
|
+
"analytics.advertisers": {
|
|
374
|
+
parameters: {
|
|
375
|
+
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").analyticsAdvertisers>[0]>>, "city" | "listing_type" | "listing_category" | "property_type" | "neighborhood_id" | "beds" | "beds_min" | "beds_max" | "bathrooms_min" | "price_min" | "price_max" | "area_min" | "area_max" | "furnished" | "source" | "bbox" | "updated_since" | "bathrooms" | "bathrooms_max" | "livings_min" | "neighborhood_id_exclude" | "q" | "amenities" | "amenities_exclude" | "photo_features" | "floor" | "source_exclude" | "max_age" | "verified" | "advertiser_type" | "compound" | "in_compound" | "rent_frequency" | "days_on_market_min" | "days_on_market_max" | "zoning" | "corner" | "street_width_min" | "white_land_fee" | "last_sale_within_months" | "ask_to_last_sale_max" | "plot_sold" | "above_median_pct" | "min_listings" | "sort" | "limit" | "cursor">;
|
|
376
|
+
};
|
|
377
|
+
responses: {
|
|
378
|
+
200: {
|
|
379
|
+
content: {
|
|
380
|
+
"application/json": Awaited<ReturnType<typeof import("./openapi-zod/client.js").analyticsAdvertisers>>;
|
|
381
|
+
};
|
|
382
|
+
};
|
|
383
|
+
};
|
|
384
|
+
};
|
|
385
|
+
"valuations.asking_range": {
|
|
386
|
+
parameters: {
|
|
387
|
+
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").valuationsAskingRange>[0]>>, "city" | "neighborhood_id" | "lat" | "lng" | "property_type" | "listing_type" | "bedrooms" | "area_sqm" | "furnished" | "age_years" | "floor" | "claimed_price">;
|
|
388
|
+
};
|
|
389
|
+
responses: {
|
|
390
|
+
200: {
|
|
391
|
+
content: {
|
|
392
|
+
"application/json": Awaited<ReturnType<typeof import("./openapi-zod/client.js").valuationsAskingRange>>;
|
|
393
|
+
};
|
|
394
|
+
};
|
|
395
|
+
};
|
|
396
|
+
};
|
|
327
397
|
"transactions.search": {
|
|
328
398
|
parameters: {
|
|
329
|
-
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").transactionsSearch>[0]>>, "city" | "neighborhood_id" | "land_use" | "month_from" | "month_to" | "price_min" | "price_max" | "area_min" | "area_max" | "price_per_sqm_min" | "price_per_sqm_max" | "sort" | "limit" | "cursor">;
|
|
399
|
+
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").transactionsSearch>[0]>>, "city" | "neighborhood_id" | "land_use" | "source" | "property_type" | "market_sales_only" | "month_from" | "month_to" | "price_min" | "price_max" | "area_min" | "area_max" | "price_per_sqm_min" | "price_per_sqm_max" | "sort" | "limit" | "cursor">;
|
|
330
400
|
};
|
|
331
401
|
responses: {
|
|
332
402
|
200: {
|
|
@@ -338,7 +408,7 @@ export interface operations {
|
|
|
338
408
|
};
|
|
339
409
|
"market.transactions": {
|
|
340
410
|
parameters: {
|
|
341
|
-
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").marketTransactions>[0]>>, "city" | "neighborhood_id" | "group_by" | "land_use" | "quarter_from" | "quarter_to" | "min_sample_size">;
|
|
411
|
+
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").marketTransactions>[0]>>, "city" | "neighborhood_id" | "group_by" | "land_use" | "property_type" | "quarter_from" | "quarter_to" | "min_sample_size" | "include_token_prices">;
|
|
342
412
|
};
|
|
343
413
|
responses: {
|
|
344
414
|
200: {
|
|
@@ -350,7 +420,7 @@ export interface operations {
|
|
|
350
420
|
};
|
|
351
421
|
"market.land_prices": {
|
|
352
422
|
parameters: {
|
|
353
|
-
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").marketLandPrices>[0]>>, "city" | "neighborhood_id" | "group_by" | "land_use" | "quarter_from" | "quarter_to" | "min_sample_size">;
|
|
423
|
+
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").marketLandPrices>[0]>>, "city" | "neighborhood_id" | "group_by" | "land_use" | "quarter_from" | "quarter_to" | "min_sample_size" | "include_token_prices">;
|
|
354
424
|
};
|
|
355
425
|
responses: {
|
|
356
426
|
200: {
|
|
@@ -362,7 +432,7 @@ export interface operations {
|
|
|
362
432
|
};
|
|
363
433
|
"projects.search": {
|
|
364
434
|
parameters: {
|
|
365
|
-
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").projectsSearch>[0]>>, "city" | "neighborhood_id" | "developer" | "status" | "project_type" | "listing_category" | "features" | "banks" | "q" | "price_min" | "price_max" | "sort" | "limit" | "cursor">;
|
|
435
|
+
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").projectsSearch>[0]>>, "city" | "neighborhood_id" | "developer" | "status" | "project_type" | "listing_category" | "features" | "banks" | "q" | "price_min" | "price_max" | "handover_from" | "handover_to" | "licensed" | "sort" | "limit" | "cursor">;
|
|
366
436
|
};
|
|
367
437
|
responses: {
|
|
368
438
|
200: {
|
|
@@ -394,6 +464,18 @@ export interface operations {
|
|
|
394
464
|
};
|
|
395
465
|
};
|
|
396
466
|
};
|
|
467
|
+
"projects.availability": {
|
|
468
|
+
parameters: {
|
|
469
|
+
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").projectsAvailability>[1]>>, "interval" | "from" | "to" | "unit_type">;
|
|
470
|
+
};
|
|
471
|
+
responses: {
|
|
472
|
+
200: {
|
|
473
|
+
content: {
|
|
474
|
+
"application/json": Awaited<ReturnType<typeof import("./openapi-zod/client.js").projectsAvailability>>;
|
|
475
|
+
};
|
|
476
|
+
};
|
|
477
|
+
};
|
|
478
|
+
};
|
|
397
479
|
"projects.units_search": {
|
|
398
480
|
parameters: {
|
|
399
481
|
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").projectsUnitsSearch>[0]>>, "city" | "neighborhood_id" | "developer" | "status" | "project_type" | "listing_category" | "features" | "banks" | "listing_type" | "property_type" | "bedrooms" | "bedrooms_min" | "bedrooms_max" | "bathrooms" | "bathrooms_min" | "price_min" | "price_max" | "area_min" | "area_max" | "sort" | "limit" | "cursor">;
|
|
@@ -418,6 +500,30 @@ export interface operations {
|
|
|
418
500
|
};
|
|
419
501
|
};
|
|
420
502
|
};
|
|
503
|
+
"projects.absorption": {
|
|
504
|
+
parameters: {
|
|
505
|
+
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").projectsAbsorption>[1]>>, "listing_type" | "from" | "to">;
|
|
506
|
+
};
|
|
507
|
+
responses: {
|
|
508
|
+
200: {
|
|
509
|
+
content: {
|
|
510
|
+
"application/json": Awaited<ReturnType<typeof import("./openapi-zod/client.js").projectsAbsorption>>;
|
|
511
|
+
};
|
|
512
|
+
};
|
|
513
|
+
};
|
|
514
|
+
};
|
|
515
|
+
"market.absorption": {
|
|
516
|
+
parameters: {
|
|
517
|
+
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").marketAbsorption>[0]>>, "city" | "neighborhood_id" | "developer" | "property_type" | "project_type" | "listing_type" | "group_by" | "from" | "to" | "min_sample_size">;
|
|
518
|
+
};
|
|
519
|
+
responses: {
|
|
520
|
+
200: {
|
|
521
|
+
content: {
|
|
522
|
+
"application/json": Awaited<ReturnType<typeof import("./openapi-zod/client.js").marketAbsorption>>;
|
|
523
|
+
};
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
};
|
|
421
527
|
"exports.create": {
|
|
422
528
|
parameters: {
|
|
423
529
|
header?: Pick<HeaderKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").exportsCreate>[1]>>, "Idempotency-Key">;
|
|
@@ -589,6 +695,52 @@ export interface operations {
|
|
|
589
695
|
};
|
|
590
696
|
};
|
|
591
697
|
};
|
|
698
|
+
"organization.webhooks.update": {
|
|
699
|
+
parameters: {
|
|
700
|
+
header?: Pick<HeaderKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").organizationWebhooksUpdate>[2]>>, "Idempotency-Key">;
|
|
701
|
+
};
|
|
702
|
+
requestBody: {
|
|
703
|
+
content: {
|
|
704
|
+
"application/json": Parameters<typeof import("./openapi-zod/client.js").organizationWebhooksUpdate>[1];
|
|
705
|
+
};
|
|
706
|
+
};
|
|
707
|
+
responses: {
|
|
708
|
+
200: {
|
|
709
|
+
content: {
|
|
710
|
+
"application/json": Awaited<ReturnType<typeof import("./openapi-zod/client.js").organizationWebhooksUpdate>>;
|
|
711
|
+
};
|
|
712
|
+
};
|
|
713
|
+
};
|
|
714
|
+
};
|
|
715
|
+
"organization.webhooks.enable": {
|
|
716
|
+
parameters: {
|
|
717
|
+
header?: Pick<HeaderKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").organizationWebhooksEnable>[1]>>, "Idempotency-Key">;
|
|
718
|
+
};
|
|
719
|
+
responses: {
|
|
720
|
+
200: {
|
|
721
|
+
content: {
|
|
722
|
+
"application/json": Awaited<ReturnType<typeof import("./openapi-zod/client.js").organizationWebhooksEnable>>;
|
|
723
|
+
};
|
|
724
|
+
};
|
|
725
|
+
};
|
|
726
|
+
};
|
|
727
|
+
"organization.webhooks.rotate_secret": {
|
|
728
|
+
parameters: {
|
|
729
|
+
header?: Pick<HeaderKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").organizationWebhooksRotateSecret>[2]>>, "Idempotency-Key">;
|
|
730
|
+
};
|
|
731
|
+
requestBody: {
|
|
732
|
+
content: {
|
|
733
|
+
"application/json": Parameters<typeof import("./openapi-zod/client.js").organizationWebhooksRotateSecret>[1];
|
|
734
|
+
};
|
|
735
|
+
};
|
|
736
|
+
responses: {
|
|
737
|
+
200: {
|
|
738
|
+
content: {
|
|
739
|
+
"application/json": Awaited<ReturnType<typeof import("./openapi-zod/client.js").organizationWebhooksRotateSecret>>;
|
|
740
|
+
};
|
|
741
|
+
};
|
|
742
|
+
};
|
|
743
|
+
};
|
|
592
744
|
"organization.webhooks.delete": {
|
|
593
745
|
parameters: {
|
|
594
746
|
header?: Pick<HeaderKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").organizationWebhooksDelete>[1]>>, "Idempotency-Key">;
|
|
@@ -603,7 +755,7 @@ export interface operations {
|
|
|
603
755
|
};
|
|
604
756
|
"organization.webhooks.deliveries": {
|
|
605
757
|
parameters: {
|
|
606
|
-
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").organizationWebhooksDeliveries>[1]>>, "limit">;
|
|
758
|
+
query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").organizationWebhooksDeliveries>[1]>>, "limit" | "cursor">;
|
|
607
759
|
};
|
|
608
760
|
responses: {
|
|
609
761
|
200: {
|
|
@@ -625,5 +777,22 @@ export interface operations {
|
|
|
625
777
|
};
|
|
626
778
|
};
|
|
627
779
|
};
|
|
780
|
+
"organization.webhooks.test": {
|
|
781
|
+
parameters: {
|
|
782
|
+
header?: Pick<HeaderKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").organizationWebhooksTest>[2]>>, "Idempotency-Key">;
|
|
783
|
+
};
|
|
784
|
+
requestBody: {
|
|
785
|
+
content: {
|
|
786
|
+
"application/json": Parameters<typeof import("./openapi-zod/client.js").organizationWebhooksTest>[1];
|
|
787
|
+
};
|
|
788
|
+
};
|
|
789
|
+
responses: {
|
|
790
|
+
200: {
|
|
791
|
+
content: {
|
|
792
|
+
"application/json": Awaited<ReturnType<typeof import("./openapi-zod/client.js").organizationWebhooksTest>>;
|
|
793
|
+
};
|
|
794
|
+
};
|
|
795
|
+
};
|
|
796
|
+
};
|
|
628
797
|
}
|
|
629
798
|
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** The standard array-shaped list response. */
|
|
2
|
+
export interface Page<T> {
|
|
3
|
+
data: T[];
|
|
4
|
+
pagination: {
|
|
5
|
+
has_more: boolean;
|
|
6
|
+
next_cursor?: string | null;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
/** Advertiser pages carry market totals alongside their advertiser rows. */
|
|
10
|
+
export type CursorPage<T> = Page<T> | {
|
|
11
|
+
data: {
|
|
12
|
+
advertisers: T[];
|
|
13
|
+
};
|
|
14
|
+
pagination: Page<T>["pagination"];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Yields every item of a cursor-paginated endpoint, fetching the next page only
|
|
18
|
+
* when the previous one is consumed. `fetchPage` receives `params` plus the
|
|
19
|
+
* cursor, so path arguments go in a closure:
|
|
20
|
+
*
|
|
21
|
+
* paginate((p) => kite.projects.units(42, p), { beds: 2 })
|
|
22
|
+
*/
|
|
23
|
+
export declare function paginate<const P extends object, T>(fetchPage: (params: P & {
|
|
24
|
+
cursor?: string;
|
|
25
|
+
}) => Promise<CursorPage<T>>, params: P): AsyncGenerator<T>;
|
package/dist/paginate.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Yields every item of a cursor-paginated endpoint, fetching the next page only
|
|
3
|
+
* when the previous one is consumed. `fetchPage` receives `params` plus the
|
|
4
|
+
* cursor, so path arguments go in a closure:
|
|
5
|
+
*
|
|
6
|
+
* paginate((p) => kite.projects.units(42, p), { beds: 2 })
|
|
7
|
+
*/
|
|
8
|
+
export async function* paginate(fetchPage, params) {
|
|
9
|
+
let cursor;
|
|
10
|
+
do {
|
|
11
|
+
const page = await fetchPage({ ...params, cursor });
|
|
12
|
+
yield* Array.isArray(page.data) ? page.data : page.data.advertisers;
|
|
13
|
+
cursor = page.pagination.has_more ? (page.pagination.next_cursor ?? undefined) : undefined;
|
|
14
|
+
} while (cursor);
|
|
15
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { WebhookListingCreatedEvent, WebhookListingDelistedEvent, WebhookListingPriceChangedEvent, WebhookListingRelistedEvent, WebhookListingUpdatedEvent } from "./openapi-zod/models.js";
|
|
2
|
+
export type { WebhookListingCreatedEvent, WebhookListingData, WebhookListingDelistedEvent, WebhookListingPriceChangedEvent, WebhookListingRelistedEvent, WebhookListingUpdatedEvent, WebhookPriceChangedListingData, WebhookUpdatedListingData, } from "./openapi-zod/models.js";
|
|
3
|
+
/** Any event Kite delivers, discriminated on `type`. */
|
|
4
|
+
export type WebhookEvent = WebhookListingCreatedEvent | WebhookListingPriceChangedEvent | WebhookListingUpdatedEvent | WebhookListingDelistedEvent | WebhookListingRelistedEvent;
|
|
5
|
+
export type WebhookEventType = WebhookEvent["type"];
|
|
6
|
+
/** Every event type this version of the SDK knows. */
|
|
7
|
+
export declare const WEBHOOK_EVENT_TYPES: readonly ["listing.created", "listing.price_changed", "listing.updated", "listing.delisted", "listing.relisted"];
|
|
8
|
+
/**
|
|
9
|
+
* Header Kite signs each webhook delivery with. Deliveries also carry the
|
|
10
|
+
* deprecated `Darak-Signature` with the same value; either verifies.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SIGNATURE_HEADER = "Kite-Signature";
|
|
13
|
+
/** How old a signature may be before it is rejected, in seconds. */
|
|
14
|
+
export declare const TOLERANCE_SECONDS = 300;
|
|
15
|
+
export interface VerifyResult {
|
|
16
|
+
valid: boolean;
|
|
17
|
+
/** Why not, for your logs. Never send it back to the caller. */
|
|
18
|
+
reason?: "malformed" | "no_match" | "too_old";
|
|
19
|
+
}
|
|
20
|
+
export interface VerifyOptions {
|
|
21
|
+
/** Seconds a signature stays valid (default 300). */
|
|
22
|
+
toleranceSeconds?: number;
|
|
23
|
+
/** Current time in Unix seconds; for tests. */
|
|
24
|
+
now?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Checks a `Kite-Signature` header (`t=<unix>,v1=<hex>`) against the raw
|
|
28
|
+
* request body: HMAC-SHA256 of `${t}.${body}` under your endpoint's signing
|
|
29
|
+
* secret, compared in constant time. Pass the body exactly as received, before
|
|
30
|
+
* any JSON parsing. `secret` may be an array so a rotation can overlap: the old
|
|
31
|
+
* secret keeps verifying until the deploy carrying the new one is through.
|
|
32
|
+
* During a rotation overlap the header has a `v1` entry per live secret; the
|
|
33
|
+
* signature is valid if any of them matches.
|
|
34
|
+
*
|
|
35
|
+
* Imported from `@kite-sa/sdk/webhooks` because it needs `node:crypto`; the
|
|
36
|
+
* main entry stays runtime-neutral.
|
|
37
|
+
*/
|
|
38
|
+
export declare function verifyWebhookSignature(header: string | null | undefined, body: string, secret: string | readonly string[], options?: VerifyOptions): VerifyResult;
|
|
39
|
+
/**
|
|
40
|
+
* Thrown by `parseWebhookEvent`. `reason` is for your logs; never send it back
|
|
41
|
+
* to the caller.
|
|
42
|
+
*/
|
|
43
|
+
export declare class WebhookError extends Error {
|
|
44
|
+
readonly reason: NonNullable<VerifyResult["reason"]> | "invalid_json" | "unknown_type";
|
|
45
|
+
constructor(reason: NonNullable<VerifyResult["reason"]> | "invalid_json" | "unknown_type", message: string);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Verifies a delivery with `verifyWebhookSignature` and returns its event,
|
|
49
|
+
* typed by `type`. Throws `WebhookError` when the signature doesn't verify,
|
|
50
|
+
* the body isn't a JSON event, or `type` is one this SDK doesn't know (a newer
|
|
51
|
+
* event type: answer 2xx and ignore it, or upgrade). Pass the raw body, before
|
|
52
|
+
* any JSON parsing.
|
|
53
|
+
*
|
|
54
|
+
* Test events carry `test: true`. Deliveries are at least once: deduplicate on
|
|
55
|
+
* `event.id`, which is also the `Kite-Event-Id` header.
|
|
56
|
+
*/
|
|
57
|
+
export declare function parseWebhookEvent(header: string | null | undefined, body: string, secret: string | readonly string[], options?: VerifyOptions): WebhookEvent;
|