@kite-sa/sdk 0.9.2 → 0.9.4

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,6 +2,16 @@
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.9.4
6
+
7
+ - `projects.models(id)` lists a project's unit models: type, bedrooms, size, units in total and available, and the full and beneficiary price ranges of the available units (`GET /projects/{id}/models`).
8
+ - Absorption (`projects.absorption`, `market.absorption`) now measures Sakani projects; descriptions updated, no shape change.
9
+
10
+ ## 0.9.3
11
+
12
+ - `projects.availability` takes `source` and returns `coverage.source` and `coverage.sources`: a project published by several sources is read from the one that counts available units, and any other can be asked for.
13
+ - A project's `price` has `source`, the copy of the project the prices came from. `price` and `advertised_unit_count` are filled from another copy of the same project when the served one publishes none.
14
+
5
15
  ## 0.9.2
6
16
 
7
17
  - `parseWebhookEvent(header, body, secret)` from `@kite-sa/sdk/webhooks` verifies a delivery and returns its event typed by `type`; it throws `WebhookError` on a bad signature, a non-event body or an unknown type. `WebhookEvent`, `WebhookEventType`, `WEBHOOK_EVENT_TYPES` and the per-type event interfaces (`WebhookListingCreatedEvent`, …) are generated from the API's OpenAPI `webhooks` schemas. The README has a minimal receiver.
