@spoot/hostfully-api 1.0.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/README.md +33 -0
- package/dist/src/AgenciesApi.d.ts +74 -0
- package/dist/src/AgenciesApi.js +37 -0
- package/dist/src/AmenitiesApi.d.ts +42 -0
- package/dist/src/AmenitiesApi.js +257 -0
- package/dist/src/FeesApi.d.ts +59 -0
- package/dist/src/FeesApi.js +87 -0
- package/dist/src/FetchTransport.d.ts +17 -0
- package/dist/src/FetchTransport.js +98 -0
- package/dist/src/HostfullyApi.d.ts +22 -0
- package/dist/src/HostfullyApi.js +44 -0
- package/dist/src/LeadsApi.d.ts +513 -0
- package/dist/src/LeadsApi.js +132 -0
- package/dist/src/MessagesApi.d.ts +64 -0
- package/dist/src/MessagesApi.js +59 -0
- package/dist/src/OrderApi.d.ts +453 -0
- package/dist/src/OrderApi.js +124 -0
- package/dist/src/PricingApi.d.ts +137 -0
- package/dist/src/PricingApi.js +204 -0
- package/dist/src/PropertiesApi.d.ts +251 -0
- package/dist/src/PropertiesApi.js +183 -0
- package/dist/src/RateLimiting.d.ts +6 -0
- package/dist/src/RateLimiting.js +50 -0
- package/dist/src/Transport.d.ts +13 -0
- package/dist/src/Transport.js +2 -0
- package/dist/src/enums.d.ts +7 -0
- package/dist/src/enums.js +167 -0
- package/dist/src/index.d.ts +12 -0
- package/dist/src/index.js +28 -0
- package/dist/src/pagination.d.ts +15 -0
- package/dist/src/pagination.js +19 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +31 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Day } from "@spoot/day";
|
|
3
|
+
import { Schedule, Segment } from "@spoot/schedule";
|
|
4
|
+
import { Property } from "./PropertiesApi";
|
|
5
|
+
import { HostfullyApi } from "./HostfullyApi";
|
|
6
|
+
export declare function batches<T>(size: number, array: T[]): Generator<T[], void, unknown>;
|
|
7
|
+
interface PropertyPricingConfig {
|
|
8
|
+
dailyRate: string;
|
|
9
|
+
minimumStay: number;
|
|
10
|
+
minimumWeekendStay: number;
|
|
11
|
+
weekendRate: string;
|
|
12
|
+
daysOfTheWeekToCheckInOn: Set<number>;
|
|
13
|
+
}
|
|
14
|
+
interface PricingOverride {
|
|
15
|
+
day: Day;
|
|
16
|
+
price: string;
|
|
17
|
+
minNights: number;
|
|
18
|
+
canCheckin: boolean;
|
|
19
|
+
canCheckout: boolean;
|
|
20
|
+
}
|
|
21
|
+
export type PricingScheduleData = {
|
|
22
|
+
price: string;
|
|
23
|
+
minNights: number;
|
|
24
|
+
canCheckin: boolean;
|
|
25
|
+
canCheckout: boolean;
|
|
26
|
+
};
|
|
27
|
+
export type PricingSchedule = Schedule<PricingScheduleData>;
|
|
28
|
+
export type PricingSegment = Segment<PricingScheduleData>;
|
|
29
|
+
declare const PricingRulePricingRuleSchema: z.ZodObject<{
|
|
30
|
+
uid: z.ZodString;
|
|
31
|
+
ruleType: z.ZodEnum<["LAST_MINUTE_DISCOUNT", "EARLY_BIRD_DISCOUNT"]>;
|
|
32
|
+
threshold: z.ZodNumber;
|
|
33
|
+
priceChange: z.ZodNumber;
|
|
34
|
+
priceChangeType: z.ZodLiteral<"PERCENT">;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
uid: string;
|
|
37
|
+
ruleType: "LAST_MINUTE_DISCOUNT" | "EARLY_BIRD_DISCOUNT";
|
|
38
|
+
threshold: number;
|
|
39
|
+
priceChange: number;
|
|
40
|
+
priceChangeType: "PERCENT";
|
|
41
|
+
}, {
|
|
42
|
+
uid: string;
|
|
43
|
+
ruleType: "LAST_MINUTE_DISCOUNT" | "EARLY_BIRD_DISCOUNT";
|
|
44
|
+
threshold: number;
|
|
45
|
+
priceChange: number;
|
|
46
|
+
priceChangeType: "PERCENT";
|
|
47
|
+
}>;
|
|
48
|
+
declare const PricingRulesSchema: z.ZodObject<{
|
|
49
|
+
increaseRate: z.ZodNullable<z.ZodNumber>;
|
|
50
|
+
increaseRateLowerBound: z.ZodNullable<z.ZodNumber>;
|
|
51
|
+
decreaseRate: z.ZodNullable<z.ZodNumber>;
|
|
52
|
+
decreaseRateHigherBound: z.ZodNullable<z.ZodNumber>;
|
|
53
|
+
decreaseRateMonthly: z.ZodNullable<z.ZodNumber>;
|
|
54
|
+
decreaseRateHigherBoundMonthly: z.ZodNullable<z.ZodNumber>;
|
|
55
|
+
enabledForAirbnb: z.ZodBoolean;
|
|
56
|
+
pricingRules: z.ZodArray<z.ZodObject<{
|
|
57
|
+
uid: z.ZodString;
|
|
58
|
+
ruleType: z.ZodEnum<["LAST_MINUTE_DISCOUNT", "EARLY_BIRD_DISCOUNT"]>;
|
|
59
|
+
threshold: z.ZodNumber;
|
|
60
|
+
priceChange: z.ZodNumber;
|
|
61
|
+
priceChangeType: z.ZodLiteral<"PERCENT">;
|
|
62
|
+
}, "strip", z.ZodTypeAny, {
|
|
63
|
+
uid: string;
|
|
64
|
+
ruleType: "LAST_MINUTE_DISCOUNT" | "EARLY_BIRD_DISCOUNT";
|
|
65
|
+
threshold: number;
|
|
66
|
+
priceChange: number;
|
|
67
|
+
priceChangeType: "PERCENT";
|
|
68
|
+
}, {
|
|
69
|
+
uid: string;
|
|
70
|
+
ruleType: "LAST_MINUTE_DISCOUNT" | "EARLY_BIRD_DISCOUNT";
|
|
71
|
+
threshold: number;
|
|
72
|
+
priceChange: number;
|
|
73
|
+
priceChangeType: "PERCENT";
|
|
74
|
+
}>, "many">;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
increaseRate: number | null;
|
|
77
|
+
increaseRateLowerBound: number | null;
|
|
78
|
+
decreaseRate: number | null;
|
|
79
|
+
decreaseRateHigherBound: number | null;
|
|
80
|
+
decreaseRateMonthly: number | null;
|
|
81
|
+
decreaseRateHigherBoundMonthly: number | null;
|
|
82
|
+
enabledForAirbnb: boolean;
|
|
83
|
+
pricingRules: {
|
|
84
|
+
uid: string;
|
|
85
|
+
ruleType: "LAST_MINUTE_DISCOUNT" | "EARLY_BIRD_DISCOUNT";
|
|
86
|
+
threshold: number;
|
|
87
|
+
priceChange: number;
|
|
88
|
+
priceChangeType: "PERCENT";
|
|
89
|
+
}[];
|
|
90
|
+
}, {
|
|
91
|
+
increaseRate: number | null;
|
|
92
|
+
increaseRateLowerBound: number | null;
|
|
93
|
+
decreaseRate: number | null;
|
|
94
|
+
decreaseRateHigherBound: number | null;
|
|
95
|
+
decreaseRateMonthly: number | null;
|
|
96
|
+
decreaseRateHigherBoundMonthly: number | null;
|
|
97
|
+
enabledForAirbnb: boolean;
|
|
98
|
+
pricingRules: {
|
|
99
|
+
uid: string;
|
|
100
|
+
ruleType: "LAST_MINUTE_DISCOUNT" | "EARLY_BIRD_DISCOUNT";
|
|
101
|
+
threshold: number;
|
|
102
|
+
priceChange: number;
|
|
103
|
+
priceChangeType: "PERCENT";
|
|
104
|
+
}[];
|
|
105
|
+
}>;
|
|
106
|
+
export type PricingRules = z.infer<typeof PricingRulesSchema>;
|
|
107
|
+
export type PricingRulesPricingRule = z.infer<typeof PricingRulePricingRuleSchema>;
|
|
108
|
+
export type PricingRulesUpdate = Omit<PricingRules, "pricingRules"> & {
|
|
109
|
+
pricingRules: Array<Omit<PricingRulesPricingRule, "uid"> & {
|
|
110
|
+
uid?: string;
|
|
111
|
+
}>;
|
|
112
|
+
};
|
|
113
|
+
export declare class PricingApi {
|
|
114
|
+
private readonly api;
|
|
115
|
+
constructor(api: HostfullyApi);
|
|
116
|
+
get(property: Property): Promise<PropertyPricingConfig>;
|
|
117
|
+
getOverrides(property: Property, forMonthOf: Day): Promise<PricingOverride[]>;
|
|
118
|
+
scan(property: Property, startingAt: Day, endingBefore: Day): AsyncGenerator<PricingSegment>;
|
|
119
|
+
getRules(property: Property): Promise<{
|
|
120
|
+
increaseRate: number | null;
|
|
121
|
+
increaseRateLowerBound: number | null;
|
|
122
|
+
decreaseRate: number | null;
|
|
123
|
+
decreaseRateHigherBound: number | null;
|
|
124
|
+
decreaseRateMonthly: number | null;
|
|
125
|
+
decreaseRateHigherBoundMonthly: number | null;
|
|
126
|
+
enabledForAirbnb: boolean;
|
|
127
|
+
pricingRules: {
|
|
128
|
+
uid: string;
|
|
129
|
+
ruleType: "LAST_MINUTE_DISCOUNT" | "EARLY_BIRD_DISCOUNT";
|
|
130
|
+
threshold: number;
|
|
131
|
+
priceChange: number;
|
|
132
|
+
priceChangeType: "PERCENT";
|
|
133
|
+
}[];
|
|
134
|
+
}>;
|
|
135
|
+
setRules(property: Property, rules: PricingRulesUpdate): Promise<void>;
|
|
136
|
+
}
|
|
137
|
+
export {};
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PricingApi = void 0;
|
|
4
|
+
exports.batches = batches;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const gql_1 = require("@spoot/gql");
|
|
7
|
+
const day_1 = require("@spoot/day");
|
|
8
|
+
const DAYS_OF_WEEK = "sunday monday tuesday wednesday thursday friday saturday".split(" ");
|
|
9
|
+
function* batches(size, array) {
|
|
10
|
+
for (let cursor = 0, batch = array.slice(cursor, size); batch.length > 0; cursor += size, batch = array.slice(cursor, size)) {
|
|
11
|
+
yield batch;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const PricingConfigQuery = (uid) => (0, gql_1.gql) `
|
|
15
|
+
query {
|
|
16
|
+
property(uid: ${JSON.stringify(uid)}) {
|
|
17
|
+
name
|
|
18
|
+
availability {
|
|
19
|
+
minimumStay
|
|
20
|
+
minimumWeekendStay
|
|
21
|
+
daysOfTheWeekToCheckInOn
|
|
22
|
+
}
|
|
23
|
+
pricing {
|
|
24
|
+
dailyRate
|
|
25
|
+
weekendAdjustmentRate
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
const PricingOverrideResponseSchema = zod_1.z.object({
|
|
31
|
+
pricingPeriods: zod_1.z.array(zod_1.z.object({
|
|
32
|
+
propertyUid: zod_1.z.string(),
|
|
33
|
+
date: zod_1.z.string(),
|
|
34
|
+
price: zod_1.z.number(),
|
|
35
|
+
minimumStay: zod_1.z.number(),
|
|
36
|
+
availableForCheckIn: zod_1.z.boolean(),
|
|
37
|
+
availableForCheckOut: zod_1.z.boolean(),
|
|
38
|
+
name: zod_1.z.string().nullable(),
|
|
39
|
+
})),
|
|
40
|
+
});
|
|
41
|
+
const PricingRulePricingRuleSchema = zod_1.z.object({
|
|
42
|
+
uid: zod_1.z.string(),
|
|
43
|
+
ruleType: zod_1.z.enum(["LAST_MINUTE_DISCOUNT", "EARLY_BIRD_DISCOUNT"]),
|
|
44
|
+
threshold: zod_1.z.number(),
|
|
45
|
+
priceChange: zod_1.z.number(),
|
|
46
|
+
priceChangeType: zod_1.z.literal("PERCENT"),
|
|
47
|
+
});
|
|
48
|
+
const PricingRulesSchema = zod_1.z.object({
|
|
49
|
+
increaseRate: zod_1.z.number().nullable(),
|
|
50
|
+
increaseRateLowerBound: zod_1.z.number().nullable(),
|
|
51
|
+
decreaseRate: zod_1.z.number().nullable(),
|
|
52
|
+
decreaseRateHigherBound: zod_1.z.number().nullable(),
|
|
53
|
+
decreaseRateMonthly: zod_1.z.number().nullable(),
|
|
54
|
+
decreaseRateHigherBoundMonthly: zod_1.z.number().nullable(),
|
|
55
|
+
enabledForAirbnb: zod_1.z.boolean(),
|
|
56
|
+
pricingRules: zod_1.z.array(PricingRulePricingRuleSchema),
|
|
57
|
+
});
|
|
58
|
+
class PricingApi {
|
|
59
|
+
api;
|
|
60
|
+
constructor(api) {
|
|
61
|
+
this.api = api;
|
|
62
|
+
}
|
|
63
|
+
async get(property) {
|
|
64
|
+
const resp = await this.api.transport.fetchGql(PricingConfigQuery(property.uid), zod_1.z.object({
|
|
65
|
+
property: zod_1.z
|
|
66
|
+
.object({
|
|
67
|
+
name: zod_1.z.string(),
|
|
68
|
+
availability: zod_1.z.object({
|
|
69
|
+
minimumStay: zod_1.z.number(),
|
|
70
|
+
minimumWeekendStay: zod_1.z.number(),
|
|
71
|
+
daysOfTheWeekToCheckInOn: zod_1.z.array(zod_1.z.string()),
|
|
72
|
+
}),
|
|
73
|
+
pricing: zod_1.z.object({
|
|
74
|
+
dailyRate: zod_1.z.string(),
|
|
75
|
+
weekendAdjustmentRate: zod_1.z.string(),
|
|
76
|
+
}),
|
|
77
|
+
})
|
|
78
|
+
.optional(),
|
|
79
|
+
}));
|
|
80
|
+
if (!resp.property) {
|
|
81
|
+
throw new Error(`Unable to find property with uid: ${property.uid}`);
|
|
82
|
+
}
|
|
83
|
+
const { availability: { daysOfTheWeekToCheckInOn, minimumStay, minimumWeekendStay, }, pricing: { dailyRate: dailyRateString, weekendAdjustmentRate: weekendAdjustmentRateString, }, } = resp.property;
|
|
84
|
+
const dailyRate = Number(dailyRateString);
|
|
85
|
+
const weekendAdjustmentRate = Number(weekendAdjustmentRateString);
|
|
86
|
+
return {
|
|
87
|
+
dailyRate: dailyRate.toFixed(2),
|
|
88
|
+
minimumStay,
|
|
89
|
+
minimumWeekendStay: minimumWeekendStay > 0 ? minimumWeekendStay : minimumStay,
|
|
90
|
+
weekendRate: (weekendAdjustmentRate > 0
|
|
91
|
+
? dailyRate + dailyRate * weekendAdjustmentRate
|
|
92
|
+
: dailyRate).toFixed(2),
|
|
93
|
+
daysOfTheWeekToCheckInOn: new Set(daysOfTheWeekToCheckInOn.map((day) => {
|
|
94
|
+
const index = DAYS_OF_WEEK.indexOf(day.toLowerCase());
|
|
95
|
+
if (index === -1) {
|
|
96
|
+
throw new Error(`Invalid day of the week: ${day}`);
|
|
97
|
+
}
|
|
98
|
+
return index;
|
|
99
|
+
})),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
async getOverrides(property, forMonthOf) {
|
|
103
|
+
const { pricingPeriods } = await this.api.transport.fetch({
|
|
104
|
+
path: "/api/v3.1/pricing-periods",
|
|
105
|
+
method: "GET",
|
|
106
|
+
query: {
|
|
107
|
+
propertyUid: property.uid,
|
|
108
|
+
from: forMonthOf.startOfMonth.toJSON(),
|
|
109
|
+
to: forMonthOf.endOfMonth.toJSON(),
|
|
110
|
+
},
|
|
111
|
+
response: PricingOverrideResponseSchema,
|
|
112
|
+
});
|
|
113
|
+
return pricingPeriods
|
|
114
|
+
.map((p) => {
|
|
115
|
+
const match = p.date.match(/(\d{4})-(\d{2})-(\d{2})/);
|
|
116
|
+
if (!match) {
|
|
117
|
+
throw new Error(`Invalid date format from Hostfully API: ${p.date}`);
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
day: new day_1.Day(Number(match[1]), Number(match[2]) - 1, Number(match[3])),
|
|
121
|
+
price: p.price.toFixed(2),
|
|
122
|
+
minNights: p.minimumStay,
|
|
123
|
+
canCheckin: p.availableForCheckIn,
|
|
124
|
+
canCheckout: p.availableForCheckOut,
|
|
125
|
+
};
|
|
126
|
+
})
|
|
127
|
+
.sort((a, b) => a.day.valueOf() - b.day.valueOf());
|
|
128
|
+
}
|
|
129
|
+
async *scan(property, startingAt, endingBefore) {
|
|
130
|
+
const pricingConfig = await this.get(property);
|
|
131
|
+
let cursor = startingAt;
|
|
132
|
+
let pricingOverrides = null;
|
|
133
|
+
while (cursor < endingBefore) {
|
|
134
|
+
// when we move to a new month, fetch the pricing overrides for that month
|
|
135
|
+
if (!pricingOverrides ||
|
|
136
|
+
pricingOverrides.startOfMonth.neq(cursor.startOfMonth)) {
|
|
137
|
+
pricingOverrides = {
|
|
138
|
+
startOfMonth: cursor.startOfMonth,
|
|
139
|
+
periods: await this.getOverrides(property, cursor.startOfMonth),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
const override = pricingOverrides.periods.find((p) => p.day.eq(cursor));
|
|
143
|
+
const canCheckin = pricingConfig.daysOfTheWeekToCheckInOn.has(cursor.dayOfWeek);
|
|
144
|
+
if (override) {
|
|
145
|
+
yield {
|
|
146
|
+
startingAt: cursor,
|
|
147
|
+
endingBefore: cursor.nextDay,
|
|
148
|
+
data: {
|
|
149
|
+
price: Number(override.price).toFixed(2),
|
|
150
|
+
minNights: override.minNights,
|
|
151
|
+
canCheckin: override.canCheckin,
|
|
152
|
+
canCheckout: override.canCheckout,
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
if (cursor.isFridayOrSaturday) {
|
|
158
|
+
yield {
|
|
159
|
+
startingAt: cursor,
|
|
160
|
+
endingBefore: cursor.nextDay,
|
|
161
|
+
data: {
|
|
162
|
+
price: Number(pricingConfig.weekendRate).toFixed(2),
|
|
163
|
+
minNights: pricingConfig.minimumWeekendStay,
|
|
164
|
+
canCheckin: canCheckin,
|
|
165
|
+
canCheckout: canCheckin,
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
yield {
|
|
171
|
+
startingAt: cursor,
|
|
172
|
+
endingBefore: cursor.nextDay,
|
|
173
|
+
data: {
|
|
174
|
+
price: pricingConfig.dailyRate,
|
|
175
|
+
minNights: pricingConfig.minimumStay,
|
|
176
|
+
canCheckin: canCheckin,
|
|
177
|
+
canCheckout: canCheckin,
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
cursor = cursor.nextDay;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
async getRules(property) {
|
|
186
|
+
const resp = await this.api.transport.fetch({
|
|
187
|
+
method: "GET",
|
|
188
|
+
path: `/api/v3.1/property-pricing-rules/${property.uid}`,
|
|
189
|
+
response: zod_1.z.object({
|
|
190
|
+
propertyPricingRules: PricingRulesSchema,
|
|
191
|
+
}),
|
|
192
|
+
});
|
|
193
|
+
return resp.propertyPricingRules;
|
|
194
|
+
}
|
|
195
|
+
async setRules(property, rules) {
|
|
196
|
+
await this.api.transport.fetch({
|
|
197
|
+
method: "PUT",
|
|
198
|
+
path: `/api/v3.1/property-pricing-rules/${property.uid}`,
|
|
199
|
+
body: rules,
|
|
200
|
+
response: null,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
exports.PricingApi = PricingApi;
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { HostfullyApi } from "./HostfullyApi";
|
|
3
|
+
declare const PropertySchema: z.ZodObject<{
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
isActive: z.ZodBoolean;
|
|
6
|
+
uid: z.ZodString;
|
|
7
|
+
showPropertyExactLocation: z.ZodBoolean;
|
|
8
|
+
cancellationPolicy: z.ZodNullable<z.ZodString>;
|
|
9
|
+
availability: z.ZodObject<{
|
|
10
|
+
allowBookingRequestsAboveMaximumStay: z.ZodNullable<z.ZodBoolean>;
|
|
11
|
+
allowBookingRequestWhenOutOfLeadTime: z.ZodNullable<z.ZodBoolean>;
|
|
12
|
+
baseGuests: z.ZodNumber;
|
|
13
|
+
bookingLeadTime: z.ZodNullable<z.ZodNumber>;
|
|
14
|
+
bookingWindow: z.ZodNullable<z.ZodNumber>;
|
|
15
|
+
checkInTimeEnd: z.ZodNullable<z.ZodNumber>;
|
|
16
|
+
checkInTimeEndFlexible: z.ZodNullable<z.ZodBoolean>;
|
|
17
|
+
checkInTimeStart: z.ZodNullable<z.ZodNumber>;
|
|
18
|
+
checkOutTime: z.ZodNullable<z.ZodNumber>;
|
|
19
|
+
daysOfTheWeekToCheckInOn: z.ZodArray<z.ZodString, "many">;
|
|
20
|
+
maxGuests: z.ZodNumber;
|
|
21
|
+
maximumStay: z.ZodNullable<z.ZodNumber>;
|
|
22
|
+
minimumStay: z.ZodNullable<z.ZodNumber>;
|
|
23
|
+
minimumWeekendStay: z.ZodNullable<z.ZodNumber>;
|
|
24
|
+
turnOverDays: z.ZodNullable<z.ZodNumber>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
allowBookingRequestsAboveMaximumStay: boolean | null;
|
|
27
|
+
allowBookingRequestWhenOutOfLeadTime: boolean | null;
|
|
28
|
+
baseGuests: number;
|
|
29
|
+
bookingLeadTime: number | null;
|
|
30
|
+
bookingWindow: number | null;
|
|
31
|
+
checkInTimeEnd: number | null;
|
|
32
|
+
checkInTimeEndFlexible: boolean | null;
|
|
33
|
+
checkInTimeStart: number | null;
|
|
34
|
+
checkOutTime: number | null;
|
|
35
|
+
daysOfTheWeekToCheckInOn: string[];
|
|
36
|
+
maxGuests: number;
|
|
37
|
+
maximumStay: number | null;
|
|
38
|
+
minimumStay: number | null;
|
|
39
|
+
minimumWeekendStay: number | null;
|
|
40
|
+
turnOverDays: number | null;
|
|
41
|
+
}, {
|
|
42
|
+
allowBookingRequestsAboveMaximumStay: boolean | null;
|
|
43
|
+
allowBookingRequestWhenOutOfLeadTime: boolean | null;
|
|
44
|
+
baseGuests: number;
|
|
45
|
+
bookingLeadTime: number | null;
|
|
46
|
+
bookingWindow: number | null;
|
|
47
|
+
checkInTimeEnd: number | null;
|
|
48
|
+
checkInTimeEndFlexible: boolean | null;
|
|
49
|
+
checkInTimeStart: number | null;
|
|
50
|
+
checkOutTime: number | null;
|
|
51
|
+
daysOfTheWeekToCheckInOn: string[];
|
|
52
|
+
maxGuests: number;
|
|
53
|
+
maximumStay: number | null;
|
|
54
|
+
minimumStay: number | null;
|
|
55
|
+
minimumWeekendStay: number | null;
|
|
56
|
+
turnOverDays: number | null;
|
|
57
|
+
}>;
|
|
58
|
+
address: z.ZodObject<{
|
|
59
|
+
address: z.ZodNullable<z.ZodString>;
|
|
60
|
+
address2: z.ZodNullable<z.ZodString>;
|
|
61
|
+
city: z.ZodNullable<z.ZodString>;
|
|
62
|
+
state: z.ZodNullable<z.ZodString>;
|
|
63
|
+
zipCode: z.ZodNullable<z.ZodString>;
|
|
64
|
+
}, "strip", z.ZodTypeAny, {
|
|
65
|
+
address: string | null;
|
|
66
|
+
address2: string | null;
|
|
67
|
+
city: string | null;
|
|
68
|
+
state: string | null;
|
|
69
|
+
zipCode: string | null;
|
|
70
|
+
}, {
|
|
71
|
+
address: string | null;
|
|
72
|
+
address2: string | null;
|
|
73
|
+
city: string | null;
|
|
74
|
+
state: string | null;
|
|
75
|
+
zipCode: string | null;
|
|
76
|
+
}>;
|
|
77
|
+
pricing: z.ZodObject<{
|
|
78
|
+
taxRate: z.ZodNullable<z.ZodNumber>;
|
|
79
|
+
ignoreTaxRateChargeOverXDays: z.ZodNullable<z.ZodBoolean>;
|
|
80
|
+
daysOverWhichTaxRateChargeShouldBeIgnored: z.ZodNullable<z.ZodNumber>;
|
|
81
|
+
cleaningFeeTaxRate: z.ZodNullable<z.ZodNumber>;
|
|
82
|
+
extraGuestFee: z.ZodNumber;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
taxRate: number | null;
|
|
85
|
+
ignoreTaxRateChargeOverXDays: boolean | null;
|
|
86
|
+
daysOverWhichTaxRateChargeShouldBeIgnored: number | null;
|
|
87
|
+
cleaningFeeTaxRate: number | null;
|
|
88
|
+
extraGuestFee: number;
|
|
89
|
+
}, {
|
|
90
|
+
taxRate: number | null;
|
|
91
|
+
ignoreTaxRateChargeOverXDays: boolean | null;
|
|
92
|
+
daysOverWhichTaxRateChargeShouldBeIgnored: number | null;
|
|
93
|
+
cleaningFeeTaxRate: number | null;
|
|
94
|
+
extraGuestFee: number;
|
|
95
|
+
}>;
|
|
96
|
+
}, "strip", z.ZodTypeAny, {
|
|
97
|
+
name: string;
|
|
98
|
+
isActive: boolean;
|
|
99
|
+
uid: string;
|
|
100
|
+
showPropertyExactLocation: boolean;
|
|
101
|
+
cancellationPolicy: string | null;
|
|
102
|
+
availability: {
|
|
103
|
+
allowBookingRequestsAboveMaximumStay: boolean | null;
|
|
104
|
+
allowBookingRequestWhenOutOfLeadTime: boolean | null;
|
|
105
|
+
baseGuests: number;
|
|
106
|
+
bookingLeadTime: number | null;
|
|
107
|
+
bookingWindow: number | null;
|
|
108
|
+
checkInTimeEnd: number | null;
|
|
109
|
+
checkInTimeEndFlexible: boolean | null;
|
|
110
|
+
checkInTimeStart: number | null;
|
|
111
|
+
checkOutTime: number | null;
|
|
112
|
+
daysOfTheWeekToCheckInOn: string[];
|
|
113
|
+
maxGuests: number;
|
|
114
|
+
maximumStay: number | null;
|
|
115
|
+
minimumStay: number | null;
|
|
116
|
+
minimumWeekendStay: number | null;
|
|
117
|
+
turnOverDays: number | null;
|
|
118
|
+
};
|
|
119
|
+
address: {
|
|
120
|
+
address: string | null;
|
|
121
|
+
address2: string | null;
|
|
122
|
+
city: string | null;
|
|
123
|
+
state: string | null;
|
|
124
|
+
zipCode: string | null;
|
|
125
|
+
};
|
|
126
|
+
pricing: {
|
|
127
|
+
taxRate: number | null;
|
|
128
|
+
ignoreTaxRateChargeOverXDays: boolean | null;
|
|
129
|
+
daysOverWhichTaxRateChargeShouldBeIgnored: number | null;
|
|
130
|
+
cleaningFeeTaxRate: number | null;
|
|
131
|
+
extraGuestFee: number;
|
|
132
|
+
};
|
|
133
|
+
}, {
|
|
134
|
+
name: string;
|
|
135
|
+
isActive: boolean;
|
|
136
|
+
uid: string;
|
|
137
|
+
showPropertyExactLocation: boolean;
|
|
138
|
+
cancellationPolicy: string | null;
|
|
139
|
+
availability: {
|
|
140
|
+
allowBookingRequestsAboveMaximumStay: boolean | null;
|
|
141
|
+
allowBookingRequestWhenOutOfLeadTime: boolean | null;
|
|
142
|
+
baseGuests: number;
|
|
143
|
+
bookingLeadTime: number | null;
|
|
144
|
+
bookingWindow: number | null;
|
|
145
|
+
checkInTimeEnd: number | null;
|
|
146
|
+
checkInTimeEndFlexible: boolean | null;
|
|
147
|
+
checkInTimeStart: number | null;
|
|
148
|
+
checkOutTime: number | null;
|
|
149
|
+
daysOfTheWeekToCheckInOn: string[];
|
|
150
|
+
maxGuests: number;
|
|
151
|
+
maximumStay: number | null;
|
|
152
|
+
minimumStay: number | null;
|
|
153
|
+
minimumWeekendStay: number | null;
|
|
154
|
+
turnOverDays: number | null;
|
|
155
|
+
};
|
|
156
|
+
address: {
|
|
157
|
+
address: string | null;
|
|
158
|
+
address2: string | null;
|
|
159
|
+
city: string | null;
|
|
160
|
+
state: string | null;
|
|
161
|
+
zipCode: string | null;
|
|
162
|
+
};
|
|
163
|
+
pricing: {
|
|
164
|
+
taxRate: number | null;
|
|
165
|
+
ignoreTaxRateChargeOverXDays: boolean | null;
|
|
166
|
+
daysOverWhichTaxRateChargeShouldBeIgnored: number | null;
|
|
167
|
+
cleaningFeeTaxRate: number | null;
|
|
168
|
+
extraGuestFee: number;
|
|
169
|
+
};
|
|
170
|
+
}>;
|
|
171
|
+
export type BookingLeadTime = "-15" | "-14" | "-13" | "-12" | "-11" | "-10" | "-9" | "-8" | "-7" | "-6" | "-5" | "-4" | "-3" | "-2" | "-1" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" | "18" | "19" | "20" | "21" | "22" | "23" | "24" | "48" | "72" | "168";
|
|
172
|
+
export type Property = z.infer<typeof PropertySchema>;
|
|
173
|
+
export interface PropertyPropertiesPatch {
|
|
174
|
+
name?: string;
|
|
175
|
+
showPropertyExactLocation?: boolean;
|
|
176
|
+
cancellationPolicy?: string;
|
|
177
|
+
pricing?: {
|
|
178
|
+
taxRate?: number | null;
|
|
179
|
+
ignoreTaxRateChargeOverXDays?: boolean | null;
|
|
180
|
+
daysOverWhichTaxRateChargeShouldBeIgnored?: number | null;
|
|
181
|
+
cleaningFeeTaxRate?: number | null;
|
|
182
|
+
extraGuestFee?: number | null;
|
|
183
|
+
};
|
|
184
|
+
availability?: {
|
|
185
|
+
baseGuests?: number;
|
|
186
|
+
maxGuests?: number;
|
|
187
|
+
bookingLeadTime?: BookingLeadTime;
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
declare const PropertyDescriptionsSchema: z.ZodObject<{
|
|
191
|
+
name: z.ZodNullable<z.ZodString>;
|
|
192
|
+
shortSummary: z.ZodNullable<z.ZodString>;
|
|
193
|
+
summary: z.ZodNullable<z.ZodString>;
|
|
194
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
195
|
+
access: z.ZodNullable<z.ZodString>;
|
|
196
|
+
transit: z.ZodNullable<z.ZodString>;
|
|
197
|
+
interaction: z.ZodNullable<z.ZodString>;
|
|
198
|
+
neighbourhood: z.ZodNullable<z.ZodString>;
|
|
199
|
+
space: z.ZodNullable<z.ZodString>;
|
|
200
|
+
houseManual: z.ZodNullable<z.ZodString>;
|
|
201
|
+
locale: z.ZodString;
|
|
202
|
+
}, "strip", z.ZodTypeAny, {
|
|
203
|
+
name: string | null;
|
|
204
|
+
shortSummary: string | null;
|
|
205
|
+
summary: string | null;
|
|
206
|
+
notes: string | null;
|
|
207
|
+
access: string | null;
|
|
208
|
+
transit: string | null;
|
|
209
|
+
interaction: string | null;
|
|
210
|
+
neighbourhood: string | null;
|
|
211
|
+
space: string | null;
|
|
212
|
+
houseManual: string | null;
|
|
213
|
+
locale: string;
|
|
214
|
+
}, {
|
|
215
|
+
name: string | null;
|
|
216
|
+
shortSummary: string | null;
|
|
217
|
+
summary: string | null;
|
|
218
|
+
notes: string | null;
|
|
219
|
+
access: string | null;
|
|
220
|
+
transit: string | null;
|
|
221
|
+
interaction: string | null;
|
|
222
|
+
neighbourhood: string | null;
|
|
223
|
+
space: string | null;
|
|
224
|
+
houseManual: string | null;
|
|
225
|
+
locale: string;
|
|
226
|
+
}>;
|
|
227
|
+
export type PropertyDescriptions = z.infer<typeof PropertyDescriptionsSchema>;
|
|
228
|
+
export declare class PropertiesApi {
|
|
229
|
+
private readonly api;
|
|
230
|
+
constructor(api: HostfullyApi);
|
|
231
|
+
list(): Promise<Property[]>;
|
|
232
|
+
patch(property: Property, update: PropertyPropertiesPatch): Promise<void>;
|
|
233
|
+
getCustomData(property: Property): Promise<Map<string, string>>;
|
|
234
|
+
setCustomData(property: Property, fieldUid: string, value: string): Promise<void>;
|
|
235
|
+
deleteCustomData(property: Property, fieldUid: string): Promise<void>;
|
|
236
|
+
getDescriptions(property: Property): Promise<{
|
|
237
|
+
name: string | null;
|
|
238
|
+
shortSummary: string | null;
|
|
239
|
+
summary: string | null;
|
|
240
|
+
notes: string | null;
|
|
241
|
+
access: string | null;
|
|
242
|
+
transit: string | null;
|
|
243
|
+
interaction: string | null;
|
|
244
|
+
neighbourhood: string | null;
|
|
245
|
+
space: string | null;
|
|
246
|
+
houseManual: string | null;
|
|
247
|
+
locale: string;
|
|
248
|
+
}>;
|
|
249
|
+
updateDescriptions(property: Property, updates: Partial<PropertyDescriptions>): Promise<void>;
|
|
250
|
+
}
|
|
251
|
+
export {};
|