@kite-sa/sdk 0.9.10 → 0.9.11

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,10 @@
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.11
6
+
7
+ - Webhook project events: `project.created`, `project.licence_issued`, `project.status_changed`, `project.price_changed`, `project.sold_out` and `project.handover_changed`, typed and accepted by `parseWebhookEvent`. Webhook filters take `developer`, `project_ids` and `town` for project events.
8
+
5
9
  ## 0.9.10
6
10
 
7
11
  - `exports.create` accepts the `projects`, `project_models` and `project_availability` datasets, with their filter types (`ProjectExportFilters`, `ProjectModelExportFilters`, `ProjectAvailabilityExportFilters`): `city`, `town`, `project_id` and `kind` on all three.
@@ -1286,7 +1286,10 @@ export declare function createEndpoints(request: Request): {
1286
1286
  }[];
1287
1287
  }>;
1288
1288
  readonly webhooks: {
1289
- /** Create a webhook endpoint. Subscribes an HTTPS URL to listing events. */
1289
+ /**
1290
+ * Create a webhook endpoint. Subscribes an HTTPS URL to listing or project
1291
+ * events.
1292
+ */
1290
1293
  readonly create: (body: BodyOf<"organization.webhooks.create">, headers?: HeaderOf<"organization.webhooks.create">) => Promise<{
1291
1294
  data: {
1292
1295
  id: string;
package/dist/generated.js CHANGED
@@ -288,7 +288,10 @@ export function createEndpoints(request) {
288
288
  query: (params ?? {}),
289
289
  }),
290
290
  webhooks: {
291
- /** Create a webhook endpoint. Subscribes an HTTPS URL to listing events. */
291
+ /**
292
+ * Create a webhook endpoint. Subscribes an HTTPS URL to listing or project
293
+ * events.
294
+ */
292
295
  create: (body, headers) => request("POST", "/organization/webhooks", {
293
296
  body,
294
297
  headers: headers,
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.10";
52
+ export declare const VERSION = "0.9.11";
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.10";
27
+ export const VERSION = "0.9.11";
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;
@@ -2544,6 +2544,9 @@ export declare function organizationWebhooksCreate(body: {
2544
2544
  last_sale_within_months?: string;
2545
2545
  ask_to_last_sale_max?: string;
2546
2546
  plot_sold?: string;
2547
+ developer?: string;
2548
+ project_ids?: string;
2549
+ town?: string;
2547
2550
  };
2548
2551
  description?: string;
2549
2552
  }, params?: {
@@ -2593,6 +2596,9 @@ export declare function organizationWebhooksUpdate(webhookId: string, body: {
2593
2596
  last_sale_within_months?: string;
2594
2597
  ask_to_last_sale_max?: string;
2595
2598
  plot_sold?: string;
2599
+ developer?: string;
2600
+ project_ids?: string;
2601
+ town?: string;
2596
2602
  };
2597
2603
  description?: unknown;
2598
2604
  }, params?: {
@@ -434,6 +434,170 @@ export interface WebhookPriceChangedListingData {
434
434
  url: string;
435
435
  previous_price_yearly_sar: number | null;
436
436
  }
437
+ export interface WebhookProjectCreatedEvent {
438
+ id: string;
439
+ type: "project.created";
440
+ created: string;
441
+ data: WebhookProjectData;
442
+ test?: true;
443
+ }
444
+ export interface WebhookProjectData {
445
+ project_id: number;
446
+ name_ar: string | null;
447
+ name_en: string | null;
448
+ developer: string | null;
449
+ city: string | null;
450
+ town: {
451
+ slug: string;
452
+ name_en: string;
453
+ name_ar: string;
454
+ } | null;
455
+ neighborhood_en: string | null;
456
+ neighborhood_ar: string | null;
457
+ occurred_on: string;
458
+ source: string;
459
+ url: string | null;
460
+ }
461
+ export interface WebhookProjectHandoverChangedEvent {
462
+ id: string;
463
+ type: "project.handover_changed";
464
+ created: string;
465
+ data: WebhookProjectHandoverData;
466
+ test?: true;
467
+ }
468
+ export interface WebhookProjectHandoverData {
469
+ project_id: number;
470
+ name_ar: string | null;
471
+ name_en: string | null;
472
+ developer: string | null;
473
+ city: string | null;
474
+ town: {
475
+ slug: string;
476
+ name_en: string;
477
+ name_ar: string;
478
+ } | null;
479
+ neighborhood_en: string | null;
480
+ neighborhood_ar: string | null;
481
+ occurred_on: string;
482
+ source: string;
483
+ url: string | null;
484
+ handover_date: string;
485
+ previous_handover_date: string;
486
+ slip_days: number;
487
+ }
488
+ export interface WebhookProjectLicenceData {
489
+ project_id: number;
490
+ name_ar: string | null;
491
+ name_en: string | null;
492
+ developer: string | null;
493
+ city: string | null;
494
+ town: {
495
+ slug: string;
496
+ name_en: string;
497
+ name_ar: string;
498
+ } | null;
499
+ neighborhood_en: string | null;
500
+ neighborhood_ar: string | null;
501
+ occurred_on: string;
502
+ source: string;
503
+ url: string | null;
504
+ licence: {
505
+ number: string;
506
+ valid_from: string | null;
507
+ valid_to: string | null;
508
+ };
509
+ renewal: boolean;
510
+ previous_licence: {
511
+ number: string;
512
+ valid_to: string | null;
513
+ } | null;
514
+ }
515
+ export interface WebhookProjectLicenceIssuedEvent {
516
+ id: string;
517
+ type: "project.licence_issued";
518
+ created: string;
519
+ data: WebhookProjectLicenceData;
520
+ test?: true;
521
+ }
522
+ export interface WebhookProjectPriceChangedEvent {
523
+ id: string;
524
+ type: "project.price_changed";
525
+ created: string;
526
+ data: WebhookProjectPriceData;
527
+ test?: true;
528
+ }
529
+ export interface WebhookProjectPriceData {
530
+ project_id: number;
531
+ name_ar: string | null;
532
+ name_en: string | null;
533
+ developer: string | null;
534
+ city: string | null;
535
+ town: {
536
+ slug: string;
537
+ name_en: string;
538
+ name_ar: string;
539
+ } | null;
540
+ neighborhood_en: string | null;
541
+ neighborhood_ar: string | null;
542
+ occurred_on: string;
543
+ source: string;
544
+ url: string | null;
545
+ starting_price_sar: number;
546
+ previous_starting_price_sar: number;
547
+ change_pct: number;
548
+ }
549
+ export interface WebhookProjectSoldOutData {
550
+ project_id: number;
551
+ name_ar: string | null;
552
+ name_en: string | null;
553
+ developer: string | null;
554
+ city: string | null;
555
+ town: {
556
+ slug: string;
557
+ name_en: string;
558
+ name_ar: string;
559
+ } | null;
560
+ neighborhood_en: string | null;
561
+ neighborhood_ar: string | null;
562
+ occurred_on: string;
563
+ source: string;
564
+ url: string | null;
565
+ via: "status" | "available_units";
566
+ previous_available_units: number | null;
567
+ }
568
+ export interface WebhookProjectSoldOutEvent {
569
+ id: string;
570
+ type: "project.sold_out";
571
+ created: string;
572
+ data: WebhookProjectSoldOutData;
573
+ test?: true;
574
+ }
575
+ export interface WebhookProjectStatusChangedEvent {
576
+ id: string;
577
+ type: "project.status_changed";
578
+ created: string;
579
+ data: WebhookProjectStatusData;
580
+ test?: true;
581
+ }
582
+ export interface WebhookProjectStatusData {
583
+ project_id: number;
584
+ name_ar: string | null;
585
+ name_en: string | null;
586
+ developer: string | null;
587
+ city: string | null;
588
+ town: {
589
+ slug: string;
590
+ name_en: string;
591
+ name_ar: string;
592
+ } | null;
593
+ neighborhood_en: string | null;
594
+ neighborhood_ar: string | null;
595
+ occurred_on: string;
596
+ source: string;
597
+ url: string | null;
598
+ status: "available" | "coming_soon" | "not_started" | "under_construction" | "completed" | "sold_out";
599
+ previous_status: "available" | "coming_soon" | "not_started" | "under_construction" | "completed" | "sold_out";
600
+ }
437
601
  export interface WebhookUpdatedListingData {
438
602
  listing_id: number;
439
603
  city: string | null;
@@ -1,10 +1,10 @@
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";
1
+ import type { WebhookListingCreatedEvent, WebhookListingDelistedEvent, WebhookListingPriceChangedEvent, WebhookListingRelistedEvent, WebhookListingUpdatedEvent, WebhookProjectCreatedEvent, WebhookProjectHandoverChangedEvent, WebhookProjectLicenceIssuedEvent, WebhookProjectPriceChangedEvent, WebhookProjectSoldOutEvent, WebhookProjectStatusChangedEvent } from "./openapi-zod/models.js";
2
+ export type { WebhookListingCreatedEvent, WebhookListingData, WebhookListingDelistedEvent, WebhookListingPriceChangedEvent, WebhookListingRelistedEvent, WebhookListingUpdatedEvent, WebhookPriceChangedListingData, WebhookProjectCreatedEvent, WebhookProjectData, WebhookProjectHandoverChangedEvent, WebhookProjectHandoverData, WebhookProjectLicenceData, WebhookProjectLicenceIssuedEvent, WebhookProjectPriceChangedEvent, WebhookProjectPriceData, WebhookProjectSoldOutData, WebhookProjectSoldOutEvent, WebhookProjectStatusChangedEvent, WebhookProjectStatusData, WebhookUpdatedListingData, } from "./openapi-zod/models.js";
3
3
  /** Any event Kite delivers, discriminated on `type`. */
4
- export type WebhookEvent = WebhookListingCreatedEvent | WebhookListingPriceChangedEvent | WebhookListingUpdatedEvent | WebhookListingDelistedEvent | WebhookListingRelistedEvent;
4
+ export type WebhookEvent = WebhookListingCreatedEvent | WebhookListingPriceChangedEvent | WebhookListingUpdatedEvent | WebhookListingDelistedEvent | WebhookListingRelistedEvent | WebhookProjectCreatedEvent | WebhookProjectLicenceIssuedEvent | WebhookProjectStatusChangedEvent | WebhookProjectPriceChangedEvent | WebhookProjectSoldOutEvent | WebhookProjectHandoverChangedEvent;
5
5
  export type WebhookEventType = WebhookEvent["type"];
6
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"];
7
+ export declare const WEBHOOK_EVENT_TYPES: readonly ["listing.created", "listing.price_changed", "listing.updated", "listing.delisted", "listing.relisted", "project.created", "project.licence_issued", "project.status_changed", "project.price_changed", "project.sold_out", "project.handover_changed"];
8
8
  /**
9
9
  * Header Kite signs each webhook delivery with. Deliveries also carry the
10
10
  * deprecated `Darak-Signature` with the same value; either verifies.
package/dist/webhooks.js CHANGED
@@ -6,6 +6,12 @@ export const WEBHOOK_EVENT_TYPES = [
6
6
  "listing.updated",
7
7
  "listing.delisted",
8
8
  "listing.relisted",
9
+ "project.created",
10
+ "project.licence_issued",
11
+ "project.status_changed",
12
+ "project.price_changed",
13
+ "project.sold_out",
14
+ "project.handover_changed",
9
15
  ];
10
16
  /**
11
17
  * Header Kite signs each webhook delivery with. Deliveries also carry the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kite-sa/sdk",
3
- "version": "0.9.10",
3
+ "version": "0.9.11",
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",