@kite-sa/sdk 0.5.0 → 0.6.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/CHANGELOG.md CHANGED
@@ -2,15 +2,29 @@
2
2
 
3
3
  Formerly `@darak-app/sdk`, which is deprecated. Versions before 0.5.0 were published under that name.
4
4
 
5
- ## 0.5.0 (unreleased)
5
+ ## 0.6.0
6
+
7
+ - New methods for the endpoints added since 0.5.0:
8
+ `reference.coverage()` (`GET /coverage`: what the API can answer, per city and
9
+ property type), `analytics.belowMarket()` (`GET /market/below-market`: listings
10
+ priced below comparable ones) and `market.commercialRents()`
11
+ (`GET /market/commercial-rents`: commercial asking rent per m² by neighborhood).
12
+ - `analytics.deals()` (`GET /market/deals`) is deprecated in the API; use
13
+ `analytics.belowMarket()`.
14
+ - Response types follow the current spec, including `photo_features` on listings,
15
+ the price-basis labels and the constant-quality index in `/market/trends`.
16
+ - Package links point at the public docs; the issue link is `api@kite.sa`.
17
+
18
+ ## 0.5.0
6
19
 
7
20
  - **Renamed** from `@darak-app/sdk` to `@kite-sa/sdk` for the move to Kite. The client
8
21
  class is `Kite` (was `Darak`), the error class `KiteError` (was `DarakError`), the
9
22
  options type `KiteOptions`, and the key is read from `KITE_API_KEY` (was
10
23
  `DARAK_API_KEY`). The default base URL is `https://api.kite.sa/v1`;
11
24
  `https://api.darak.app/v1` keeps working, so pass it as `baseUrl` if you need it.
12
- Webhook headers (`Darak-Signature`, `Darak-Event-Id`, …) and the `darak.read`
13
- scope are part of the API and unchanged.
25
+ The `darak.read` scope is part of the API and unchanged. Webhook deliveries carry
26
+ `Kite-Signature`, `Kite-Event-Id`, … and still send the deprecated `Darak-*`
27
+ names with the same values. The SDK does not verify webhook signatures.
14
28
  - Generate endpoint types with TypeScript-7-compatible `openapi-zod-ts` instead of
15
29
  `openapi-typescript`. The SDK no longer exports the `paths` and `components`
16
30
  type maps, and its `operations` type map has a narrower shape. Update
package/README.md CHANGED
@@ -48,14 +48,3 @@ const projects = await kite.projects.search({ city: "riyadh" });
48
48
  0.1.x names for what is now `reference`.
49
49
 
50
50
  Options: `new Kite({ apiKey, baseUrl, maxRetries: 2, timeoutMs: 30000, fetch })`. Needs Node 18+ (or any runtime with `fetch`).