@@ -1456,9 +1456,16 @@ export declare function createEndpoints(request: Request): {
1456
1456
  to: string;
1457
1457
  unit_type: string | null;
1458
1458
  coverage: {
1459
+ source: string | null;
1459
1460
  first_snapshot: string | null;
1460
1461
  last_snapshot: string | null;
1461
1462
  snapshots: number;
1463
+ sources: {
1464
+ source: string;
1465
+ first_snapshot: string | null;
1466
+ last_snapshot: string | null;
1467
+ snapshots: number;
1468
+ }[];
1462
1469
  };
1463
1470
  points: {
1464
1471
  date: string;
@@ -1518,6 +1525,7 @@ export declare function createEndpoints(request: Request): {
1518
1525
  starting_sar: unknown;
1519
1526
  from_sar: unknown;
1520
1527
  to_sar: unknown;
1528
+ source: string | null;
1521
1529
  };
1522
1530
  area_sqm: {
1523
1531
  min: number | null;
@@ -1596,6 +1604,59 @@ export declare function createEndpoints(request: Request): {
1596
1604
  };
1597
1605
  };
1598
1606
  }>;
1607
+ /**
1608
+ * List a project's unit models. The designs a project sells, one entry per
1609
+ * model: its type, bedrooms, size, how many units there are and how many are
1610
+ * still available, and the price range of the available ones, both the full
1611
+ * price and the price for a buyer eligible for housing support.
1612
+ */
1613
+ readonly models: (id: string | number, params?: QueryOf<"projects.models">) => Promise<{
1614
+ data: {
1615
+ project_id: number;
1616
+ source: string | null;
1617
+ as_of: unknown;
1618
+ totals: {
1619
+ models: number;
1620
+ models_on_offer: number;
1621
+ units: unknown;
1622
+ units_available: unknown;
1623
+ };
1624
+ models: {
1625
+ id: number;
1626
+ name: string | null;
1627
+ unit_type: unknown;
1628
+ bedrooms: {
1629
+ min: unknown;
1630
+ max: unknown;
1631
+ };
1632
+ bathrooms: {
1633
+ min: unknown;
1634
+ max: unknown;
1635
+ };
1636
+ size_sqm: {
1637
+ min: number | null;
1638
+ max: number | null;
1639
+ basis: unknown;
1640
+ };
1641
+ price_sar: {
1642
+ min: unknown;
1643
+ max: unknown;
1644
+ };
1645
+ beneficiary_price_sar: {
1646
+ min: unknown;
1647
+ max: unknown;
1648
+ };
1649
+ units: {
1650
+ total: unknown;
1651
+ available: unknown;
1652
+ };
1653
+ on_offer: boolean;
1654
+ developer_model: unknown;
1655
+ first_seen_at: unknown;
1656
+ last_seen_at: unknown;
1657
+ }[];
1658
+ };
1659
+ }>;
1599
1660
  /**
1600
1661
  * Search projects. Off-plan and newly built residential and commercial projects
1601
1662
  * from Saudi developers and portals, one entry per project (copies from several
@@ -1625,6 +1686,7 @@ export declare function createEndpoints(request: Request): {
1625
1686
  starting_sar: unknown;
1626
1687
  from_sar: unknown;
1627
1688
  to_sar: unknown;
1689
+ source: string | null;
1628
1690
  };
1629
1691
  area_sqm: {
1630
1692
  min: number | null;
package/dist/generated.js CHANGED
@@ -358,6 +358,13 @@ export function createEndpoints(request) {
358
358
  * financing banks and a summary of the units listed on Kite.
359
359
  */
360
360
  get: (id) => request("GET", `/projects/${encodeURIComponent(String(id))}`),
361
+ /**
362
+ * List a project's unit models. The designs a project sells, one entry per
363
+ * model: its type, bedrooms, size, how many units there are and how many are
364
+ * still available, and the price range of the available ones, both the full
365
+ * price and the price for a buyer eligible for housing support.
366
+ */
367
+ models: (id, params) => request("GET", `/projects/${encodeURIComponent(String(id))}/models`, { query: (params ?? {}) }),
361
368
  /**
362
369
  * Search projects. Off-plan and newly built residential and commercial projects
363
370
  * from Saudi developers and portals, one entry per project (copies from several
package/dist/index.d.ts CHANGED
@@ -49,7 +49,7 @@ export interface KiteOptions {
49
49
  }
50
50
  type Query = Record<string, string | number | boolean | readonly (string | number)[] | undefined>;
51
51
  /** Kept in step with package.json by src/index.test.ts. */
52
- export declare const VERSION = "0.9.2";
52
+ export declare const VERSION = "0.9.4";
53
53
  /** Arrays go comma-separated, as the API expects; unset values are dropped. */
54
54
  export declare function toSearchParams(query?: Query): string;
55
55
  /**
package/dist/index.js CHANGED
@@ -24,7 +24,7 @@ export class KiteError extends Error {
24
24
  }
25
25
  }
26
26
  /** Kept in step with package.json by src/index.test.ts. */
27
- export const VERSION = "0.9.2";
27
+ export const VERSION = "0.9.4";
28
28
  const USER_AGENT = `kite-sa-js/${VERSION}`;
29
29
  /** Longest Retry-After worth waiting for; anything longer (a monthly quota) throws. */
30
30
  const MAX_RETRY_WAIT_S = 60;
@@ -1622,6 +1622,7 @@ export declare function projectsSearch(params?: {
1622
1622
  starting_sar: unknown;
1623
1623
  from_sar: unknown;
1624
1624
  to_sar: unknown;
1625
+ source: string | null;
1625
1626
  };
1626
1627
  area_sqm: {
1627
1628
  min: number | null;
@@ -1679,6 +1680,7 @@ export declare function projectsGet(id: number, config?: Partial<ClientConfig>):
1679
1680
  starting_sar: unknown;
1680
1681
  from_sar: unknown;
1681
1682
  to_sar: unknown;
1683
+ source: string | null;
1682
1684
  };
1683
1685
  area_sqm: {
1684
1686
  min: number | null;
@@ -1835,6 +1837,7 @@ export declare function projectsAvailability(id: number, params?: {
1835
1837
  from?: string;
1836
1838
  to?: string;
1837
1839
  unitType?: string;
1840
+ source?: string;
1838
1841
  }, config?: Partial<ClientConfig>): Promise<{
1839
1842
  data: {
1840
1843
  project_id: number;
@@ -1843,9 +1846,16 @@ export declare function projectsAvailability(id: number, params?: {
1843
1846
  to: string;
1844
1847
  unit_type: string | null;
1845
1848
  coverage: {
1849
+ source: string | null;
1846
1850
  first_snapshot: string | null;
1847
1851
  last_snapshot: string | null;
1848
1852
  snapshots: number;
1853
+ sources: {
1854
+ source: string;
1855
+ first_snapshot: string | null;
1856
+ last_snapshot: string | null;
1857
+ snapshots: number;
1858
+ }[];
1849
1859
  };
1850
1860
  points: {
1851
1861
  date: string;
@@ -2082,6 +2092,64 @@ export declare function marketAbsorption(params?: {
2082
2092
  }[];
2083
2093
  };
2084
2094
  }>;
2095
+ /**
2096
+ * @throws {ApiError<400, Error>}
2097
+ * @throws {ApiError<401, Error>}
2098
+ * @throws {ApiError<403, Error>}
2099
+ * @throws {ApiError<404, Error>}
2100
+ * @throws {ApiError<429, Error>}
2101
+ * @throws {ApiError<500, Error>}
2102
+ */
2103
+ export declare function projectsModels(id: number, params?: {
2104
+ unitType?: "apartment" | "villa" | "townhouse";
2105
+ onOffer?: "true" | "false";
2106
+ }, config?: Partial<ClientConfig>): Promise<{
2107
+ data: {
2108
+ project_id: number;
2109
+ source: string | null;
2110
+ as_of: unknown;
2111
+ totals: {
2112
+ models: number;
2113
+ models_on_offer: number;
2114
+ units: unknown;
2115
+ units_available: unknown;
2116
+ };
2117
+ models: {
2118
+ id: number;
2119
+ name: string | null;
2120
+ unit_type: unknown;
2121
+ bedrooms: {
2122
+ min: unknown;
2123
+ max: unknown;
2124
+ };
2125
+ bathrooms: {
2126
+ min: unknown;
2127
+ max: unknown;
2128
+ };
2129
+ size_sqm: {
2130
+ min: number | null;
2131
+ max: number | null;
2132
+ basis: unknown;
2133
+ };
2134
+ price_sar: {
2135
+ min: unknown;
2136
+ max: unknown;
2137
+ };
2138
+ beneficiary_price_sar: {
2139
+ min: unknown;
2140
+ max: unknown;
2141
+ };
2142
+ units: {
2143
+ total: unknown;
2144
+ available: unknown;
2145
+ };
2146
+ on_offer: boolean;
2147
+ developer_model: unknown;
2148
+ first_seen_at: unknown;
2149
+ last_seen_at: unknown;
2150
+ }[];
2151
+ };
2152
+ }>;
2085
2153
  /**
2086
2154
  * @throws {ApiError<400, Error>}
2087
2155
  * @throws {ApiError<401, Error>}
@@ -1319,6 +1319,8 @@ export async function projectsAvailability(id, params, config) {
1319
1319
  searchParams.set("to", String(params.to));
1320
1320
  if (params?.unitType != null)
1321
1321
  searchParams.set("unit_type", String(params.unitType));
1322
+ if (params?.source != null)
1323
+ searchParams.set("source", String(params.source));
1322
1324
  const res = await _request("GET", `/projects/${encodeURIComponent(id)}/availability`, { searchParams }, config);
1323
1325
  return res.json();
1324
1326
  }
@@ -1459,6 +1461,23 @@ export async function marketAbsorption(params, config) {
1459
1461
  const res = await _request("GET", "/market/absorption", { searchParams }, config);
1460
1462
  return res.json();
1461
1463
  }
1464
+ /**
1465
+ * @throws {ApiError<400, Error>}
1466
+ * @throws {ApiError<401, Error>}
1467
+ * @throws {ApiError<403, Error>}
1468
+ * @throws {ApiError<404, Error>}
1469
+ * @throws {ApiError<429, Error>}
1470
+ * @throws {ApiError<500, Error>}
1471
+ */
1472
+ export async function projectsModels(id, params, config) {
1473
+ const searchParams = new URLSearchParams();
1474
+ if (params?.unitType != null)
1475
+ searchParams.set("unit_type", String(params.unitType));
1476
+ if (params?.onOffer != null)
1477
+ searchParams.set("on_offer", String(params.onOffer));
1478
+ const res = await _request("GET", `/projects/${encodeURIComponent(id)}/models`, { searchParams }, config);
1479
+ return res.json();
1480
+ }
1462
1481
  /**
1463
1482
  * @throws {ApiError<400, Error>}
1464
1483
  * @throws {ApiError<401, Error>}
package/dist/openapi.d.ts CHANGED
@@ -466,7 +466,7 @@ export interface operations {
466
466
  };
467
467
  "projects.availability": {
468
468
  parameters: {
469
- query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").projectsAvailability>[1]>>, "interval" | "from" | "to" | "unit_type">;
469
+ query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").projectsAvailability>[1]>>, "interval" | "from" | "to" | "unit_type" | "source">;
470
470
  };
471
471
  responses: {
472
472
  200: {
@@ -524,6 +524,18 @@ export interface operations {
524
524
  };
525
525
  };
526
526
  };
527
+ "projects.models": {
528
+ parameters: {
529
+ query?: Pick<SnakeKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").projectsModels>[1]>>, "unit_type" | "on_offer">;
530
+ };
531
+ responses: {
532
+ 200: {
533
+ content: {
534
+ "application/json": Awaited<ReturnType<typeof import("./openapi-zod/client.js").projectsModels>>;
535
+ };
536
+ };
537
+ };
538
+ };
527
539
  "exports.create": {
528
540
  parameters: {
529
541
  header?: Pick<HeaderKeys<NonNullable<Parameters<typeof import("./openapi-zod/client.js").exportsCreate>[1]>>, "Idempotency-Key">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kite-sa/sdk",
3
- "version": "0.9.2",
3
+ "version": "0.9.4",
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",