@zimmerstack/connect 0.9.0 → 0.9.1
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/AGENTS.md +41 -15
- package/README.md +145 -55
- package/dist/cjs/client.d.ts +33 -8
- package/dist/cjs/client.js +42 -8
- package/dist/cjs/doctor.js +1 -1
- package/dist/cjs/generated.d.ts +54 -10
- package/dist/cjs/generated.js +3 -1
- package/dist/esm/client.d.ts +33 -8
- package/dist/esm/client.js +42 -8
- package/dist/esm/doctor.js +1 -1
- package/dist/esm/generated.d.ts +54 -10
- package/dist/esm/generated.js +3 -1
- package/dist/esm/mcp/cli.js +7 -2
- package/dist/esm/mcp/reference.generated.js +1557 -312
- package/package.json +2 -2
package/dist/cjs/client.js
CHANGED
|
@@ -229,7 +229,7 @@ class Core {
|
|
|
229
229
|
constructor(options) {
|
|
230
230
|
const g = globalThis;
|
|
231
231
|
if ((typeof g.window !== "undefined" && typeof g.window.document !== "undefined") || g.navigator?.product === "ReactNative") {
|
|
232
|
-
throw new errors_ts_1.ZimmerStackUsageError("@zimmerstack/connect runs on a server only. A key in a browser or a mobile app can be read by anyone and can change a hotel's prices on every channel: call your own server from here, and ZimmerStack from your server (https://docs.zimmerstack.com/
|
|
232
|
+
throw new errors_ts_1.ZimmerStackUsageError("@zimmerstack/connect runs on a server only. A key in a browser or a mobile app can be read by anyone and can change a hotel's prices on every channel: call your own server from here, and ZimmerStack from your server (https://docs.zimmerstack.com/guides/node-package#no-server shows the smallest one). If a key was built into this page, anyone can read it now: revoke it and make a new one.");
|
|
233
233
|
}
|
|
234
234
|
const key = options.apiKey ?? env("ZIMMERSTACK_CONNECT_KEY");
|
|
235
235
|
if (!key)
|
|
@@ -709,6 +709,35 @@ class ZimmerStack {
|
|
|
709
709
|
this.#forgetWhichHotels();
|
|
710
710
|
return created;
|
|
711
711
|
},
|
|
712
|
+
/**
|
|
713
|
+
* Change a hotel YOU ADDED: its name, its address, or both. A company key with the scope properties:write.
|
|
714
|
+
*
|
|
715
|
+
* Send only what changes: `name`, and under `address` any of `line1`, `city`, `state` and `postalCode`. A
|
|
716
|
+
* field you leave out stays as it is. It never changes the hotel's country, currency, time zone, owner or
|
|
717
|
+
* tax id (sending one is refused with VALIDATION), and it changes the hotel's record in ZimmerStack, not
|
|
718
|
+
* the name of its listing on a booking site.
|
|
719
|
+
*
|
|
720
|
+
* The answer is the hotel with its `address` and `changed`: the fields whose stored value moved. An empty
|
|
721
|
+
* `changed` means everything you sent was already stored. A hotel whose owner let you in is refused with
|
|
722
|
+
* PROPERTY_NOT_CHANGEABLE: its owner changes it. With a test key it changes one of your sandboxes, whose
|
|
723
|
+
* name keeps its ending, "(sandbox)". Safe to retry: the call carries an idempotency key.
|
|
724
|
+
*
|
|
725
|
+
* After a new name, `zs.properties.delete` wants that new name in `confirm`.
|
|
726
|
+
*
|
|
727
|
+
* @example
|
|
728
|
+
* const hotel = await zs.properties.update(61, { name: "Sea Breeze Suites", address: { line1: "14 Beach Road" } });
|
|
729
|
+
* hotel.changed; // ["name", "address.line1"]
|
|
730
|
+
*/
|
|
731
|
+
update: async (propertyId, changes, options) => {
|
|
732
|
+
if (!Number.isInteger(propertyId) || propertyId <= 0) {
|
|
733
|
+
throw new errors_ts_1.ZimmerStackUsageError("zs.properties.update needs the hotel's numeric id (zs.properties.list() names them)");
|
|
734
|
+
}
|
|
735
|
+
const sent = changes?.name !== undefined || Object.values(changes?.address ?? {}).some((value) => value !== undefined);
|
|
736
|
+
if (!sent) {
|
|
737
|
+
throw new errors_ts_1.ZimmerStackUsageError("zs.properties.update needs something to change: name, or line1, city, state or postalCode under address.");
|
|
738
|
+
}
|
|
739
|
+
return this.request("PATCH /properties/{propertyId}", { path: { propertyId }, body: changes, ...options });
|
|
740
|
+
},
|
|
712
741
|
/**
|
|
713
742
|
* Remove a hotel YOU ADDED, for good. A company key with the scope properties:write.
|
|
714
743
|
*
|
|
@@ -913,19 +942,24 @@ class ZimmerStack {
|
|
|
913
942
|
/** Your connect links, newest first; `propertyId` narrows them to one hotel. */
|
|
914
943
|
list: (query, options) => this.request("GET /connect-links", { query, ...options }),
|
|
915
944
|
/**
|
|
916
|
-
* Make a one-time link for ONE hotel and ONE booking site.
|
|
917
|
-
*
|
|
918
|
-
*
|
|
919
|
-
*
|
|
945
|
+
* Make a one-time link for ONE hotel and ONE booking site. Only Airbnb is connected from the link alone
|
|
946
|
+
* (the host signs in on Airbnb's own page). Every other booking site must FIRST accept our connectivity
|
|
947
|
+
* partner for the hotel, in its extranet or through its support: send `hotelStep` to the hotel first, and
|
|
948
|
+
* the answer's `url` once that step is done. On ZimmerStack's hosted page the hotel's own person types
|
|
949
|
+
* the hotel's id at the booking site (MakeMyTrip also its access token), confirms every room and rate
|
|
950
|
+
* match and presses Start selling. The call takes no booking-site detail and no match. You hear
|
|
951
|
+
* `channel.connect.completed`, or `channel.connect.expired` if the link ran out.
|
|
920
952
|
*
|
|
921
953
|
* THE `url` IS SHOWN ONCE: it is in this answer only, and null on a replay of the same request
|
|
922
954
|
* (`shownOnce(answer)` returns it or says what to do). `hotelStep` is what the hotel does at the booking
|
|
923
|
-
* site first, for your own screen or message. A LIVE key only: a
|
|
924
|
-
* key is refused (LIVE_KEY_REQUIRED). The hotel is `propertyId`
|
|
955
|
+
* site first (null for Airbnb), for your own screen or message; it can take days. A LIVE key only: a
|
|
956
|
+
* sandbox has no booking site, so a test key is refused (LIVE_KEY_REQUIRED). The hotel is `propertyId`
|
|
957
|
+
* in the body; `forProperty` is not read.
|
|
925
958
|
*
|
|
926
959
|
* @example
|
|
927
960
|
* const made = await zs.connectLinks.create({ propertyId: 61, channel: "bookingcom", returnUrl: "https://pms.example/hotels/61" });
|
|
928
|
-
* await
|
|
961
|
+
* await tellTheHotel(made.hotelStep); // first
|
|
962
|
+
* await sendOnceTheStepIsDone(shownOnce(made)); // then the link
|
|
929
963
|
*/
|
|
930
964
|
create: (body, options) => this.request("POST /connect-links", { body, ...options }),
|
|
931
965
|
/** Where one link stands: pending, opened, completed, expired or revoked. Never its address again. */
|
package/dist/cjs/doctor.js
CHANGED
|
@@ -260,7 +260,7 @@ async function requestFindings(zs, now, signal) {
|
|
|
260
260
|
level: recent || fault ? "attention" : "info",
|
|
261
261
|
check: "requests",
|
|
262
262
|
message: `${reason}: ${plural(items.length, "request")} refused in the last 24 hours${more ? " (and more)" : ""}, the last ${ago(last.at, now)}, on ${list(routes)}.${last.requestId ? ` Last request id: ${last.requestId}.` : ""}`,
|
|
263
|
-
action: REFUSAL_ADVICE[reason] ?? (fault ? "That is a fault on ZimmerStack's side. If it repeats, write to support@zimmerstack.com and quote the request id." : "Look the code up: https://docs.zimmerstack.com/errors"),
|
|
263
|
+
action: REFUSAL_ADVICE[reason] ?? (fault ? "That is a fault on ZimmerStack's side. If it repeats, write to support@zimmerstack.com and quote the request id." : "Look the code up: https://docs.zimmerstack.com/guides/errors"),
|
|
264
264
|
});
|
|
265
265
|
}
|
|
266
266
|
// The newest requests of any status, for the addresses they came from: an address that is not yours is the first sign of a leaked key.
|
package/dist/cjs/generated.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** This package's version, sent as the user agent so ZimmerStack can tell which client a request came from. */
|
|
2
|
-
export declare const SDK_VERSION = "0.9.
|
|
2
|
+
export declare const SDK_VERSION = "0.9.1";
|
|
3
3
|
/** Where the API lives. The key is sent nowhere else. */
|
|
4
4
|
export declare const API_ORIGIN = "https://api.zimmerstack.com";
|
|
5
5
|
export declare const API_PREFIX = "/api/v1/connect-api/v1";
|
|
@@ -31,7 +31,7 @@ export declare const LIMITS: {
|
|
|
31
31
|
readonly maxNightsPerBooking: 90;
|
|
32
32
|
};
|
|
33
33
|
/** Every stable error code (`error.code`). Messages are for people and may change; branch on these. */
|
|
34
|
-
export declare const ERROR_CODES: readonly ["API_KEY_INVALID", "API_KEY_REVOKED", "API_KEY_EXPIRED", "CONNECT_API_NOT_CONFIGURED", "IP_NOT_ALLOWED", "SCOPE_MISSING", "PROPERTY_UNAVAILABLE", "CHANNEL_MANAGER_DISABLED", "PMS_NOT_AVAILABLE", "VALIDATION", "RANGE_INVALID", "HORIZON", "TOO_MANY_UPDATES", "TOO_MANY_CELLS", "UNKNOWN_ROOM_TYPE", "UNKNOWN_RATE_PLAN", "CURRENCY_MISMATCH", "RATE_LIMITED", "NOTHING_ACCEPTED", "BATCH_NOT_FOUND", "IDEMPOTENCY_KEY_INVALID", "IDEMPOTENCY_KEY_REUSED", "IDEMPOTENCY_IN_FLIGHT", "STAY_INVALID", "UNKNOWN_ROOM_TYPE_FOR_PLAN", "OCCUPANCY_EXCEEDED", "NO_AVAILABILITY", "EXTERNAL_REFERENCE_REUSED", "PAYMENT_NOT_ALLOWED", "PAYMENT_EXCEEDS_TOTAL", "TAXES_NOT_CONFIGURED", "TAXES_INSIDE_RATES", "BOOKING_NOT_FOUND", "BOOKING_NOT_CANCELLABLE", "MODULE_NOT_ENTITLED", "SANDBOX_ONLY", "ROOM_TYPE_NOT_FOUND", "RATE_PLAN_NOT_FOUND", "CATALOG_CONFLICT", "CATALOG_BUSY", "CHANNEL_MANAGER_ERROR", "WEBHOOK_ENDPOINT_NOT_FOUND", "WEBHOOK_DELIVERY_NOT_FOUND", "WEBHOOK_ENDPOINT_LIMIT", "WEBHOOK_ENDPOINT_NOT_ACTIVE", "WEBHOOK_ENDPOINT_SUSPENDED", "WEBHOOK_PAYLOAD_EXPIRED", "WEBHOOK_ACCESS_ENDED", "WEBHOOKS_UNAVAILABLE", "PROPERTY_REQUIRED", "PROPERTY_NOT_FOUND", "ARI_NOT_AUTHORITATIVE", "ROUTE_NOT_FOUND", "PAYLOAD_TOO_LARGE", "AUTH_BACKEND_UNAVAILABLE", "BOOKING_NOT_MODIFIABLE", "SANDBOX_NOT_FOUND", "SANDBOX_INCOMPLETE", "WRITES_FROZEN", "WRITES_SUSPENDED", "SHIELD_UNAVAILABLE", "CATALOG_LIMIT_REACHED", "TOO_MANY_NEW_ENTITIES", "RATE_OUT_OF_BAND", "CHANNEL_NOT_FOUND", "CHANNEL_SHARED", "MODIFIER_OUT_OF_BAND", "COMPANY_KEY_REQUIRED", "BILLING_SETUP_REQUIRED", "OWNER_HAS_ACCOUNT", "SANDBOX_LIMIT", "CONFIRMATION_MISMATCH", "PROPERTY_NOT_REMOVABLE", "PROPERTY_BUSY", "PRICE_UNAVAILABLE", "CONNECT_LINK_NOT_FOUND", "CONNECT_LINKS_UNAVAILABLE", "CHANNEL_NOT_AVAILABLE", "LIVE_KEY_REQUIRED", "NOT_READY", "KEY_NOT_FOUND", "KEY_LIMIT", "KEY_REVOKED", "KEY_ALREADY_ROTATING", "SCOPES_INVALID", "ALLOWED_CIDRS_INVALID", "REASON_REQUIRED", "SUPPORT_TICKET_NOT_FOUND", "SUPPORT_TICKET_CLOSED"];
|
|
34
|
+
export declare const ERROR_CODES: readonly ["API_KEY_INVALID", "API_KEY_REVOKED", "API_KEY_EXPIRED", "CONNECT_API_NOT_CONFIGURED", "IP_NOT_ALLOWED", "SCOPE_MISSING", "PROPERTY_UNAVAILABLE", "CHANNEL_MANAGER_DISABLED", "PMS_NOT_AVAILABLE", "VALIDATION", "RANGE_INVALID", "HORIZON", "TOO_MANY_UPDATES", "TOO_MANY_CELLS", "UNKNOWN_ROOM_TYPE", "UNKNOWN_RATE_PLAN", "CURRENCY_MISMATCH", "RATE_LIMITED", "NOTHING_ACCEPTED", "BATCH_NOT_FOUND", "IDEMPOTENCY_KEY_INVALID", "IDEMPOTENCY_KEY_REUSED", "IDEMPOTENCY_IN_FLIGHT", "STAY_INVALID", "UNKNOWN_ROOM_TYPE_FOR_PLAN", "OCCUPANCY_EXCEEDED", "NO_AVAILABILITY", "EXTERNAL_REFERENCE_REUSED", "PAYMENT_NOT_ALLOWED", "PAYMENT_EXCEEDS_TOTAL", "TAXES_NOT_CONFIGURED", "TAXES_INSIDE_RATES", "BOOKING_NOT_FOUND", "BOOKING_NOT_CANCELLABLE", "MODULE_NOT_ENTITLED", "SANDBOX_ONLY", "ROOM_TYPE_NOT_FOUND", "RATE_PLAN_NOT_FOUND", "CATALOG_CONFLICT", "CATALOG_BUSY", "CHANNEL_MANAGER_ERROR", "WEBHOOK_ENDPOINT_NOT_FOUND", "WEBHOOK_DELIVERY_NOT_FOUND", "WEBHOOK_ENDPOINT_LIMIT", "WEBHOOK_ENDPOINT_NOT_ACTIVE", "WEBHOOK_ENDPOINT_SUSPENDED", "WEBHOOK_PAYLOAD_EXPIRED", "WEBHOOK_ACCESS_ENDED", "WEBHOOKS_UNAVAILABLE", "PROPERTY_REQUIRED", "PROPERTY_NOT_FOUND", "ARI_NOT_AUTHORITATIVE", "ROUTE_NOT_FOUND", "PAYLOAD_TOO_LARGE", "AUTH_BACKEND_UNAVAILABLE", "BOOKING_NOT_MODIFIABLE", "SANDBOX_NOT_FOUND", "SANDBOX_INCOMPLETE", "WRITES_FROZEN", "WRITES_SUSPENDED", "SHIELD_UNAVAILABLE", "CATALOG_LIMIT_REACHED", "TOO_MANY_NEW_ENTITIES", "RATE_OUT_OF_BAND", "CHANNEL_NOT_FOUND", "CHANNEL_SHARED", "MODIFIER_OUT_OF_BAND", "COMPANY_KEY_REQUIRED", "BILLING_SETUP_REQUIRED", "OWNER_HAS_ACCOUNT", "SANDBOX_LIMIT", "CONFIRMATION_MISMATCH", "PROPERTY_NOT_REMOVABLE", "PROPERTY_NOT_CHANGEABLE", "PROPERTY_BUSY", "PRICE_UNAVAILABLE", "CONNECT_LINK_NOT_FOUND", "CONNECT_LINKS_UNAVAILABLE", "CHANNEL_NOT_AVAILABLE", "LIVE_KEY_REQUIRED", "NOT_READY", "KEY_NOT_FOUND", "KEY_LIMIT", "KEY_REVOKED", "KEY_ALREADY_ROTATING", "SCOPES_INVALID", "ALLOWED_CIDRS_INVALID", "REASON_REQUIRED", "SUPPORT_TICKET_NOT_FOUND", "SUPPORT_TICKET_CLOSED"];
|
|
35
35
|
export type ErrorCode = (typeof ERROR_CODES)[number];
|
|
36
36
|
/** What a key may do. The hotel's owner (or, for a vendor's key, the vendor) chose them when the key was made. */
|
|
37
37
|
export declare const SCOPES: readonly ["ari:read", "ari:write", "catalog:write", "channel-modifiers:write", "channel-bookings:read", "direct-bookings:read", "direct-bookings:cancel", "bookings:read", "bookings:write", "bookings:payments", "properties:write", "webhooks:manage", "channels:connect", "keys:manage", "billing:read", "support:write"];
|
|
@@ -159,7 +159,7 @@ export interface Error {
|
|
|
159
159
|
/** Human-readable, may change; branch on data.code */
|
|
160
160
|
message: string;
|
|
161
161
|
data: {
|
|
162
|
-
code: "API_KEY_INVALID" | "API_KEY_REVOKED" | "API_KEY_EXPIRED" | "CONNECT_API_NOT_CONFIGURED" | "IP_NOT_ALLOWED" | "SCOPE_MISSING" | "PROPERTY_UNAVAILABLE" | "CHANNEL_MANAGER_DISABLED" | "PMS_NOT_AVAILABLE" | "VALIDATION" | "RANGE_INVALID" | "HORIZON" | "TOO_MANY_UPDATES" | "TOO_MANY_CELLS" | "UNKNOWN_ROOM_TYPE" | "UNKNOWN_RATE_PLAN" | "CURRENCY_MISMATCH" | "RATE_LIMITED" | "NOTHING_ACCEPTED" | "BATCH_NOT_FOUND" | "IDEMPOTENCY_KEY_INVALID" | "IDEMPOTENCY_KEY_REUSED" | "IDEMPOTENCY_IN_FLIGHT" | "STAY_INVALID" | "UNKNOWN_ROOM_TYPE_FOR_PLAN" | "OCCUPANCY_EXCEEDED" | "NO_AVAILABILITY" | "EXTERNAL_REFERENCE_REUSED" | "PAYMENT_NOT_ALLOWED" | "PAYMENT_EXCEEDS_TOTAL" | "TAXES_NOT_CONFIGURED" | "TAXES_INSIDE_RATES" | "BOOKING_NOT_FOUND" | "BOOKING_NOT_CANCELLABLE" | "MODULE_NOT_ENTITLED" | "SANDBOX_ONLY" | "ROOM_TYPE_NOT_FOUND" | "RATE_PLAN_NOT_FOUND" | "CATALOG_CONFLICT" | "CATALOG_BUSY" | "CHANNEL_MANAGER_ERROR" | "WEBHOOK_ENDPOINT_NOT_FOUND" | "WEBHOOK_DELIVERY_NOT_FOUND" | "WEBHOOK_ENDPOINT_LIMIT" | "WEBHOOK_ENDPOINT_NOT_ACTIVE" | "WEBHOOK_ENDPOINT_SUSPENDED" | "WEBHOOK_PAYLOAD_EXPIRED" | "WEBHOOK_ACCESS_ENDED" | "WEBHOOKS_UNAVAILABLE" | "PROPERTY_REQUIRED" | "PROPERTY_NOT_FOUND" | "ARI_NOT_AUTHORITATIVE" | "ROUTE_NOT_FOUND" | "PAYLOAD_TOO_LARGE" | "AUTH_BACKEND_UNAVAILABLE" | "BOOKING_NOT_MODIFIABLE" | "SANDBOX_NOT_FOUND" | "SANDBOX_INCOMPLETE" | "WRITES_FROZEN" | "WRITES_SUSPENDED" | "SHIELD_UNAVAILABLE" | "CATALOG_LIMIT_REACHED" | "TOO_MANY_NEW_ENTITIES" | "RATE_OUT_OF_BAND" | "CHANNEL_NOT_FOUND" | "CHANNEL_SHARED" | "MODIFIER_OUT_OF_BAND" | "COMPANY_KEY_REQUIRED" | "BILLING_SETUP_REQUIRED" | "OWNER_HAS_ACCOUNT" | "SANDBOX_LIMIT" | "CONFIRMATION_MISMATCH" | "PROPERTY_NOT_REMOVABLE" | "PROPERTY_BUSY" | "PRICE_UNAVAILABLE" | "CONNECT_LINK_NOT_FOUND" | "CONNECT_LINKS_UNAVAILABLE" | "CHANNEL_NOT_AVAILABLE" | "LIVE_KEY_REQUIRED" | "NOT_READY" | "KEY_NOT_FOUND" | "KEY_LIMIT" | "KEY_REVOKED" | "KEY_ALREADY_ROTATING" | "SCOPES_INVALID" | "ALLOWED_CIDRS_INVALID" | "REASON_REQUIRED" | "SUPPORT_TICKET_NOT_FOUND" | "SUPPORT_TICKET_CLOSED";
|
|
162
|
+
code: "API_KEY_INVALID" | "API_KEY_REVOKED" | "API_KEY_EXPIRED" | "CONNECT_API_NOT_CONFIGURED" | "IP_NOT_ALLOWED" | "SCOPE_MISSING" | "PROPERTY_UNAVAILABLE" | "CHANNEL_MANAGER_DISABLED" | "PMS_NOT_AVAILABLE" | "VALIDATION" | "RANGE_INVALID" | "HORIZON" | "TOO_MANY_UPDATES" | "TOO_MANY_CELLS" | "UNKNOWN_ROOM_TYPE" | "UNKNOWN_RATE_PLAN" | "CURRENCY_MISMATCH" | "RATE_LIMITED" | "NOTHING_ACCEPTED" | "BATCH_NOT_FOUND" | "IDEMPOTENCY_KEY_INVALID" | "IDEMPOTENCY_KEY_REUSED" | "IDEMPOTENCY_IN_FLIGHT" | "STAY_INVALID" | "UNKNOWN_ROOM_TYPE_FOR_PLAN" | "OCCUPANCY_EXCEEDED" | "NO_AVAILABILITY" | "EXTERNAL_REFERENCE_REUSED" | "PAYMENT_NOT_ALLOWED" | "PAYMENT_EXCEEDS_TOTAL" | "TAXES_NOT_CONFIGURED" | "TAXES_INSIDE_RATES" | "BOOKING_NOT_FOUND" | "BOOKING_NOT_CANCELLABLE" | "MODULE_NOT_ENTITLED" | "SANDBOX_ONLY" | "ROOM_TYPE_NOT_FOUND" | "RATE_PLAN_NOT_FOUND" | "CATALOG_CONFLICT" | "CATALOG_BUSY" | "CHANNEL_MANAGER_ERROR" | "WEBHOOK_ENDPOINT_NOT_FOUND" | "WEBHOOK_DELIVERY_NOT_FOUND" | "WEBHOOK_ENDPOINT_LIMIT" | "WEBHOOK_ENDPOINT_NOT_ACTIVE" | "WEBHOOK_ENDPOINT_SUSPENDED" | "WEBHOOK_PAYLOAD_EXPIRED" | "WEBHOOK_ACCESS_ENDED" | "WEBHOOKS_UNAVAILABLE" | "PROPERTY_REQUIRED" | "PROPERTY_NOT_FOUND" | "ARI_NOT_AUTHORITATIVE" | "ROUTE_NOT_FOUND" | "PAYLOAD_TOO_LARGE" | "AUTH_BACKEND_UNAVAILABLE" | "BOOKING_NOT_MODIFIABLE" | "SANDBOX_NOT_FOUND" | "SANDBOX_INCOMPLETE" | "WRITES_FROZEN" | "WRITES_SUSPENDED" | "SHIELD_UNAVAILABLE" | "CATALOG_LIMIT_REACHED" | "TOO_MANY_NEW_ENTITIES" | "RATE_OUT_OF_BAND" | "CHANNEL_NOT_FOUND" | "CHANNEL_SHARED" | "MODIFIER_OUT_OF_BAND" | "COMPANY_KEY_REQUIRED" | "BILLING_SETUP_REQUIRED" | "OWNER_HAS_ACCOUNT" | "SANDBOX_LIMIT" | "CONFIRMATION_MISMATCH" | "PROPERTY_NOT_REMOVABLE" | "PROPERTY_NOT_CHANGEABLE" | "PROPERTY_BUSY" | "PRICE_UNAVAILABLE" | "CONNECT_LINK_NOT_FOUND" | "CONNECT_LINKS_UNAVAILABLE" | "CHANNEL_NOT_AVAILABLE" | "LIVE_KEY_REQUIRED" | "NOT_READY" | "KEY_NOT_FOUND" | "KEY_LIMIT" | "KEY_REVOKED" | "KEY_ALREADY_ROTATING" | "SCOPES_INVALID" | "ALLOWED_CIDRS_INVALID" | "REASON_REQUIRED" | "SUPPORT_TICKET_NOT_FOUND" | "SUPPORT_TICKET_CLOSED";
|
|
163
163
|
details?: unknown;
|
|
164
164
|
};
|
|
165
165
|
}
|
|
@@ -338,7 +338,7 @@ export interface Catalog {
|
|
|
338
338
|
/** The occupancy this plan is priced for; null = any */
|
|
339
339
|
occupancy: number | null;
|
|
340
340
|
currency: string;
|
|
341
|
-
/** The plan's standing price in major units, as a decimal string with the currency's own decimals ("4500.50"): the same field PUT /catalog/rate-plans takes. null = it follows the room type's base rate */
|
|
341
|
+
/** The plan's standing price in major units, as a decimal string with the currency's own decimals ("4500.50"): the same field PUT /catalog/rate-plans takes, and the price every date of the plan opens for booking at. null = it follows the room type's base rate, which only a plan made on the hotel's own screens can do */
|
|
342
342
|
defaultRate?: string | null;
|
|
343
343
|
/** false = a non-refundable plan */
|
|
344
344
|
refundable: boolean;
|
|
@@ -408,7 +408,7 @@ export interface PropertyCreated {
|
|
|
408
408
|
name: string;
|
|
409
409
|
timezone: string;
|
|
410
410
|
currency: string;
|
|
411
|
-
/** The property publishes to its channels.
|
|
411
|
+
/** The property publishes to its channels. A new hotel is put on the channel manager when its billing starts, usually before this answer; while it is false, PUT /catalog/room-types with the same refs tries again. Always true for a sandbox */
|
|
412
412
|
channelManager: boolean;
|
|
413
413
|
/** true when a test key made it: everything lands locally, nothing reaches a channel and nothing is billed */
|
|
414
414
|
sandbox: boolean;
|
|
@@ -423,6 +423,41 @@ export interface PropertyCreated {
|
|
|
423
423
|
/** true: an earlier request with this X-Idempotency-Key already added this hotel; nothing new was made */
|
|
424
424
|
replay: boolean;
|
|
425
425
|
}
|
|
426
|
+
export interface PropertyChange {
|
|
427
|
+
/** The hotel's new name, as its guests know it. A sandbox's name keeps its ending, (sandbox) */
|
|
428
|
+
name?: string;
|
|
429
|
+
/** Only the parts you send change. The country is not one of them: it never changes by this request */
|
|
430
|
+
address?: {
|
|
431
|
+
/** The first line of the address */
|
|
432
|
+
line1?: string;
|
|
433
|
+
city?: string;
|
|
434
|
+
/** An empty string clears it */
|
|
435
|
+
state?: string;
|
|
436
|
+
/** An empty string clears it */
|
|
437
|
+
postalCode?: string;
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
export interface PropertyChanged {
|
|
441
|
+
id: number;
|
|
442
|
+
/** As stored now. A sandbox's name ends in (sandbox) */
|
|
443
|
+
name: string;
|
|
444
|
+
timezone: string;
|
|
445
|
+
currency: string;
|
|
446
|
+
/** The property publishes to its channels. Not changed by this request */
|
|
447
|
+
channelManager: boolean;
|
|
448
|
+
sandbox: boolean;
|
|
449
|
+
/** The hotel's address as stored now. A part the record does not hold is null */
|
|
450
|
+
address: {
|
|
451
|
+
line1: string | null;
|
|
452
|
+
city: string | null;
|
|
453
|
+
state: string | null;
|
|
454
|
+
postalCode: string | null;
|
|
455
|
+
/** ISO 3166-1 alpha-2. Never changed by this request */
|
|
456
|
+
country: string | null;
|
|
457
|
+
};
|
|
458
|
+
/** The fields whose stored value this request changed, by the names you send (name, address.line1, address.city, address.state, address.postalCode). Empty when everything you sent was already stored */
|
|
459
|
+
changed: Array<string>;
|
|
460
|
+
}
|
|
426
461
|
export interface PropertyRemoved {
|
|
427
462
|
id: number;
|
|
428
463
|
/** The hotel's name; null only for a sandbox removed before its name was recorded */
|
|
@@ -485,7 +520,7 @@ export interface RatePlansUpsert {
|
|
|
485
520
|
occupancy?: number | null;
|
|
486
521
|
/** false = a non-refundable plan; default true */
|
|
487
522
|
refundable?: boolean;
|
|
488
|
-
/** The plan's standing price in MAJOR units, a number or a decimal string (4500 or "4500.50"), like every rate here: what
|
|
523
|
+
/** The plan's standing price in MAJOR units, a number or a decimal string (4500 or "4500.50"), like every rate here: what every date of the plan opens for booking at, mirrored to the channel manager. REQUIRED when the plan is new: a request that would create a plan without it is 400 VALIDATION and writes nothing. On a plan you already sent, omit it to leave the price as it is. null (follow the room type's base rate) is accepted only where the hotel has typed a base rate in ZimmerStack, and is 400 VALIDATION otherwise. Kept to the currency's own decimals (§2.10) */
|
|
489
524
|
defaultRate?: number | string | null;
|
|
490
525
|
/** Deprecated: the same standing price in hundredths of the major unit (450050 is 4500.50). Send defaultRate instead; never both */
|
|
491
526
|
defaultRateMinor?: number | null;
|
|
@@ -592,7 +627,7 @@ export interface RatesWrite {
|
|
|
592
627
|
/** Hotel-local calendar date, YYYY-MM-DD */
|
|
593
628
|
dateTo: string;
|
|
594
629
|
days?: Array<"mo" | "tu" | "we" | "th" | "fr" | "sa" | "su">;
|
|
595
|
-
/** Nightly sell price in MAJOR units, a number or a decimal string (4500, 4500.5 or "4500.50"), 1 to 21474836. Kept exactly, to the currency's own decimals (GET /property decimals): two for rupees, euros and dollars, none for yen. A
|
|
630
|
+
/** Nightly sell price in MAJOR units, a number or a decimal string (4500, 4500.5 or "4500.50"), 1 to 21474836. Kept exactly, to the currency's own decimals (GET /property decimals): two for rupees, euros and dollars, none for yen. A number with more decimals than the currency has is rounded to them and named in the answer's rounded list; so is a fraction in a currency that has none. A decimal string takes at most two decimals: one with more is refused (400 VALIDATION) */
|
|
596
631
|
rate: number | string;
|
|
597
632
|
/** ISO 4217; must equal the property's currency (GET /property) */
|
|
598
633
|
currency: string;
|
|
@@ -1737,7 +1772,7 @@ export interface WebhookDeliveryDetail {
|
|
|
1737
1772
|
payloadBytes: number;
|
|
1738
1773
|
/** false once the stored body has been dropped (14 days); a redeliver rebuilds it from the event while that is kept (90 days) */
|
|
1739
1774
|
payloadAvailable: boolean;
|
|
1740
|
-
/** The event as it was sent (the webhook's envelope); null once the stored body has been dropped (payloadAvailable: false) */
|
|
1775
|
+
/** The event as it was sent (the webhook's envelope), with a guest's phone and email masked in this read; null once the stored body has been dropped (payloadAvailable: false) */
|
|
1741
1776
|
payload: unknown;
|
|
1742
1777
|
/** Every attempt, oldest first */
|
|
1743
1778
|
attempts_log: Array<{
|
|
@@ -2698,7 +2733,7 @@ export interface ConnectLinkCreated {
|
|
|
2698
2733
|
};
|
|
2699
2734
|
/** The address to send to the hotel's own person. It opens ONCE and is in this answer only: we keep a hash of its token, never the token. null on a replay of the same request (X-Idempotent-Replay: true): we keep no copy to show again, so make a new link if the first answer was lost (it withdraws this one) */
|
|
2700
2735
|
url: string | null;
|
|
2701
|
-
/** What the hotel does at the booking site before it opens the link, naming our connectivity partner as that booking site lists it.
|
|
2736
|
+
/** What the hotel does at the booking site before it opens the link (in its extranet or through its support), naming our connectivity partner as that booking site lists it. Send it to the hotel first, and the url once the hotel has done it; null where there is no such step (Airbnb) */
|
|
2702
2737
|
hotelStep: string | null;
|
|
2703
2738
|
/** Earlier links for this hotel and booking site that nobody had opened, withdrawn by this one */
|
|
2704
2739
|
withdrawn: number;
|
|
@@ -3451,6 +3486,15 @@ export interface Operations {
|
|
|
3451
3486
|
body: PropertyCreate;
|
|
3452
3487
|
response: PropertyCreated;
|
|
3453
3488
|
};
|
|
3489
|
+
/** Change a hotel */
|
|
3490
|
+
"PATCH /properties/{propertyId}": {
|
|
3491
|
+
path: {
|
|
3492
|
+
propertyId: string | number;
|
|
3493
|
+
};
|
|
3494
|
+
query: undefined;
|
|
3495
|
+
body: PropertyChange;
|
|
3496
|
+
response: PropertyChanged;
|
|
3497
|
+
};
|
|
3454
3498
|
/** Remove a hotel you added (a software partner's company key) */
|
|
3455
3499
|
"DELETE /properties/{propertyId}": {
|
|
3456
3500
|
path: {
|
|
@@ -3814,7 +3858,7 @@ export interface Operations {
|
|
|
3814
3858
|
body: undefined;
|
|
3815
3859
|
response: WebhookDeliveryList;
|
|
3816
3860
|
};
|
|
3817
|
-
/** One delivery: the body as sent, and every attempt */
|
|
3861
|
+
/** One delivery: the body as sent, guest contact masked, and every attempt */
|
|
3818
3862
|
"GET /webhook-endpoints/{endpointId}/deliveries/{deliveryId}": {
|
|
3819
3863
|
path: {
|
|
3820
3864
|
endpointId: string | number;
|
package/dist/cjs/generated.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.OPERATIONS = exports.SUPPORT_SEVERITIES = exports.NOTICES = exports.MODIFIER_TAKES_EFFECT = exports.SCOPES = exports.ERROR_CODES = exports.LIMITS = exports.PROPERTY_HEADER = exports.IDEMPOTENCY_HEADER = exports.API_PREFIX = exports.API_ORIGIN = exports.SDK_VERSION = void 0;
|
|
6
6
|
/** This package's version, sent as the user agent so ZimmerStack can tell which client a request came from. */
|
|
7
|
-
exports.SDK_VERSION = "0.9.
|
|
7
|
+
exports.SDK_VERSION = "0.9.1";
|
|
8
8
|
/** Where the API lives. The key is sent nowhere else. */
|
|
9
9
|
exports.API_ORIGIN = "https://api.zimmerstack.com";
|
|
10
10
|
exports.API_PREFIX = "/api/v1/connect-api/v1";
|
|
@@ -110,6 +110,7 @@ exports.ERROR_CODES = [
|
|
|
110
110
|
"SANDBOX_LIMIT",
|
|
111
111
|
"CONFIRMATION_MISMATCH",
|
|
112
112
|
"PROPERTY_NOT_REMOVABLE",
|
|
113
|
+
"PROPERTY_NOT_CHANGEABLE",
|
|
113
114
|
"PROPERTY_BUSY",
|
|
114
115
|
"PRICE_UNAVAILABLE",
|
|
115
116
|
"CONNECT_LINK_NOT_FOUND",
|
|
@@ -290,6 +291,7 @@ exports.SUPPORT_SEVERITIES = [
|
|
|
290
291
|
exports.OPERATIONS = {
|
|
291
292
|
"GET /properties": { idempotent: false, bodyRequired: false },
|
|
292
293
|
"POST /properties": { idempotent: true, bodyRequired: true },
|
|
294
|
+
"PATCH /properties/{propertyId}": { idempotent: true, bodyRequired: true },
|
|
293
295
|
"DELETE /properties/{propertyId}": { idempotent: false, bodyRequired: false },
|
|
294
296
|
"GET /property": { idempotent: false, bodyRequired: false },
|
|
295
297
|
"GET /limits": { idempotent: false, bodyRequired: false },
|
package/dist/esm/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AvailabilityWrite, type BatchStatus, type Billing, type BillingInvoices, type BillingNextInvoice, type Booking, type BookingCancel, type BookingCreate, type Catalog, type CatalogDeleteResult, type CatalogUpsertResult, type ChannelBooking, type CloseResult, type CloseRoomType, type ConnectLink, type ConnectLinkCreate, type ConnectLinkCreated, type ConnectLinkList, type DirectBookingCancel, type DirectBookingCancelResult, type EventsList, type Explain, type GoLiveResult, type HotelKey, type HotelKeyCreate, type HotelKeyCreated, type HotelKeyList, type HotelKeyRevoke, type HotelKeyRotated, type Limits, type LoggedEvent, type ModifierResult, type OperationKey, type Operations, type PropertyCreate, type PropertyCreated, type PropertyRemoved, type RatePlansUpsert, type RatesResendAccepted, type RatesWrite, type Readiness, type ReopenRoomType, type RequestLog, type RestrictionsWrite, type RoomTypesUpsert, type SandboxBooking, type SandboxBookingCreate, type SandboxBookingModify, type SandboxFault, type SandboxFaultView, type SandboxNoShow, type SandboxSyncEvent, type SandboxSyncEventView, type Status, type SupportTicket, type SupportTicketCreate, type SupportTicketList, type WebhookDelivery, type WebhookDeliveryDetail, type WebhookDeliveryList, type WebhookEndpoint, type WebhookEndpointCreate, type WebhookEndpointCreated, type WebhookEndpointDeleted, type WebhookEndpointList, type WebhookEndpointResumed, type WebhookEndpointUpdate, type WebhookRecoverResult, type WebhookSecretRotated, type WebhookTest, type WebhookTestQueued, type WriteAccepted, type WritePreview } from "./generated.js";
|
|
1
|
+
import { type AvailabilityWrite, type BatchStatus, type Billing, type BillingInvoices, type BillingNextInvoice, type Booking, type BookingCancel, type BookingCreate, type Catalog, type CatalogDeleteResult, type CatalogUpsertResult, type ChannelBooking, type CloseResult, type CloseRoomType, type ConnectLink, type ConnectLinkCreate, type ConnectLinkCreated, type ConnectLinkList, type DirectBookingCancel, type DirectBookingCancelResult, type EventsList, type Explain, type GoLiveResult, type HotelKey, type HotelKeyCreate, type HotelKeyCreated, type HotelKeyList, type HotelKeyRevoke, type HotelKeyRotated, type Limits, type LoggedEvent, type ModifierResult, type OperationKey, type Operations, type PropertyChange, type PropertyChanged, type PropertyCreate, type PropertyCreated, type PropertyRemoved, type RatePlansUpsert, type RatesResendAccepted, type RatesWrite, type Readiness, type ReopenRoomType, type RequestLog, type RestrictionsWrite, type RoomTypesUpsert, type SandboxBooking, type SandboxBookingCreate, type SandboxBookingModify, type SandboxFault, type SandboxFaultView, type SandboxNoShow, type SandboxSyncEvent, type SandboxSyncEventView, type Status, type SupportTicket, type SupportTicketCreate, type SupportTicketList, type WebhookDelivery, type WebhookDeliveryDetail, type WebhookDeliveryList, type WebhookEndpoint, type WebhookEndpointCreate, type WebhookEndpointCreated, type WebhookEndpointDeleted, type WebhookEndpointList, type WebhookEndpointResumed, type WebhookEndpointUpdate, type WebhookRecoverResult, type WebhookSecretRotated, type WebhookTest, type WebhookTestQueued, type WriteAccepted, type WritePreview } from "./generated.js";
|
|
2
2
|
import { type Grid, type GridEdits, type ModifierStep } from "./grid.js";
|
|
3
3
|
export interface ZimmerStackOptions {
|
|
4
4
|
/**
|
|
@@ -241,6 +241,26 @@ export declare class ZimmerStack {
|
|
|
241
241
|
* const seaBreeze = zs.forProperty(hotel.id);
|
|
242
242
|
*/
|
|
243
243
|
create: (hotel: PropertyCreate, options?: WriteOptions) => Promise<PropertyCreated>;
|
|
244
|
+
/**
|
|
245
|
+
* Change a hotel YOU ADDED: its name, its address, or both. A company key with the scope properties:write.
|
|
246
|
+
*
|
|
247
|
+
* Send only what changes: `name`, and under `address` any of `line1`, `city`, `state` and `postalCode`. A
|
|
248
|
+
* field you leave out stays as it is. It never changes the hotel's country, currency, time zone, owner or
|
|
249
|
+
* tax id (sending one is refused with VALIDATION), and it changes the hotel's record in ZimmerStack, not
|
|
250
|
+
* the name of its listing on a booking site.
|
|
251
|
+
*
|
|
252
|
+
* The answer is the hotel with its `address` and `changed`: the fields whose stored value moved. An empty
|
|
253
|
+
* `changed` means everything you sent was already stored. A hotel whose owner let you in is refused with
|
|
254
|
+
* PROPERTY_NOT_CHANGEABLE: its owner changes it. With a test key it changes one of your sandboxes, whose
|
|
255
|
+
* name keeps its ending, "(sandbox)". Safe to retry: the call carries an idempotency key.
|
|
256
|
+
*
|
|
257
|
+
* After a new name, `zs.properties.delete` wants that new name in `confirm`.
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* const hotel = await zs.properties.update(61, { name: "Sea Breeze Suites", address: { line1: "14 Beach Road" } });
|
|
261
|
+
* hotel.changed; // ["name", "address.line1"]
|
|
262
|
+
*/
|
|
263
|
+
update: (propertyId: number, changes: PropertyChange, options?: WriteOptions) => Promise<PropertyChanged>;
|
|
244
264
|
/**
|
|
245
265
|
* Remove a hotel YOU ADDED, for good. A company key with the scope properties:write.
|
|
246
266
|
*
|
|
@@ -420,19 +440,24 @@ export declare class ZimmerStack {
|
|
|
420
440
|
/** Your connect links, newest first; `propertyId` narrows them to one hotel. */
|
|
421
441
|
list: (query?: Op<"GET /connect-links">["query"], options?: ReadOptions) => Promise<ConnectLinkList>;
|
|
422
442
|
/**
|
|
423
|
-
* Make a one-time link for ONE hotel and ONE booking site.
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
443
|
+
* Make a one-time link for ONE hotel and ONE booking site. Only Airbnb is connected from the link alone
|
|
444
|
+
* (the host signs in on Airbnb's own page). Every other booking site must FIRST accept our connectivity
|
|
445
|
+
* partner for the hotel, in its extranet or through its support: send `hotelStep` to the hotel first, and
|
|
446
|
+
* the answer's `url` once that step is done. On ZimmerStack's hosted page the hotel's own person types
|
|
447
|
+
* the hotel's id at the booking site (MakeMyTrip also its access token), confirms every room and rate
|
|
448
|
+
* match and presses Start selling. The call takes no booking-site detail and no match. You hear
|
|
449
|
+
* `channel.connect.completed`, or `channel.connect.expired` if the link ran out.
|
|
427
450
|
*
|
|
428
451
|
* THE `url` IS SHOWN ONCE: it is in this answer only, and null on a replay of the same request
|
|
429
452
|
* (`shownOnce(answer)` returns it or says what to do). `hotelStep` is what the hotel does at the booking
|
|
430
|
-
* site first, for your own screen or message. A LIVE key only: a
|
|
431
|
-
* key is refused (LIVE_KEY_REQUIRED). The hotel is `propertyId`
|
|
453
|
+
* site first (null for Airbnb), for your own screen or message; it can take days. A LIVE key only: a
|
|
454
|
+
* sandbox has no booking site, so a test key is refused (LIVE_KEY_REQUIRED). The hotel is `propertyId`
|
|
455
|
+
* in the body; `forProperty` is not read.
|
|
432
456
|
*
|
|
433
457
|
* @example
|
|
434
458
|
* const made = await zs.connectLinks.create({ propertyId: 61, channel: "bookingcom", returnUrl: "https://pms.example/hotels/61" });
|
|
435
|
-
* await
|
|
459
|
+
* await tellTheHotel(made.hotelStep); // first
|
|
460
|
+
* await sendOnceTheStepIsDone(shownOnce(made)); // then the link
|
|
436
461
|
*/
|
|
437
462
|
create: (body: ConnectLinkCreate, options?: WriteOptions) => Promise<ConnectLinkCreated>;
|
|
438
463
|
/** Where one link stands: pending, opened, completed, expired or revoked. Never its address again. */
|
package/dist/esm/client.js
CHANGED
|
@@ -223,7 +223,7 @@ class Core {
|
|
|
223
223
|
constructor(options) {
|
|
224
224
|
const g = globalThis;
|
|
225
225
|
if ((typeof g.window !== "undefined" && typeof g.window.document !== "undefined") || g.navigator?.product === "ReactNative") {
|
|
226
|
-
throw new ZimmerStackUsageError("@zimmerstack/connect runs on a server only. A key in a browser or a mobile app can be read by anyone and can change a hotel's prices on every channel: call your own server from here, and ZimmerStack from your server (https://docs.zimmerstack.com/
|
|
226
|
+
throw new ZimmerStackUsageError("@zimmerstack/connect runs on a server only. A key in a browser or a mobile app can be read by anyone and can change a hotel's prices on every channel: call your own server from here, and ZimmerStack from your server (https://docs.zimmerstack.com/guides/node-package#no-server shows the smallest one). If a key was built into this page, anyone can read it now: revoke it and make a new one.");
|
|
227
227
|
}
|
|
228
228
|
const key = options.apiKey ?? env("ZIMMERSTACK_CONNECT_KEY");
|
|
229
229
|
if (!key)
|
|
@@ -703,6 +703,35 @@ export class ZimmerStack {
|
|
|
703
703
|
this.#forgetWhichHotels();
|
|
704
704
|
return created;
|
|
705
705
|
},
|
|
706
|
+
/**
|
|
707
|
+
* Change a hotel YOU ADDED: its name, its address, or both. A company key with the scope properties:write.
|
|
708
|
+
*
|
|
709
|
+
* Send only what changes: `name`, and under `address` any of `line1`, `city`, `state` and `postalCode`. A
|
|
710
|
+
* field you leave out stays as it is. It never changes the hotel's country, currency, time zone, owner or
|
|
711
|
+
* tax id (sending one is refused with VALIDATION), and it changes the hotel's record in ZimmerStack, not
|
|
712
|
+
* the name of its listing on a booking site.
|
|
713
|
+
*
|
|
714
|
+
* The answer is the hotel with its `address` and `changed`: the fields whose stored value moved. An empty
|
|
715
|
+
* `changed` means everything you sent was already stored. A hotel whose owner let you in is refused with
|
|
716
|
+
* PROPERTY_NOT_CHANGEABLE: its owner changes it. With a test key it changes one of your sandboxes, whose
|
|
717
|
+
* name keeps its ending, "(sandbox)". Safe to retry: the call carries an idempotency key.
|
|
718
|
+
*
|
|
719
|
+
* After a new name, `zs.properties.delete` wants that new name in `confirm`.
|
|
720
|
+
*
|
|
721
|
+
* @example
|
|
722
|
+
* const hotel = await zs.properties.update(61, { name: "Sea Breeze Suites", address: { line1: "14 Beach Road" } });
|
|
723
|
+
* hotel.changed; // ["name", "address.line1"]
|
|
724
|
+
*/
|
|
725
|
+
update: async (propertyId, changes, options) => {
|
|
726
|
+
if (!Number.isInteger(propertyId) || propertyId <= 0) {
|
|
727
|
+
throw new ZimmerStackUsageError("zs.properties.update needs the hotel's numeric id (zs.properties.list() names them)");
|
|
728
|
+
}
|
|
729
|
+
const sent = changes?.name !== undefined || Object.values(changes?.address ?? {}).some((value) => value !== undefined);
|
|
730
|
+
if (!sent) {
|
|
731
|
+
throw new ZimmerStackUsageError("zs.properties.update needs something to change: name, or line1, city, state or postalCode under address.");
|
|
732
|
+
}
|
|
733
|
+
return this.request("PATCH /properties/{propertyId}", { path: { propertyId }, body: changes, ...options });
|
|
734
|
+
},
|
|
706
735
|
/**
|
|
707
736
|
* Remove a hotel YOU ADDED, for good. A company key with the scope properties:write.
|
|
708
737
|
*
|
|
@@ -907,19 +936,24 @@ export class ZimmerStack {
|
|
|
907
936
|
/** Your connect links, newest first; `propertyId` narrows them to one hotel. */
|
|
908
937
|
list: (query, options) => this.request("GET /connect-links", { query, ...options }),
|
|
909
938
|
/**
|
|
910
|
-
* Make a one-time link for ONE hotel and ONE booking site.
|
|
911
|
-
*
|
|
912
|
-
*
|
|
913
|
-
*
|
|
939
|
+
* Make a one-time link for ONE hotel and ONE booking site. Only Airbnb is connected from the link alone
|
|
940
|
+
* (the host signs in on Airbnb's own page). Every other booking site must FIRST accept our connectivity
|
|
941
|
+
* partner for the hotel, in its extranet or through its support: send `hotelStep` to the hotel first, and
|
|
942
|
+
* the answer's `url` once that step is done. On ZimmerStack's hosted page the hotel's own person types
|
|
943
|
+
* the hotel's id at the booking site (MakeMyTrip also its access token), confirms every room and rate
|
|
944
|
+
* match and presses Start selling. The call takes no booking-site detail and no match. You hear
|
|
945
|
+
* `channel.connect.completed`, or `channel.connect.expired` if the link ran out.
|
|
914
946
|
*
|
|
915
947
|
* THE `url` IS SHOWN ONCE: it is in this answer only, and null on a replay of the same request
|
|
916
948
|
* (`shownOnce(answer)` returns it or says what to do). `hotelStep` is what the hotel does at the booking
|
|
917
|
-
* site first, for your own screen or message. A LIVE key only: a
|
|
918
|
-
* key is refused (LIVE_KEY_REQUIRED). The hotel is `propertyId`
|
|
949
|
+
* site first (null for Airbnb), for your own screen or message; it can take days. A LIVE key only: a
|
|
950
|
+
* sandbox has no booking site, so a test key is refused (LIVE_KEY_REQUIRED). The hotel is `propertyId`
|
|
951
|
+
* in the body; `forProperty` is not read.
|
|
919
952
|
*
|
|
920
953
|
* @example
|
|
921
954
|
* const made = await zs.connectLinks.create({ propertyId: 61, channel: "bookingcom", returnUrl: "https://pms.example/hotels/61" });
|
|
922
|
-
* await
|
|
955
|
+
* await tellTheHotel(made.hotelStep); // first
|
|
956
|
+
* await sendOnceTheStepIsDone(shownOnce(made)); // then the link
|
|
923
957
|
*/
|
|
924
958
|
create: (body, options) => this.request("POST /connect-links", { body, ...options }),
|
|
925
959
|
/** Where one link stands: pending, opened, completed, expired or revoked. Never its address again. */
|
package/dist/esm/doctor.js
CHANGED
|
@@ -256,7 +256,7 @@ async function requestFindings(zs, now, signal) {
|
|
|
256
256
|
level: recent || fault ? "attention" : "info",
|
|
257
257
|
check: "requests",
|
|
258
258
|
message: `${reason}: ${plural(items.length, "request")} refused in the last 24 hours${more ? " (and more)" : ""}, the last ${ago(last.at, now)}, on ${list(routes)}.${last.requestId ? ` Last request id: ${last.requestId}.` : ""}`,
|
|
259
|
-
action: REFUSAL_ADVICE[reason] ?? (fault ? "That is a fault on ZimmerStack's side. If it repeats, write to support@zimmerstack.com and quote the request id." : "Look the code up: https://docs.zimmerstack.com/errors"),
|
|
259
|
+
action: REFUSAL_ADVICE[reason] ?? (fault ? "That is a fault on ZimmerStack's side. If it repeats, write to support@zimmerstack.com and quote the request id." : "Look the code up: https://docs.zimmerstack.com/guides/errors"),
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
262
|
// The newest requests of any status, for the addresses they came from: an address that is not yours is the first sign of a leaked key.
|