51
-
52
- ## Developing
53
-
54
- `src/openapi-zod/` (type source), `src/openapi.ts` (operation-type adapter),
55
- and `src/generated.ts` (the namespaces) are generated: run
56
- `bun run --filter @kite-sa/sdk generate` after the API spec changes. CI
57
- checks every generated file for drift; tests verify the spec hash, type coverage,
58
- and reachability of every `operationId` on a real client. The generated fetch
59
- client is used for types only; Kite retains its own authentication, retries,
60
- and snake_case query serialization. `bun run --filter @kite-sa/sdk build`
61
- writes `dist/`.
@@ -26,11 +26,29 @@ export declare function createEndpoints(request: Request): {
26
26
  readonly analytics: {
27
27
  /**
28
28
  * Find below-market listings. Residential listings asking noticeably less than
29
- * similar listings nearby, biggest gap first. Each listing is compared with
30
- * Darak's published nearby asking-price comparison: the same property type and
31
- * bedroom count, a similar area, within a calibrated radius and look-back
32
- * (disclosed per listing in `comparison`), one observation per distinct unit,
33
- * and the subject's own duplicates excluded.
29
+ * similar listings nearby, biggest gap first.
30
+ */
31
+ readonly belowMarket: (params: QueryOf<"analytics.below_market">) => Promise<{
32
+ data: {
33
+ listing: import("./openapi-zod/models.js").Listing;
34
+ comparison: {
35
+ median_price_sar: unknown;
36
+ p25_price_sar: unknown;
37
+ p75_price_sar: unknown;
38
+ percent_vs_median: number | null;
39
+ sample_size: number;
40
+ radius_m: unknown;
41
+ look_back_days: unknown;
42
+ price_basis: string;
43
+ price_source: string;
44
+ };
45
+ }[];
46
+ pagination: import("./openapi-zod/models.js").Pagination;
47
+ }>;
48
+ /**
49
+ * Find below-market listings (old path). **Deprecated:** use GET
50
+ * /market/below-market, which takes the same parameters and returns the same
51
+ * response.
34
52
  */
35
53
  readonly deals: (params: QueryOf<"analytics.deals">) => Promise<{
36
54
  data: {
@@ -43,6 +61,7 @@ export declare function createEndpoints(request: Request): {
43
61
  sample_size: number;
44
62
  radius_m: unknown;
45
63
  look_back_days: unknown;
64
+ price_basis: string;
46
65
  price_source: string;
47
66
  };
48
67
  }[];
@@ -234,19 +253,10 @@ export declare function createEndpoints(request: Request): {
234
253
  };
235
254
  }>;
236
255
  /**
237
- * Get price trends. Monthly median asking price over recent months (up to 36),
238
- * for a city or for up to five neighborhoods (one series each). Computed from
239
- * Darak's listing history, not from today's listings: every listing Darak has
240
- * recorded, including ones since rented, sold or removed, and every price change
241
- * (the price in force at each point in time, not the current one). - `on_market`
242
- * (default): a listing counts in a month if it was live at any point that month
243
- * (first seen before the month ended, and still active or last seen on or after
244
- * the month started), at the price it had at the end of the month, or when last
245
- * seen if it went off the market earlier. - `new_listings`: a listing counts in
246
- * the month Darak first saw it, at its first recorded asking price. Listings are
247
- * deduplicated across sources and pass the same outlier filter as the current
248
- * market (fences are today's), but not the 30-day freshness window, which
249
- * doesn't apply to history.
256
+ * Get price trends. Monthly asking prices over recent months (up to 36), for a
257
+ * city or for up to five neighborhoods (one series each): the median and
258
+ * quartiles for the price level, and a constant-quality price index
259
+ * (`price_index`) for change over time.
250
260
  */
251
261
  readonly trends: (params: QueryOf<"analytics.trends">) => Promise<{
252
262
  data: {
@@ -266,12 +276,17 @@ export declare function createEndpoints(request: Request): {
266
276
  name_en: string | null;
267
277
  name_ar: string | null;
268
278
  change_pct: number | null;
279
+ index_change_pct: number | null;
280
+ index_base_month: string | null;
269
281
  points: {
270
282
  month: string;
271
283
  sample_size: number;
272
284
  median_price_sar: unknown;
273
285
  p25_price_sar: unknown;
274
286
  p75_price_sar: unknown;
287
+ price_index: number | null;
288
+ index_cells: number;
289
+ index_sample_size: number;
275
290
  partial: boolean;
276
291
  coverage: string;
277
292
  }[];
@@ -324,7 +339,7 @@ export declare function createEndpoints(request: Request): {
324
339
  data: import("./openapi-zod/models.js").Listing;
325
340
  }>;
326
341
  /**
327
- * Get a listing's price history. Every price change Darak recorded for an active
342
+ * Get a listing's price history. Every price change Kite recorded for an active
328
343
  * listing, oldest first.
329
344
  */
330
345
  readonly priceHistory: (id: string | number) => Promise<{
@@ -342,7 +357,7 @@ export declare function createEndpoints(request: Request): {
342
357
  }>;
343
358
  /**
344
359
  * Search listings. Active, deduplicated listings in one city, quality-filtered
345
- * like darak.app.
360
+ * like kite.sa.
346
361
  */
347
362
  readonly search: (params: QueryOf<"listings.search">) => Promise<{
348
363
  data: import("./openapi-zod/models.js").Listing[];
@@ -391,9 +406,78 @@ export declare function createEndpoints(request: Request): {
391
406
  };
392
407
  };
393
408
  }>;
409
+ /**
410
+ * Commercial rent per m² by neighborhood. Asking rent per m² of commercial space
411
+ * (shops, offices, warehouses, commercial land and whole buildings) by
412
+ * neighborhood, with the city-wide figure for each type as a benchmark.
413
+ */
414
+ readonly commercialRents: (params: QueryOf<"market.commercial_rents">) => Promise<{
415
+ data: {
416
+ filters: {
417
+ city: string;
418
+ listing_type: string;
419
+ listing_category: string;
420
+ property_types: string[];
421
+ neighborhood_ids: unknown;
422
+ area_min: unknown;
423
+ area_max: unknown;
424
+ };
425
+ price_basis: string;
426
+ price_source: string;
427
+ min_sample_size: number;
428
+ city_totals: {
429
+ property_type: string;
430
+ sample_size: number;
431
+ median_rent_per_sqm_sar: unknown;
432
+ p25_rent_per_sqm_sar: unknown;
433
+ p75_rent_per_sqm_sar: unknown;
434
+ median_area_sqm: unknown;
435
+ median_rent_sar: unknown;
436
+ street_width: {
437
+ sample_size: number;
438
+ median_m: number | null;
439
+ };
440
+ exclusions: {
441
+ listings_in_scope: number;
442
+ lease_takeover: number;
443
+ implausible_area_or_price: number;
444
+ repeated_listing: number;
445
+ outside_price_per_sqm_fence: number;
446
+ };
447
+ price_per_sqm_fence_sar: {
448
+ lower: number;
449
+ upper: unknown;
450
+ };
451
+ }[];
452
+ neighborhoods: {
453
+ neighborhood_id: number;
454
+ name_ar: string;
455
+ name_en: string;
456
+ center: unknown;
457
+ property_type: string;
458
+ sample_size: number;
459
+ median_rent_per_sqm_sar: unknown;
460
+ p25_rent_per_sqm_sar: unknown;
461
+ p75_rent_per_sqm_sar: unknown;
462
+ median_area_sqm: unknown;
463
+ median_rent_sar: unknown;
464
+ street_width: {
465
+ sample_size: number;
466
+ median_m: number | null;
467
+ };
468
+ }[];
469
+ window: {
470
+ updated_within_days: number;
471
+ from: string;
472
+ to: string;
473
+ };
474
+ };
475
+ }>;
394
476
  /**
395
477
  * Land prices per m². Median registered price per m² of land plots, per quarter,
396
- * for a city or for each of up to 20 neighborhoods, with quarter-on-quarter and
478
+ * for a city, for each of up to 20 neighborhoods (`neighborhood_id`), or for
479
+ * every neighborhood in the city in one call (`group_by=neighborhood` without
480
+ * `neighborhood_id`, over at most 12 quarters), with quarter-on-quarter and
397
481
  * year-on-year change.
398
482
  */
399
483
  readonly landPrices: (params: QueryOf<"market.land_prices">) => Promise<{
@@ -401,9 +485,11 @@ export declare function createEndpoints(request: Request): {
401
485
  filters: {
402
486
  city: string;
403
487
  neighborhood_ids: unknown;
488
+ group_by: string;
404
489
  land_use: string;
405
490
  };
406
491
  asset: string;
492
+ price_basis: string;
407
493
  price_source: string;
408
494
  window: {
409
495
  quarter_from: string;
@@ -515,7 +601,7 @@ export declare function createEndpoints(request: Request): {
515
601
  * were updated, and breakdowns by property type, top neighborhoods by volume,
516
602
  * and source. Computed over the market sample: active, deduplicated listings
517
603
  * updated in the last 30 days (`updated_at`), after the same outlier filter
518
- * darak.app uses (per-tier price fences from the median and MAD of log price,
604
+ * kite.sa uses (per-tier price fences from the median and MAD of log price,
519
605
  * bedroom and area sanity checks, and a floor at 30% of the neighborhood
520
606
  * median).
521
607
  */
@@ -610,6 +696,7 @@ export declare function createEndpoints(request: Request): {
610
696
  group_by: string;
611
697
  land_use: unknown;
612
698
  };
699
+ price_basis: string;
613
700
  price_source: string;
614
701
  window: {
615
702
  quarter_from: string;
@@ -676,9 +763,11 @@ export declare function createEndpoints(request: Request): {
676
763
  };
677
764
  readonly official: {
678
765
  /**
679
- * Darak Property Index. **Free on every plan (0 units).** Series built on Saudi
766
+ * Kite Property Index. **Free on every plan (0 units).** Series built on Saudi
680
767
  * open data are served under the Saudi Open Data License v2.0 with attribution:
681
- * show `attribution.notice` wherever you display or pass on those figures.
768
+ * show `attribution.notice` wherever you display or pass on those figures. The
769
+ * Kite Property Index, as published: the series of a **published monthly
770
+ * release**, frozen when it was released.
682
771
  */
683
772
  readonly marketIndex: (params?: QueryOf<"official.market_index">) => Promise<{
684
773
  data: {
@@ -1006,10 +1095,7 @@ export declare function createEndpoints(request: Request): {
1006
1095
  };
1007
1096
  };
1008
1097
  readonly projects: {
1009
- /**
1010
- * List developers. Developers with active projects on Darak, most projects
1011
- * first.
1012
- */
1098
+ /** List developers. Developers with active projects on Kite, most projects first. */
1013
1099
  readonly developers: (params?: QueryOf<"projects.developers">) => Promise<{
1014
1100
  data: {
1015
1101
  name: string;
@@ -1021,7 +1107,7 @@ export declare function createEndpoints(request: Request): {
1021
1107
  }>;
1022
1108
  /**
1023
1109
  * Get a project. One project with its description, boundary, amenities,
1024
- * financing banks and a summary of the units listed on Darak.
1110
+ * financing banks and a summary of the units listed on Kite.
1025
1111
  */
1026
1112
  readonly get: (id: string | number) => Promise<{
1027
1113
  data: {
@@ -1133,7 +1219,7 @@ export declare function createEndpoints(request: Request): {
1133
1219
  pagination: import("./openapi-zod/models.js").Pagination;
1134
1220
  }>;
1135
1221
  /**
1136
- * List a project's units. Active listings on Darak linked to one project: units
1222
+ * List a project's units. Active listings on Kite linked to one project: units
1137
1223
  * for sale (total price) and, for some projects, rentals (yearly rent).
1138
1224
  */
1139
1225
  readonly units: (id: string | number, params?: QueryOf<"projects.units">) => Promise<{
@@ -1225,7 +1311,7 @@ export declare function createEndpoints(request: Request): {
1225
1311
  }>;
1226
1312
  };
1227
1313
  readonly reference: {
1228
- /** List cities. Cities Darak covers. */
1314
+ /** List cities. Cities Kite covers. */
1229
1315
  readonly cities: () => Promise<{
1230
1316
  data: {
1231
1317
  slug: string;
@@ -1233,6 +1319,40 @@ export declare function createEndpoints(request: Request): {
1233
1319
  name_ar: string;
1234
1320
  }[];
1235
1321
  }>;
1322
+ /**
1323
+ * What the API covers. What the API can answer, per city: active listings by
1324
+ * listing type and kind of property, how many neighborhoods have at least 10 of
1325
+ * them, the share with a published nearby price band, the latest registered-deal
1326
+ * quarter and how much of it is placed in neighborhoods, and whether registered
1327
+ * rents exist.
1328
+ */
1329
+ readonly coverage: (params?: QueryOf<"reference.coverage">) => Promise<{
1330
+ data: {
1331
+ computed_at: string;
1332
+ cities: {
1333
+ city: string;
1334
+ name_en: string;
1335
+ name_ar: string;
1336
+ listings: {
1337
+ listing_type: string;
1338
+ property_family: string;
1339
+ property_types: string[];
1340
+ active_listings: number;
1341
+ neighborhoods_with_10_listings: number;
1342
+ price_band_ready_pct: number | null;
1343
+ }[];
1344
+ registered_deals: {
1345
+ latest_quarter: string | null;
1346
+ neighborhood_mapped_pct: number | null;
1347
+ mappable_deals: number;
1348
+ };
1349
+ registered_rents: {
1350
+ available: boolean;
1351
+ latest_quarter: string | null;
1352
+ };
1353
+ }[];
1354
+ };
1355
+ }>;
1236
1356
  /**
1237
1357
  * List city directions. Groupings of neighborhoods by part of the city (north,
1238
1358
  * east, …).
@@ -1301,6 +1421,7 @@ export declare function createEndpoints(request: Request): {
1301
1421
  readonly search: (params: QueryOf<"transactions.search">) => Promise<{
1302
1422
  data: import("./openapi-zod/models.js").Transaction[];
1303
1423
  pagination: import("./openapi-zod/models.js").Pagination;
1424
+ price_basis: string;
1304
1425
  price_source: string;
1305
1426
  coverage: import("./openapi-zod/models.js").TransactionCoverage;
1306
1427
  attribution: import("./openapi-zod/models.js").TransactionAttribution;
package/dist/generated.js CHANGED
@@ -4,11 +4,15 @@ export function createEndpoints(request) {
4
4
  analytics: {
5
5
  /**
6
6
  * Find below-market listings. Residential listings asking noticeably less than
7
- * similar listings nearby, biggest gap first. Each listing is compared with
8
- * Darak's published nearby asking-price comparison: the same property type and
9
- * bedroom count, a similar area, within a calibrated radius and look-back
10
- * (disclosed per listing in `comparison`), one observation per distinct unit,
11
- * and the subject's own duplicates excluded.
7
+ * similar listings nearby, biggest gap first.
8
+ */
9
+ belowMarket: (params) => request("GET", "/market/below-market", {
10
+ query: params,
11
+ }),
12
+ /**
13
+ * Find below-market listings (old path). **Deprecated:** use GET
14
+ * /market/below-market, which takes the same parameters and returns the same
15
+ * response.
12
16
  */
13
17
  deals: (params) => request("GET", "/market/deals", { query: params }),
14
18
  /**
@@ -50,19 +54,10 @@ export function createEndpoints(request) {
50
54
  query: params,
51
55
  }),
52
56
  /**
53
- * Get price trends. Monthly median asking price over recent months (up to 36),
54
- * for a city or for up to five neighborhoods (one series each). Computed from
55
- * Darak's listing history, not from today's listings: every listing Darak has
56
- * recorded, including ones since rented, sold or removed, and every price change
57
- * (the price in force at each point in time, not the current one). - `on_market`
58
- * (default): a listing counts in a month if it was live at any point that month
59
- * (first seen before the month ended, and still active or last seen on or after
60
- * the month started), at the price it had at the end of the month, or when last
61
- * seen if it went off the market earlier. - `new_listings`: a listing counts in
62
- * the month Darak first saw it, at its first recorded asking price. Listings are
63
- * deduplicated across sources and pass the same outlier filter as the current
64
- * market (fences are today's), but not the 30-day freshness window, which
65
- * doesn't apply to history.
57
+ * Get price trends. Monthly asking prices over recent months (up to 36), for a
58
+ * city or for up to five neighborhoods (one series each): the median and
59
+ * quartiles for the price level, and a constant-quality price index
60
+ * (`price_index`) for change over time.
66
61
  */
67
62
  trends: (params) => request("GET", "/market/trends", { query: params }),
68
63
  },
@@ -94,13 +89,13 @@ export function createEndpoints(request) {
94
89
  /** Get a listing. One active listing. */
95
90
  get: (id) => request("GET", `/listings/${encodeURIComponent(String(id))}`),
96
91
  /**
97
- * Get a listing's price history. Every price change Darak recorded for an active
92
+ * Get a listing's price history. Every price change Kite recorded for an active
98
93
  * listing, oldest first.
99
94
  */
100
95
  priceHistory: (id) => request("GET", `/listings/${encodeURIComponent(String(id))}/price-history`),
101
96
  /**
102
97
  * Search listings. Active, deduplicated listings in one city, quality-filtered
103
- * like darak.app.
98
+ * like kite.sa.
104
99
  */
105
100
  search: (params) => request("GET", "/listings", { query: params }),
106
101
  },
@@ -112,9 +107,19 @@ export function createEndpoints(request) {
112
107
  areaDistribution: (params) => request("GET", "/market/area-distribution", {
113
108
  query: params,
114
109
  }),
110
+ /**
111
+ * Commercial rent per m² by neighborhood. Asking rent per m² of commercial space
112
+ * (shops, offices, warehouses, commercial land and whole buildings) by
113
+ * neighborhood, with the city-wide figure for each type as a benchmark.
114
+ */
115
+ commercialRents: (params) => request("GET", "/market/commercial-rents", {
116
+ query: params,
117
+ }),
115
118
  /**
116
119
  * Land prices per m². Median registered price per m² of land plots, per quarter,
117
- * for a city or for each of up to 20 neighborhoods, with quarter-on-quarter and
120
+ * for a city, for each of up to 20 neighborhoods (`neighborhood_id`), or for
121
+ * every neighborhood in the city in one call (`group_by=neighborhood` without
122
+ * `neighborhood_id`, over at most 12 quarters), with quarter-on-quarter and
118
123
  * year-on-year change.
119
124
  */
120
125
  landPrices: (params) => request("GET", "/market/land-prices", {
@@ -137,7 +142,7 @@ export function createEndpoints(request) {
137
142
  * were updated, and breakdowns by property type, top neighborhoods by volume,
138
143
  * and source. Computed over the market sample: active, deduplicated listings
139
144
  * updated in the last 30 days (`updated_at`), after the same outlier filter
140
- * darak.app uses (per-tier price fences from the median and MAD of log price,
145
+ * kite.sa uses (per-tier price fences from the median and MAD of log price,
141
146
  * bedroom and area sanity checks, and a floor at 30% of the neighborhood
142
147
  * median).
143
148
  */
@@ -165,9 +170,11 @@ export function createEndpoints(request) {
165
170
  },
166
171
  official: {
167
172
  /**
168
- * Darak Property Index. **Free on every plan (0 units).** Series built on Saudi
173
+ * Kite Property Index. **Free on every plan (0 units).** Series built on Saudi
169
174
  * open data are served under the Saudi Open Data License v2.0 with attribution:
170
- * show `attribution.notice` wherever you display or pass on those figures.
175
+ * show `attribution.notice` wherever you display or pass on those figures. The
176
+ * Kite Property Index, as published: the series of a **published monthly
177
+ * release**, frozen when it was released.
171
178
  */
172
179
  marketIndex: (params) => request("GET", "/market/property-index", {
173
180
  query: (params ?? {}),
@@ -260,16 +267,13 @@ export function createEndpoints(request) {
260
267
  },
261
268
  },
262
269
  projects: {
263
- /**
264
- * List developers. Developers with active projects on Darak, most projects
265
- * first.
266
- */
270
+ /** List developers. Developers with active projects on Kite, most projects first. */
267
271
  developers: (params) => request("GET", "/developers", {
268
272
  query: (params ?? {}),
269
273
  }),
270
274
  /**
271
275
  * Get a project. One project with its description, boundary, amenities,
272
- * financing banks and a summary of the units listed on Darak.
276
+ * financing banks and a summary of the units listed on Kite.
273
277
  */
274
278
  get: (id) => request("GET", `/projects/${encodeURIComponent(String(id))}`),
275
279
  /**
@@ -281,7 +285,7 @@ export function createEndpoints(request) {
281
285
  query: (params ?? {}),
282
286
  }),
283
287
  /**
284
- * List a project's units. Active listings on Darak linked to one project: units
288
+ * List a project's units. Active listings on Kite linked to one project: units
285
289
  * for sale (total price) and, for some projects, rentals (yearly rent).
286
290
  */
287
291
  units: (id, params) => request("GET", `/projects/${encodeURIComponent(String(id))}/units`, { query: (params ?? {}) }),
@@ -295,8 +299,18 @@ export function createEndpoints(request) {
295
299
  }),
296
300
  },
297
301
  reference: {
298
- /** List cities. Cities Darak covers. */
302
+ /** List cities. Cities Kite covers. */
299
303
  cities: () => request("GET", "/cities"),
304
+ /**
305
+ * What the API covers. What the API can answer, per city: active listings by
306
+ * listing type and kind of property, how many neighborhoods have at least 10 of
307
+ * them, the share with a published nearby price band, the latest registered-deal
308
+ * quarter and how much of it is placed in neighborhoods, and whether registered
309
+ * rents exist.
310
+ */
311
+ coverage: (params) => request("GET", "/coverage", {
312
+ query: (params ?? {}),
313
+ }),
300
314
  /**
301
315
  * List city directions. Groupings of neighborhoods by part of the city (north,
302
316
  * east, …).
package/dist/index.d.ts CHANGED
@@ -43,7 +43,7 @@ export interface KiteOptions {
43
43
  }
44
44
  type Query = Record<string, string | number | boolean | readonly (string | number)[] | undefined>;
45
45
  /** Kept in step with package.json by src/index.test.ts. */
46
- export declare const VERSION = "0.5.0";
46
+ export declare const VERSION = "0.6.0";
47
47
  /** Arrays go comma-separated, as the API expects; unset values are dropped. */
48
48
  export declare function toSearchParams(query?: Query): string;
49
49
  /**
package/dist/index.js CHANGED
@@ -22,7 +22,7 @@ export class KiteError extends Error {
22
22
  }
23
23
  }
24
24
  /** Kept in step with package.json by src/index.test.ts. */
25
- export const VERSION = "0.5.0";
25
+ export const VERSION = "0.6.0";
26
26
  const USER_AGENT = `kite-sa-js/${VERSION}`;
27
27
  /** Longest Retry-After worth waiting for; anything longer (a monthly quota) throws. */
28
28
  const MAX_RETRY_WAIT_S = 60;
@@ -96,6 +96,42 @@ export declare function referenceLimits(config?: Partial<ClientConfig>): Promise
96
96
  max_result_depth: number;
97
97
  };
98
98
  }>;
99
+ /**
100
+ * @throws {ApiError<400, Error>}
101
+ * @throws {ApiError<401, Error>}
102
+ * @throws {ApiError<403, Error>}
103
+ * @throws {ApiError<429, Error>}
104
+ * @throws {ApiError<500, Error>}
105
+ */
106
+ export declare function referenceCoverage(params?: {
107
+ city?: string;
108
+ }, config?: Partial<ClientConfig>): Promise<{
109
+ data: {
110
+ computed_at: string;
111
+ cities: {
112
+ city: string;
113
+ name_en: string;
114
+ name_ar: string;
115
+ listings: {
116
+ listing_type: string;
117
+ property_family: string;
118
+ property_types: string[];
119
+ active_listings: number;
120
+ neighborhoods_with_10_listings: number;
121
+ price_band_ready_pct: number | null;
122
+ }[];
123
+ registered_deals: {
124
+ latest_quarter: string | null;
125
+ neighborhood_mapped_pct: number | null;
126
+ mappable_deals: number;
127
+ };
128
+ registered_rents: {
129
+ available: boolean;
130
+ latest_quarter: string | null;
131
+ };
132
+ }[];
133
+ };
134
+ }>;
99
135
  /**
100
136
  * @throws {ApiError<400, Error>}
101
137
  * @throws {ApiError<401, Error>}
@@ -128,6 +164,7 @@ export declare function listingsSearch(params: {
128
164
  q?: string;
129
165
  amenities?: string[];
130
166
  amenitiesExclude?: string[];
167
+ photoFeatures?: string[];
131
168
  floor?: "ground" | "upper";
132
169
  sourceExclude?: string[];
133
170
  maxAge?: number;
@@ -177,6 +214,7 @@ export declare function listingsCount(params: {
177
214
  q?: string;
178
215
  amenities?: string[];
179
216
  amenitiesExclude?: string[];
217
+ photoFeatures?: string[];
180
218
  floor?: "ground" | "upper";
181
219
  sourceExclude?: string[];
182
220
  maxAge?: number;
@@ -535,6 +573,82 @@ export declare function marketNeighborhoods(params: {
535
573
  };
536
574
  };
537
575
  }>;
576
+ /**
577
+ * @throws {ApiError<400, Error>}
578
+ * @throws {ApiError<401, Error>}
579
+ * @throws {ApiError<403, Error>}
580
+ * @throws {ApiError<429, Error>}
581
+ * @throws {ApiError<500, Error>}
582
+ */
583
+ export declare function marketCommercialRents(params: {
584
+ city: string;
585
+ propertyType?: string[];
586
+ neighborhoodId?: number[];
587
+ areaMin?: number;
588
+ areaMax?: number;
589
+ minSampleSize?: number;
590
+ }, config?: Partial<ClientConfig>): Promise<{
591
+ data: {
592
+ filters: {
593
+ city: string;
594
+ listing_type: string;
595
+ listing_category: string;
596
+ property_types: string[];
597
+ neighborhood_ids: unknown;
598
+ area_min: unknown;
599
+ area_max: unknown;
600
+ };
601
+ price_basis: string;
602
+ price_source: string;
603
+ min_sample_size: number;
604
+ city_totals: {
605
+ property_type: string;
606
+ sample_size: number;
607
+ median_rent_per_sqm_sar: unknown;
608
+ p25_rent_per_sqm_sar: unknown;
609
+ p75_rent_per_sqm_sar: unknown;
610
+ median_area_sqm: unknown;
611
+ median_rent_sar: unknown;
612
+ street_width: {
613
+ sample_size: number;
614
+ median_m: number | null;
615
+ };
616
+ exclusions: {
617
+ listings_in_scope: number;
618
+ lease_takeover: number;
619
+ implausible_area_or_price: number;
620
+ repeated_listing: number;
621
+ outside_price_per_sqm_fence: number;
622
+ };
623
+ price_per_sqm_fence_sar: {
624
+ lower: number;
625
+ upper: unknown;
626
+ };
627
+ }[];
628
+ neighborhoods: {
629
+ neighborhood_id: number;
630
+ name_ar: string;
631
+ name_en: string;
632
+ center: unknown;
633
+ property_type: string;
634
+ sample_size: number;
635
+ median_rent_per_sqm_sar: unknown;
636
+ p25_rent_per_sqm_sar: unknown;
637
+ p75_rent_per_sqm_sar: unknown;
638
+ median_area_sqm: unknown;
639
+ median_rent_sar: unknown;
640
+ street_width: {
641
+ sample_size: number;
642
+ median_m: number | null;
643
+ };
644
+ }[];
645
+ window: {
646
+ updated_within_days: number;
647
+ from: string;
648
+ to: string;
649
+ };
650
+ };
651
+ }>;
538
652
  /**
539
653
  * @throws {ApiError<400, Error>}
540
654
  * @throws {ApiError<401, Error>}
@@ -766,6 +880,41 @@ export declare function analyticsListingPriceBand(id: number, config?: Partial<C
766
880
  * @throws {ApiError<429, Error>}
767
881
  * @throws {ApiError<500, Error>}
768
882
  */
883
+ export declare function analyticsBelowMarket(params: {
884
+ city: string;
885
+ listingType: "rent" | "sale";
886
+ propertyType?: "apartment" | "villa" | "floor" | "duplex";
887
+ beds?: number;
888
+ neighborhoodId?: number[];
889
+ minDiscountPct?: number;
890
+ maxDiscountPct?: number;
891
+ limit?: number;
892
+ cursor?: string;
893
+ }, config?: Partial<ClientConfig>): Promise<{
894
+ data: {
895
+ listing: Listing;
896
+ comparison: {
897
+ median_price_sar: unknown;
898
+ p25_price_sar: unknown;
899
+ p75_price_sar: unknown;
900
+ percent_vs_median: number | null;
901
+ sample_size: number;
902
+ radius_m: unknown;
903
+ look_back_days: unknown;
904
+ price_basis: string;
905
+ price_source: string;
906
+ };
907
+ }[];
908
+ pagination: Pagination;
909
+ }>;
910
+ /**
911
+ * @deprecated
912
+ * @throws {ApiError<400, Error>}
913
+ * @throws {ApiError<401, Error>}
914
+ * @throws {ApiError<403, Error>}
915
+ * @throws {ApiError<429, Error>}
916
+ * @throws {ApiError<500, Error>}
917
+ */
769
918
  export declare function analyticsDeals(params: {
770
919
  city: string;
771
920
  listingType: "rent" | "sale";
@@ -787,6 +936,7 @@ export declare function analyticsDeals(params: {
787
936
  sample_size: number;
788
937
  radius_m: unknown;
789
938
  look_back_days: unknown;
939
+ price_basis: string;
790
940
  price_source: string;
791
941
  };
792
942
  }[];
@@ -874,12 +1024,17 @@ export declare function analyticsTrends(params: {
874
1024
  name_en: string | null;
875
1025
  name_ar: string | null;
876
1026
  change_pct: number | null;
1027
+ index_change_pct: number | null;
1028
+ index_base_month: string | null;
877
1029
  points: {
878
1030
  month: string;
879
1031
  sample_size: number;
880
1032
  median_price_sar: unknown;
881
1033
  p25_price_sar: unknown;
882
1034
  p75_price_sar: unknown;
1035
+ price_index: number | null;
1036
+ index_cells: number;
1037
+ index_sample_size: number;
883
1038
  partial: boolean;
884
1039
  coverage: string;
885
1040
  }[];
@@ -979,6 +1134,7 @@ export declare function transactionsSearch(params: {
979
1134
  }, config?: Partial<ClientConfig>): Promise<{
980
1135
  data: Transaction[];
981
1136
  pagination: Pagination;
1137
+ price_basis: string;
982
1138
  price_source: string;
983
1139
  coverage: TransactionCoverage;
984
1140
  attribution: TransactionAttribution;
@@ -1006,6 +1162,7 @@ export declare function marketTransactions(params: {
1006
1162
  group_by: string;
1007
1163
  land_use: unknown;
1008
1164
  };
1165
+ price_basis: string;
1009
1166
  price_source: string;
1010
1167
  window: {
1011
1168
  quarter_from: string;
@@ -1044,6 +1201,7 @@ export declare function marketTransactions(params: {
1044
1201
  export declare function marketLandPrices(params: {
1045
1202
  city: string;
1046
1203
  neighborhoodId?: number[];
1204
+ groupBy?: "city" | "neighborhood";
1047
1205
  landUse?: "residential" | "commercial";
1048
1206
  quarterFrom?: string;
1049
1207
  quarterTo?: string;
@@ -1053,9 +1211,11 @@ export declare function marketLandPrices(params: {
1053
1211
  filters: {
1054
1212
  city: string;
1055
1213
  neighborhood_ids: unknown;
1214
+ group_by: string;
1056
1215
  land_use: string;
1057
1216
  };
1058
1217
  asset: string;
1218
+ price_basis: string;
1059
1219
  price_source: string;
1060
1220
  window: {
1061
1221
  quarter_from: string;
@@ -124,6 +124,20 @@ export async function referenceLimits(config) {
124
124
  const res = await _request("GET", "/limits", {}, config);
125
125
  return res.json();
126
126
  }
127
+ /**
128
+ * @throws {ApiError<400, Error>}
129
+ * @throws {ApiError<401, Error>}
130
+ * @throws {ApiError<403, Error>}
131
+ * @throws {ApiError<429, Error>}
132
+ * @throws {ApiError<500, Error>}
133
+ */
134
+ export async function referenceCoverage(params, config) {
135
+ const searchParams = new URLSearchParams();
136
+ if (params?.city != null)
137
+ searchParams.set("city", String(params.city));
138
+ const res = await _request("GET", "/coverage", { searchParams }, config);
139
+ return res.json();
140
+ }
127
141
  /**
128
142
  * @throws {ApiError<400, Error>}
129
143
  * @throws {ApiError<401, Error>}
@@ -193,6 +207,10 @@ export async function listingsSearch(params, config) {
193
207
  for (const v of params.amenitiesExclude)
194
208
  searchParams.append("amenities_exclude", String(v));
195
209
  }
210
+ if (params?.photoFeatures != null) {
211
+ for (const v of params.photoFeatures)
212
+ searchParams.append("photo_features", String(v));
213
+ }
196
214
  if (params?.floor != null)
197
215
  searchParams.set("floor", String(params.floor));
198
216
  if (params?.sourceExclude != null) {
@@ -293,6 +311,10 @@ export async function listingsCount(params, config) {
293
311
  for (const v of params.amenitiesExclude)
294
312
  searchParams.append("amenities_exclude", String(v));
295
313
  }
314
+ if (params?.photoFeatures != null) {
315
+ for (const v of params.photoFeatures)
316
+ searchParams.append("photo_features", String(v));
317
+ }
296
318
  if (params?.floor != null)
297
319
  searchParams.set("floor", String(params.floor));
298
320
  if (params?.sourceExclude != null) {
@@ -516,6 +538,34 @@ export async function marketNeighborhoods(params, config) {
516
538
  const res = await _request("GET", "/market/neighborhoods", { searchParams }, config);
517
539
  return res.json();
518
540
  }
541
+ /**
542
+ * @throws {ApiError<400, Error>}
543
+ * @throws {ApiError<401, Error>}
544
+ * @throws {ApiError<403, Error>}
545
+ * @throws {ApiError<429, Error>}
546
+ * @throws {ApiError<500, Error>}
547
+ */
548
+ export async function marketCommercialRents(params, config) {
549
+ const searchParams = new URLSearchParams();
550
+ if (params?.city != null)
551
+ searchParams.set("city", String(params.city));
552
+ if (params?.propertyType != null) {
553
+ for (const v of params.propertyType)
554
+ searchParams.append("property_type", String(v));
555
+ }
556
+ if (params?.neighborhoodId != null) {
557
+ for (const v of params.neighborhoodId)
558
+ searchParams.append("neighborhood_id", String(v));
559
+ }
560
+ if (params?.areaMin != null)
561
+ searchParams.set("area_min", String(params.areaMin));
562
+ if (params?.areaMax != null)
563
+ searchParams.set("area_max", String(params.areaMax));
564
+ if (params?.minSampleSize != null)
565
+ searchParams.set("min_sample_size", String(params.minSampleSize));
566
+ const res = await _request("GET", "/market/commercial-rents", { searchParams }, config);
567
+ return res.json();
568
+ }
519
569
  /**
520
570
  * @throws {ApiError<400, Error>}
521
571
  * @throws {ApiError<401, Error>}
@@ -608,6 +658,39 @@ export async function analyticsListingPriceBand(id, config) {
608
658
  * @throws {ApiError<429, Error>}
609
659
  * @throws {ApiError<500, Error>}
610
660
  */
661
+ export async function analyticsBelowMarket(params, config) {
662
+ const searchParams = new URLSearchParams();
663
+ if (params?.city != null)
664
+ searchParams.set("city", String(params.city));
665
+ if (params?.listingType != null)
666
+ searchParams.set("listing_type", String(params.listingType));
667
+ if (params?.propertyType != null)
668
+ searchParams.set("property_type", String(params.propertyType));
669
+ if (params?.beds != null)
670
+ searchParams.set("beds", String(params.beds));
671
+ if (params?.neighborhoodId != null) {
672
+ for (const v of params.neighborhoodId)
673
+ searchParams.append("neighborhood_id", String(v));
674
+ }
675
+ if (params?.minDiscountPct != null)
676
+ searchParams.set("min_discount_pct", String(params.minDiscountPct));
677
+ if (params?.maxDiscountPct != null)
678
+ searchParams.set("max_discount_pct", String(params.maxDiscountPct));
679
+ if (params?.limit != null)
680
+ searchParams.set("limit", String(params.limit));
681
+ if (params?.cursor != null)
682
+ searchParams.set("cursor", String(params.cursor));
683
+ const res = await _request("GET", "/market/below-market", { searchParams }, config);
684
+ return res.json();
685
+ }
686
+ /**
687
+ * @deprecated
688
+ * @throws {ApiError<400, Error>}
689
+ * @throws {ApiError<401, Error>}
690
+ * @throws {ApiError<403, Error>}
691
+ * @throws {ApiError<429, Error>}
692
+ * @throws {ApiError<500, Error>}
693
+ */
611
694
  export async function analyticsDeals(params, config) {
612
695
  const searchParams = new URLSearchParams();
613
696
  if (params?.city != null)
@@ -802,6 +885,8 @@ export async function marketLandPrices(params, config) {
802
885
  for (const v of params.neighborhoodId)
803
886
  searchParams.append("neighborhood_id", String(v));
804
887
  }
888
+ if (params?.groupBy != null)
889
+ searchParams.set("group_by", String(params.groupBy));
805
890
  if (params?.landUse != null)
806
891
  searchParams.set("land_use", String(params.landUse));
807
892
  if (params?.quarterFrom != null)
@@ -86,6 +86,8 @@ export interface Listing {
86
86
  };
87
87
  previous_yearly_sar: number | null;
88
88
  changed_at: string | null;
89
+ price_basis: "yearly_rent" | "sale_price";
90
+ price_source: "asking" | "registered";
89
91
  };
90
92
  financing: {
91
93
  rent_now_pay_later_monthly_sar: number | null;
@@ -104,6 +106,10 @@ export interface Listing {
104
106
  age_years: number | null;
105
107
  furnished: boolean | null;
106
108
  amenities: string[];
109
+ photo_features: {
110
+ feature: "real_photos" | "kitchen_installed" | "ac_split" | "pool" | "roof_terrace" | "balcony" | "large_windows";
111
+ image_index: number | null;
112
+ }[] | null;
107
113
  location: {
108
114
  city: string | null;
109
115
  city_name_en: string | null;
package/dist/openapi.d.ts CHANGED
@@ -56,9 +56,21 @@ export interface operations {
56
56
  };
57
57
  };
58
58
  };
59
+ "reference.coverage": {
60
+ parameters: {
61
+ query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").referenceCoverage>[0]>>, "city">;
62
+ };
63
+ responses: {
64
+ 200: {
65
+ content: {
66
+ "application/json": Awaited<ReturnType<typeof import("./openapi-zod/client.js").referenceCoverage>>;
67
+ };
68
+ };
69
+ };
70
+ };
59
71
  "listings.search": {
60
72
  parameters: {
61
- 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" | "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" | "sort" | "limit" | "cursor">;
62
74
  };
63
75
  responses: {
64
76
  200: {
@@ -70,7 +82,7 @@ export interface operations {
70
82
  };
71
83
  "listings.count": {
72
84
  parameters: {
73
- 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" | "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">;
74
86
  };
75
87
  responses: {
76
88
  200: {
@@ -184,6 +196,18 @@ export interface operations {
184
196
  };
185
197
  };
186
198
  };
199
+ "market.commercial_rents": {
200
+ parameters: {
201
+ query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").marketCommercialRents>[0]>>, "city" | "property_type" | "neighborhood_id" | "area_min" | "area_max" | "min_sample_size">;
202
+ };
203
+ responses: {
204
+ 200: {
205
+ content: {
206
+ "application/json": Awaited<ReturnType<typeof import("./openapi-zod/client.js").marketCommercialRents>>;
207
+ };
208
+ };
209
+ };
210
+ };
187
211
  "official.registered_rents": {
188
212
  parameters: {
189
213
  query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").officialRegisteredRents>[0]>>, "city" | "neighborhood_id" | "property_type" | "period" | "min_sample_size">;
@@ -240,6 +264,18 @@ export interface operations {
240
264
  };
241
265
  };
242
266
  };
267
+ "analytics.below_market": {
268
+ parameters: {
269
+ query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").analyticsBelowMarket>[0]>>, "city" | "listing_type" | "property_type" | "beds" | "neighborhood_id" | "min_discount_pct" | "max_discount_pct" | "limit" | "cursor">;
270
+ };
271
+ responses: {
272
+ 200: {
273
+ content: {
274
+ "application/json": Awaited<ReturnType<typeof import("./openapi-zod/client.js").analyticsBelowMarket>>;
275
+ };
276
+ };
277
+ };
278
+ };
243
279
  "analytics.deals": {
244
280
  parameters: {
245
281
  query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").analyticsDeals>[0]>>, "city" | "listing_type" | "property_type" | "beds" | "neighborhood_id" | "min_discount_pct" | "max_discount_pct" | "limit" | "cursor">;
@@ -314,7 +350,7 @@ export interface operations {
314
350
  };
315
351
  "market.land_prices": {
316
352
  parameters: {
317
- query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").marketLandPrices>[0]>>, "city" | "neighborhood_id" | "land_use" | "quarter_from" | "quarter_to" | "min_sample_size">;
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">;
318
354
  };
319
355
  responses: {
320
356
  200: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kite-sa/sdk",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Official JavaScript/TypeScript client for the Kite API: Saudi real-estate listings and market data.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -26,7 +26,7 @@
26
26
  "directory": "packages/sdk-js"
27
27
  },
28
28
  "bugs": {
29
- "url": "https://github.com/basseko/kite/issues"
29
+ "email": "api@kite.sa"
30
30
  },
31
31
  "author": "Kite",
32
32
  "keywords": [