@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,513 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Day } from "@spoot/day";
|
|
3
|
+
import { HostfullyApi } from "./HostfullyApi";
|
|
4
|
+
import { Property } from "./PropertiesApi";
|
|
5
|
+
import { LeadStatusSchema } from "./enums";
|
|
6
|
+
export declare const LeadSchema: z.ZodObject<{
|
|
7
|
+
uid: z.ZodString;
|
|
8
|
+
type: z.ZodNullable<z.ZodEnum<["INQUIRY", "BOOKING_REQUEST", "BLOCK", "BOOKING"]>>;
|
|
9
|
+
status: z.ZodNullable<z.ZodEnum<["BLOCKED", "NEW", "ON_HOLD", "CLOSED", "PENDING", "DECLINED", "BOOKED", "CANCELLED", "IGNORED", "DUPLICATE", "SAMPLE"]>>;
|
|
10
|
+
source: z.ZodEnum<["HOSTFULLY_UI", "HOSTFULLY_DBS", "HOSTFULLY_API", "HOSTFULLY_LINKED", "HOSTFULLY_OWNER_PORTAL", "HOSTFULLY_ICAL", "DIRECT_HOMETOGO", "DIRECT_BOOKINGDOTCOM", "DIRECT_AIRBNB", "DIRECT_VRBO", "DIRECT_HVMI", "DIRECT_REDAWNING", "DIRECT_GOOGLE"]>;
|
|
11
|
+
propertyUid: z.ZodNullable<z.ZodString>;
|
|
12
|
+
agencyUid: z.ZodNullable<z.ZodString>;
|
|
13
|
+
checkInZonedDateTime: z.ZodString;
|
|
14
|
+
checkOutZonedDateTime: z.ZodString;
|
|
15
|
+
checkInLocalDateTime: z.ZodString;
|
|
16
|
+
checkOutLocalDateTime: z.ZodString;
|
|
17
|
+
bookedUtcDateTime: z.ZodNullable<z.ZodString>;
|
|
18
|
+
externalBookingId: z.ZodNullable<z.ZodString>;
|
|
19
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
20
|
+
extraNotes: z.ZodNullable<z.ZodString>;
|
|
21
|
+
referrer: z.ZodNullable<z.ZodString>;
|
|
22
|
+
assignee: z.ZodNullable<z.ZodObject<{
|
|
23
|
+
uid: z.ZodNullable<z.ZodString>;
|
|
24
|
+
type: z.ZodNullable<z.ZodString>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
type: string | null;
|
|
27
|
+
uid: string | null;
|
|
28
|
+
}, {
|
|
29
|
+
type: string | null;
|
|
30
|
+
uid: string | null;
|
|
31
|
+
}>>;
|
|
32
|
+
metadata: z.ZodObject<{
|
|
33
|
+
createdUtcDateTime: z.ZodNullable<z.ZodString>;
|
|
34
|
+
updatedUtcDateTime: z.ZodNullable<z.ZodString>;
|
|
35
|
+
creationCircumstances: z.ZodNullable<z.ZodString>;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
createdUtcDateTime: string | null;
|
|
38
|
+
updatedUtcDateTime: string | null;
|
|
39
|
+
creationCircumstances: string | null;
|
|
40
|
+
}, {
|
|
41
|
+
createdUtcDateTime: string | null;
|
|
42
|
+
updatedUtcDateTime: string | null;
|
|
43
|
+
creationCircumstances: string | null;
|
|
44
|
+
}>;
|
|
45
|
+
guestInformation: z.ZodObject<{
|
|
46
|
+
firstName: z.ZodNullable<z.ZodString>;
|
|
47
|
+
lastName: z.ZodNullable<z.ZodString>;
|
|
48
|
+
address1: z.ZodNullable<z.ZodString>;
|
|
49
|
+
address2: z.ZodNullable<z.ZodString>;
|
|
50
|
+
zipCode: z.ZodNullable<z.ZodString>;
|
|
51
|
+
city: z.ZodNullable<z.ZodString>;
|
|
52
|
+
state: z.ZodNullable<z.ZodString>;
|
|
53
|
+
countryCode: z.ZodNullable<z.ZodString>;
|
|
54
|
+
passportId: z.ZodNullable<z.ZodString>;
|
|
55
|
+
passportCountryCode: z.ZodNullable<z.ZodString>;
|
|
56
|
+
adultCount: z.ZodNullable<z.ZodNumber>;
|
|
57
|
+
childrenCount: z.ZodNullable<z.ZodNumber>;
|
|
58
|
+
petCount: z.ZodNullable<z.ZodNumber>;
|
|
59
|
+
infantCount: z.ZodNullable<z.ZodNumber>;
|
|
60
|
+
riskScore: z.ZodNullable<z.ZodNumber>;
|
|
61
|
+
email: z.ZodNullable<z.ZodString>;
|
|
62
|
+
secondaryEmail: z.ZodNullable<z.ZodString>;
|
|
63
|
+
phoneNumber: z.ZodNullable<z.ZodString>;
|
|
64
|
+
cellPhoneNumber: z.ZodNullable<z.ZodString>;
|
|
65
|
+
flightNumber: z.ZodNullable<z.ZodString>;
|
|
66
|
+
reasonForTrip: z.ZodNullable<z.ZodString>;
|
|
67
|
+
willHaveParty: z.ZodNullable<z.ZodBoolean>;
|
|
68
|
+
willHaveVisit: z.ZodNullable<z.ZodBoolean>;
|
|
69
|
+
preferredCurrency: z.ZodNullable<z.ZodString>;
|
|
70
|
+
preferredLocale: z.ZodNullable<z.ZodUnknown>;
|
|
71
|
+
arrivalLocalDateTime: z.ZodNullable<z.ZodString>;
|
|
72
|
+
departureLocalDateTime: z.ZodNullable<z.ZodString>;
|
|
73
|
+
}, "strip", z.ZodTypeAny, {
|
|
74
|
+
address2: string | null;
|
|
75
|
+
city: string | null;
|
|
76
|
+
state: string | null;
|
|
77
|
+
zipCode: string | null;
|
|
78
|
+
firstName: string | null;
|
|
79
|
+
lastName: string | null;
|
|
80
|
+
address1: string | null;
|
|
81
|
+
countryCode: string | null;
|
|
82
|
+
passportId: string | null;
|
|
83
|
+
passportCountryCode: string | null;
|
|
84
|
+
adultCount: number | null;
|
|
85
|
+
childrenCount: number | null;
|
|
86
|
+
petCount: number | null;
|
|
87
|
+
infantCount: number | null;
|
|
88
|
+
riskScore: number | null;
|
|
89
|
+
email: string | null;
|
|
90
|
+
secondaryEmail: string | null;
|
|
91
|
+
phoneNumber: string | null;
|
|
92
|
+
cellPhoneNumber: string | null;
|
|
93
|
+
flightNumber: string | null;
|
|
94
|
+
reasonForTrip: string | null;
|
|
95
|
+
willHaveParty: boolean | null;
|
|
96
|
+
willHaveVisit: boolean | null;
|
|
97
|
+
preferredCurrency: string | null;
|
|
98
|
+
arrivalLocalDateTime: string | null;
|
|
99
|
+
departureLocalDateTime: string | null;
|
|
100
|
+
preferredLocale?: unknown;
|
|
101
|
+
}, {
|
|
102
|
+
address2: string | null;
|
|
103
|
+
city: string | null;
|
|
104
|
+
state: string | null;
|
|
105
|
+
zipCode: string | null;
|
|
106
|
+
firstName: string | null;
|
|
107
|
+
lastName: string | null;
|
|
108
|
+
address1: string | null;
|
|
109
|
+
countryCode: string | null;
|
|
110
|
+
passportId: string | null;
|
|
111
|
+
passportCountryCode: string | null;
|
|
112
|
+
adultCount: number | null;
|
|
113
|
+
childrenCount: number | null;
|
|
114
|
+
petCount: number | null;
|
|
115
|
+
infantCount: number | null;
|
|
116
|
+
riskScore: number | null;
|
|
117
|
+
email: string | null;
|
|
118
|
+
secondaryEmail: string | null;
|
|
119
|
+
phoneNumber: string | null;
|
|
120
|
+
cellPhoneNumber: string | null;
|
|
121
|
+
flightNumber: string | null;
|
|
122
|
+
reasonForTrip: string | null;
|
|
123
|
+
willHaveParty: boolean | null;
|
|
124
|
+
willHaveVisit: boolean | null;
|
|
125
|
+
preferredCurrency: string | null;
|
|
126
|
+
arrivalLocalDateTime: string | null;
|
|
127
|
+
departureLocalDateTime: string | null;
|
|
128
|
+
preferredLocale?: unknown;
|
|
129
|
+
}>;
|
|
130
|
+
}, "strip", z.ZodTypeAny, {
|
|
131
|
+
type: "INQUIRY" | "BOOKING_REQUEST" | "BLOCK" | "BOOKING" | null;
|
|
132
|
+
status: "BLOCKED" | "NEW" | "ON_HOLD" | "CLOSED" | "PENDING" | "DECLINED" | "BOOKED" | "CANCELLED" | "IGNORED" | "DUPLICATE" | "SAMPLE" | null;
|
|
133
|
+
uid: string;
|
|
134
|
+
notes: string | null;
|
|
135
|
+
agencyUid: string | null;
|
|
136
|
+
propertyUid: string | null;
|
|
137
|
+
source: "HOSTFULLY_UI" | "HOSTFULLY_DBS" | "HOSTFULLY_API" | "HOSTFULLY_LINKED" | "HOSTFULLY_OWNER_PORTAL" | "HOSTFULLY_ICAL" | "DIRECT_HOMETOGO" | "DIRECT_BOOKINGDOTCOM" | "DIRECT_AIRBNB" | "DIRECT_VRBO" | "DIRECT_HVMI" | "DIRECT_REDAWNING" | "DIRECT_GOOGLE";
|
|
138
|
+
checkInZonedDateTime: string;
|
|
139
|
+
checkOutZonedDateTime: string;
|
|
140
|
+
checkInLocalDateTime: string;
|
|
141
|
+
checkOutLocalDateTime: string;
|
|
142
|
+
bookedUtcDateTime: string | null;
|
|
143
|
+
externalBookingId: string | null;
|
|
144
|
+
extraNotes: string | null;
|
|
145
|
+
referrer: string | null;
|
|
146
|
+
assignee: {
|
|
147
|
+
type: string | null;
|
|
148
|
+
uid: string | null;
|
|
149
|
+
} | null;
|
|
150
|
+
metadata: {
|
|
151
|
+
createdUtcDateTime: string | null;
|
|
152
|
+
updatedUtcDateTime: string | null;
|
|
153
|
+
creationCircumstances: string | null;
|
|
154
|
+
};
|
|
155
|
+
guestInformation: {
|
|
156
|
+
address2: string | null;
|
|
157
|
+
city: string | null;
|
|
158
|
+
state: string | null;
|
|
159
|
+
zipCode: string | null;
|
|
160
|
+
firstName: string | null;
|
|
161
|
+
lastName: string | null;
|
|
162
|
+
address1: string | null;
|
|
163
|
+
countryCode: string | null;
|
|
164
|
+
passportId: string | null;
|
|
165
|
+
passportCountryCode: string | null;
|
|
166
|
+
adultCount: number | null;
|
|
167
|
+
childrenCount: number | null;
|
|
168
|
+
petCount: number | null;
|
|
169
|
+
infantCount: number | null;
|
|
170
|
+
riskScore: number | null;
|
|
171
|
+
email: string | null;
|
|
172
|
+
secondaryEmail: string | null;
|
|
173
|
+
phoneNumber: string | null;
|
|
174
|
+
cellPhoneNumber: string | null;
|
|
175
|
+
flightNumber: string | null;
|
|
176
|
+
reasonForTrip: string | null;
|
|
177
|
+
willHaveParty: boolean | null;
|
|
178
|
+
willHaveVisit: boolean | null;
|
|
179
|
+
preferredCurrency: string | null;
|
|
180
|
+
arrivalLocalDateTime: string | null;
|
|
181
|
+
departureLocalDateTime: string | null;
|
|
182
|
+
preferredLocale?: unknown;
|
|
183
|
+
};
|
|
184
|
+
}, {
|
|
185
|
+
type: "INQUIRY" | "BOOKING_REQUEST" | "BLOCK" | "BOOKING" | null;
|
|
186
|
+
status: "BLOCKED" | "NEW" | "ON_HOLD" | "CLOSED" | "PENDING" | "DECLINED" | "BOOKED" | "CANCELLED" | "IGNORED" | "DUPLICATE" | "SAMPLE" | null;
|
|
187
|
+
uid: string;
|
|
188
|
+
notes: string | null;
|
|
189
|
+
agencyUid: string | null;
|
|
190
|
+
propertyUid: string | null;
|
|
191
|
+
source: "HOSTFULLY_UI" | "HOSTFULLY_DBS" | "HOSTFULLY_API" | "HOSTFULLY_LINKED" | "HOSTFULLY_OWNER_PORTAL" | "HOSTFULLY_ICAL" | "DIRECT_HOMETOGO" | "DIRECT_BOOKINGDOTCOM" | "DIRECT_AIRBNB" | "DIRECT_VRBO" | "DIRECT_HVMI" | "DIRECT_REDAWNING" | "DIRECT_GOOGLE";
|
|
192
|
+
checkInZonedDateTime: string;
|
|
193
|
+
checkOutZonedDateTime: string;
|
|
194
|
+
checkInLocalDateTime: string;
|
|
195
|
+
checkOutLocalDateTime: string;
|
|
196
|
+
bookedUtcDateTime: string | null;
|
|
197
|
+
externalBookingId: string | null;
|
|
198
|
+
extraNotes: string | null;
|
|
199
|
+
referrer: string | null;
|
|
200
|
+
assignee: {
|
|
201
|
+
type: string | null;
|
|
202
|
+
uid: string | null;
|
|
203
|
+
} | null;
|
|
204
|
+
metadata: {
|
|
205
|
+
createdUtcDateTime: string | null;
|
|
206
|
+
updatedUtcDateTime: string | null;
|
|
207
|
+
creationCircumstances: string | null;
|
|
208
|
+
};
|
|
209
|
+
guestInformation: {
|
|
210
|
+
address2: string | null;
|
|
211
|
+
city: string | null;
|
|
212
|
+
state: string | null;
|
|
213
|
+
zipCode: string | null;
|
|
214
|
+
firstName: string | null;
|
|
215
|
+
lastName: string | null;
|
|
216
|
+
address1: string | null;
|
|
217
|
+
countryCode: string | null;
|
|
218
|
+
passportId: string | null;
|
|
219
|
+
passportCountryCode: string | null;
|
|
220
|
+
adultCount: number | null;
|
|
221
|
+
childrenCount: number | null;
|
|
222
|
+
petCount: number | null;
|
|
223
|
+
infantCount: number | null;
|
|
224
|
+
riskScore: number | null;
|
|
225
|
+
email: string | null;
|
|
226
|
+
secondaryEmail: string | null;
|
|
227
|
+
phoneNumber: string | null;
|
|
228
|
+
cellPhoneNumber: string | null;
|
|
229
|
+
flightNumber: string | null;
|
|
230
|
+
reasonForTrip: string | null;
|
|
231
|
+
willHaveParty: boolean | null;
|
|
232
|
+
willHaveVisit: boolean | null;
|
|
233
|
+
preferredCurrency: string | null;
|
|
234
|
+
arrivalLocalDateTime: string | null;
|
|
235
|
+
departureLocalDateTime: string | null;
|
|
236
|
+
preferredLocale?: unknown;
|
|
237
|
+
};
|
|
238
|
+
}>;
|
|
239
|
+
export type Lead = z.infer<typeof LeadSchema>;
|
|
240
|
+
export type LeadStatus = z.infer<typeof LeadStatusSchema>;
|
|
241
|
+
type LeadSource = {
|
|
242
|
+
property: Property;
|
|
243
|
+
} | {
|
|
244
|
+
propertyUid: string;
|
|
245
|
+
};
|
|
246
|
+
export declare class LeadsApi {
|
|
247
|
+
private readonly api;
|
|
248
|
+
constructor(api: HostfullyApi);
|
|
249
|
+
get(uid: string): Promise<{
|
|
250
|
+
type: "INQUIRY" | "BOOKING_REQUEST" | "BLOCK" | "BOOKING" | null;
|
|
251
|
+
status: "BLOCKED" | "NEW" | "ON_HOLD" | "CLOSED" | "PENDING" | "DECLINED" | "BOOKED" | "CANCELLED" | "IGNORED" | "DUPLICATE" | "SAMPLE" | null;
|
|
252
|
+
uid: string;
|
|
253
|
+
notes: string | null;
|
|
254
|
+
agencyUid: string | null;
|
|
255
|
+
propertyUid: string | null;
|
|
256
|
+
source: "HOSTFULLY_UI" | "HOSTFULLY_DBS" | "HOSTFULLY_API" | "HOSTFULLY_LINKED" | "HOSTFULLY_OWNER_PORTAL" | "HOSTFULLY_ICAL" | "DIRECT_HOMETOGO" | "DIRECT_BOOKINGDOTCOM" | "DIRECT_AIRBNB" | "DIRECT_VRBO" | "DIRECT_HVMI" | "DIRECT_REDAWNING" | "DIRECT_GOOGLE";
|
|
257
|
+
checkInZonedDateTime: string;
|
|
258
|
+
checkOutZonedDateTime: string;
|
|
259
|
+
checkInLocalDateTime: string;
|
|
260
|
+
checkOutLocalDateTime: string;
|
|
261
|
+
bookedUtcDateTime: string | null;
|
|
262
|
+
externalBookingId: string | null;
|
|
263
|
+
extraNotes: string | null;
|
|
264
|
+
referrer: string | null;
|
|
265
|
+
assignee: {
|
|
266
|
+
type: string | null;
|
|
267
|
+
uid: string | null;
|
|
268
|
+
} | null;
|
|
269
|
+
metadata: {
|
|
270
|
+
createdUtcDateTime: string | null;
|
|
271
|
+
updatedUtcDateTime: string | null;
|
|
272
|
+
creationCircumstances: string | null;
|
|
273
|
+
};
|
|
274
|
+
guestInformation: {
|
|
275
|
+
address2: string | null;
|
|
276
|
+
city: string | null;
|
|
277
|
+
state: string | null;
|
|
278
|
+
zipCode: string | null;
|
|
279
|
+
firstName: string | null;
|
|
280
|
+
lastName: string | null;
|
|
281
|
+
address1: string | null;
|
|
282
|
+
countryCode: string | null;
|
|
283
|
+
passportId: string | null;
|
|
284
|
+
passportCountryCode: string | null;
|
|
285
|
+
adultCount: number | null;
|
|
286
|
+
childrenCount: number | null;
|
|
287
|
+
petCount: number | null;
|
|
288
|
+
infantCount: number | null;
|
|
289
|
+
riskScore: number | null;
|
|
290
|
+
email: string | null;
|
|
291
|
+
secondaryEmail: string | null;
|
|
292
|
+
phoneNumber: string | null;
|
|
293
|
+
cellPhoneNumber: string | null;
|
|
294
|
+
flightNumber: string | null;
|
|
295
|
+
reasonForTrip: string | null;
|
|
296
|
+
willHaveParty: boolean | null;
|
|
297
|
+
willHaveVisit: boolean | null;
|
|
298
|
+
preferredCurrency: string | null;
|
|
299
|
+
arrivalLocalDateTime: string | null;
|
|
300
|
+
departureLocalDateTime: string | null;
|
|
301
|
+
preferredLocale?: unknown;
|
|
302
|
+
};
|
|
303
|
+
}>;
|
|
304
|
+
list(opts?: {
|
|
305
|
+
source?: LeadSource;
|
|
306
|
+
checkInFrom?: Day;
|
|
307
|
+
checkInTo?: Day;
|
|
308
|
+
checkOutFrom?: Day;
|
|
309
|
+
checkOutTo?: Day;
|
|
310
|
+
updatedSince?: Day;
|
|
311
|
+
limit?: number;
|
|
312
|
+
cursor?: string;
|
|
313
|
+
}): Promise<{
|
|
314
|
+
_paging: {
|
|
315
|
+
_limit: number;
|
|
316
|
+
_nextCursor: string | null;
|
|
317
|
+
};
|
|
318
|
+
_metadata: {
|
|
319
|
+
count: number;
|
|
320
|
+
};
|
|
321
|
+
leads: {
|
|
322
|
+
type: "INQUIRY" | "BOOKING_REQUEST" | "BLOCK" | "BOOKING" | null;
|
|
323
|
+
status: "BLOCKED" | "NEW" | "ON_HOLD" | "CLOSED" | "PENDING" | "DECLINED" | "BOOKED" | "CANCELLED" | "IGNORED" | "DUPLICATE" | "SAMPLE" | null;
|
|
324
|
+
uid: string;
|
|
325
|
+
notes: string | null;
|
|
326
|
+
agencyUid: string | null;
|
|
327
|
+
propertyUid: string | null;
|
|
328
|
+
source: "HOSTFULLY_UI" | "HOSTFULLY_DBS" | "HOSTFULLY_API" | "HOSTFULLY_LINKED" | "HOSTFULLY_OWNER_PORTAL" | "HOSTFULLY_ICAL" | "DIRECT_HOMETOGO" | "DIRECT_BOOKINGDOTCOM" | "DIRECT_AIRBNB" | "DIRECT_VRBO" | "DIRECT_HVMI" | "DIRECT_REDAWNING" | "DIRECT_GOOGLE";
|
|
329
|
+
checkInZonedDateTime: string;
|
|
330
|
+
checkOutZonedDateTime: string;
|
|
331
|
+
checkInLocalDateTime: string;
|
|
332
|
+
checkOutLocalDateTime: string;
|
|
333
|
+
bookedUtcDateTime: string | null;
|
|
334
|
+
externalBookingId: string | null;
|
|
335
|
+
extraNotes: string | null;
|
|
336
|
+
referrer: string | null;
|
|
337
|
+
assignee: {
|
|
338
|
+
type: string | null;
|
|
339
|
+
uid: string | null;
|
|
340
|
+
} | null;
|
|
341
|
+
metadata: {
|
|
342
|
+
createdUtcDateTime: string | null;
|
|
343
|
+
updatedUtcDateTime: string | null;
|
|
344
|
+
creationCircumstances: string | null;
|
|
345
|
+
};
|
|
346
|
+
guestInformation: {
|
|
347
|
+
address2: string | null;
|
|
348
|
+
city: string | null;
|
|
349
|
+
state: string | null;
|
|
350
|
+
zipCode: string | null;
|
|
351
|
+
firstName: string | null;
|
|
352
|
+
lastName: string | null;
|
|
353
|
+
address1: string | null;
|
|
354
|
+
countryCode: string | null;
|
|
355
|
+
passportId: string | null;
|
|
356
|
+
passportCountryCode: string | null;
|
|
357
|
+
adultCount: number | null;
|
|
358
|
+
childrenCount: number | null;
|
|
359
|
+
petCount: number | null;
|
|
360
|
+
infantCount: number | null;
|
|
361
|
+
riskScore: number | null;
|
|
362
|
+
email: string | null;
|
|
363
|
+
secondaryEmail: string | null;
|
|
364
|
+
phoneNumber: string | null;
|
|
365
|
+
cellPhoneNumber: string | null;
|
|
366
|
+
flightNumber: string | null;
|
|
367
|
+
reasonForTrip: string | null;
|
|
368
|
+
willHaveParty: boolean | null;
|
|
369
|
+
willHaveVisit: boolean | null;
|
|
370
|
+
preferredCurrency: string | null;
|
|
371
|
+
arrivalLocalDateTime: string | null;
|
|
372
|
+
departureLocalDateTime: string | null;
|
|
373
|
+
preferredLocale?: unknown;
|
|
374
|
+
};
|
|
375
|
+
}[];
|
|
376
|
+
}>;
|
|
377
|
+
scan(opts?: {
|
|
378
|
+
source?: LeadSource;
|
|
379
|
+
checkInFrom?: Day;
|
|
380
|
+
checkInTo?: Day;
|
|
381
|
+
checkOutFrom?: Day;
|
|
382
|
+
checkOutTo?: Day;
|
|
383
|
+
updatedSince?: Day;
|
|
384
|
+
perPage?: number;
|
|
385
|
+
}): AsyncGenerator<{
|
|
386
|
+
_paging: {
|
|
387
|
+
_limit: number;
|
|
388
|
+
_nextCursor: string | null;
|
|
389
|
+
};
|
|
390
|
+
_metadata: {
|
|
391
|
+
count: number;
|
|
392
|
+
};
|
|
393
|
+
leads: {
|
|
394
|
+
type: "INQUIRY" | "BOOKING_REQUEST" | "BLOCK" | "BOOKING" | null;
|
|
395
|
+
status: "BLOCKED" | "NEW" | "ON_HOLD" | "CLOSED" | "PENDING" | "DECLINED" | "BOOKED" | "CANCELLED" | "IGNORED" | "DUPLICATE" | "SAMPLE" | null;
|
|
396
|
+
uid: string;
|
|
397
|
+
notes: string | null;
|
|
398
|
+
agencyUid: string | null;
|
|
399
|
+
propertyUid: string | null;
|
|
400
|
+
source: "HOSTFULLY_UI" | "HOSTFULLY_DBS" | "HOSTFULLY_API" | "HOSTFULLY_LINKED" | "HOSTFULLY_OWNER_PORTAL" | "HOSTFULLY_ICAL" | "DIRECT_HOMETOGO" | "DIRECT_BOOKINGDOTCOM" | "DIRECT_AIRBNB" | "DIRECT_VRBO" | "DIRECT_HVMI" | "DIRECT_REDAWNING" | "DIRECT_GOOGLE";
|
|
401
|
+
checkInZonedDateTime: string;
|
|
402
|
+
checkOutZonedDateTime: string;
|
|
403
|
+
checkInLocalDateTime: string;
|
|
404
|
+
checkOutLocalDateTime: string;
|
|
405
|
+
bookedUtcDateTime: string | null;
|
|
406
|
+
externalBookingId: string | null;
|
|
407
|
+
extraNotes: string | null;
|
|
408
|
+
referrer: string | null;
|
|
409
|
+
assignee: {
|
|
410
|
+
type: string | null;
|
|
411
|
+
uid: string | null;
|
|
412
|
+
} | null;
|
|
413
|
+
metadata: {
|
|
414
|
+
createdUtcDateTime: string | null;
|
|
415
|
+
updatedUtcDateTime: string | null;
|
|
416
|
+
creationCircumstances: string | null;
|
|
417
|
+
};
|
|
418
|
+
guestInformation: {
|
|
419
|
+
address2: string | null;
|
|
420
|
+
city: string | null;
|
|
421
|
+
state: string | null;
|
|
422
|
+
zipCode: string | null;
|
|
423
|
+
firstName: string | null;
|
|
424
|
+
lastName: string | null;
|
|
425
|
+
address1: string | null;
|
|
426
|
+
countryCode: string | null;
|
|
427
|
+
passportId: string | null;
|
|
428
|
+
passportCountryCode: string | null;
|
|
429
|
+
adultCount: number | null;
|
|
430
|
+
childrenCount: number | null;
|
|
431
|
+
petCount: number | null;
|
|
432
|
+
infantCount: number | null;
|
|
433
|
+
riskScore: number | null;
|
|
434
|
+
email: string | null;
|
|
435
|
+
secondaryEmail: string | null;
|
|
436
|
+
phoneNumber: string | null;
|
|
437
|
+
cellPhoneNumber: string | null;
|
|
438
|
+
flightNumber: string | null;
|
|
439
|
+
reasonForTrip: string | null;
|
|
440
|
+
willHaveParty: boolean | null;
|
|
441
|
+
willHaveVisit: boolean | null;
|
|
442
|
+
preferredCurrency: string | null;
|
|
443
|
+
arrivalLocalDateTime: string | null;
|
|
444
|
+
departureLocalDateTime: string | null;
|
|
445
|
+
preferredLocale?: unknown;
|
|
446
|
+
};
|
|
447
|
+
}[];
|
|
448
|
+
}, void, unknown>;
|
|
449
|
+
all(opts?: {
|
|
450
|
+
source?: LeadSource;
|
|
451
|
+
checkInFrom?: Day;
|
|
452
|
+
checkInTo?: Day;
|
|
453
|
+
checkOutFrom?: Day;
|
|
454
|
+
checkOutTo?: Day;
|
|
455
|
+
updatedSince?: Day;
|
|
456
|
+
perPage?: number;
|
|
457
|
+
}): Promise<{
|
|
458
|
+
type: "INQUIRY" | "BOOKING_REQUEST" | "BLOCK" | "BOOKING" | null;
|
|
459
|
+
status: "BLOCKED" | "NEW" | "ON_HOLD" | "CLOSED" | "PENDING" | "DECLINED" | "BOOKED" | "CANCELLED" | "IGNORED" | "DUPLICATE" | "SAMPLE" | null;
|
|
460
|
+
uid: string;
|
|
461
|
+
notes: string | null;
|
|
462
|
+
agencyUid: string | null;
|
|
463
|
+
propertyUid: string | null;
|
|
464
|
+
source: "HOSTFULLY_UI" | "HOSTFULLY_DBS" | "HOSTFULLY_API" | "HOSTFULLY_LINKED" | "HOSTFULLY_OWNER_PORTAL" | "HOSTFULLY_ICAL" | "DIRECT_HOMETOGO" | "DIRECT_BOOKINGDOTCOM" | "DIRECT_AIRBNB" | "DIRECT_VRBO" | "DIRECT_HVMI" | "DIRECT_REDAWNING" | "DIRECT_GOOGLE";
|
|
465
|
+
checkInZonedDateTime: string;
|
|
466
|
+
checkOutZonedDateTime: string;
|
|
467
|
+
checkInLocalDateTime: string;
|
|
468
|
+
checkOutLocalDateTime: string;
|
|
469
|
+
bookedUtcDateTime: string | null;
|
|
470
|
+
externalBookingId: string | null;
|
|
471
|
+
extraNotes: string | null;
|
|
472
|
+
referrer: string | null;
|
|
473
|
+
assignee: {
|
|
474
|
+
type: string | null;
|
|
475
|
+
uid: string | null;
|
|
476
|
+
} | null;
|
|
477
|
+
metadata: {
|
|
478
|
+
createdUtcDateTime: string | null;
|
|
479
|
+
updatedUtcDateTime: string | null;
|
|
480
|
+
creationCircumstances: string | null;
|
|
481
|
+
};
|
|
482
|
+
guestInformation: {
|
|
483
|
+
address2: string | null;
|
|
484
|
+
city: string | null;
|
|
485
|
+
state: string | null;
|
|
486
|
+
zipCode: string | null;
|
|
487
|
+
firstName: string | null;
|
|
488
|
+
lastName: string | null;
|
|
489
|
+
address1: string | null;
|
|
490
|
+
countryCode: string | null;
|
|
491
|
+
passportId: string | null;
|
|
492
|
+
passportCountryCode: string | null;
|
|
493
|
+
adultCount: number | null;
|
|
494
|
+
childrenCount: number | null;
|
|
495
|
+
petCount: number | null;
|
|
496
|
+
infantCount: number | null;
|
|
497
|
+
riskScore: number | null;
|
|
498
|
+
email: string | null;
|
|
499
|
+
secondaryEmail: string | null;
|
|
500
|
+
phoneNumber: string | null;
|
|
501
|
+
cellPhoneNumber: string | null;
|
|
502
|
+
flightNumber: string | null;
|
|
503
|
+
reasonForTrip: string | null;
|
|
504
|
+
willHaveParty: boolean | null;
|
|
505
|
+
willHaveVisit: boolean | null;
|
|
506
|
+
preferredCurrency: string | null;
|
|
507
|
+
arrivalLocalDateTime: string | null;
|
|
508
|
+
departureLocalDateTime: string | null;
|
|
509
|
+
preferredLocale?: unknown;
|
|
510
|
+
};
|
|
511
|
+
}[]>;
|
|
512
|
+
}
|
|
513
|
+
export {};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LeadsApi = exports.LeadSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const rx_1 = require("@spoot/rx");
|
|
6
|
+
const pagination_1 = require("./pagination");
|
|
7
|
+
const enums_1 = require("./enums");
|
|
8
|
+
exports.LeadSchema = zod_1.z.object({
|
|
9
|
+
uid: zod_1.z.string(),
|
|
10
|
+
type: zod_1.z.enum(["INQUIRY", "BOOKING_REQUEST", "BLOCK", "BOOKING"]).nullable(),
|
|
11
|
+
status: enums_1.LeadStatusSchema.nullable(),
|
|
12
|
+
source: zod_1.z.enum([
|
|
13
|
+
"HOSTFULLY_UI",
|
|
14
|
+
"HOSTFULLY_DBS",
|
|
15
|
+
"HOSTFULLY_API",
|
|
16
|
+
"HOSTFULLY_LINKED",
|
|
17
|
+
"HOSTFULLY_OWNER_PORTAL",
|
|
18
|
+
"HOSTFULLY_ICAL",
|
|
19
|
+
"DIRECT_HOMETOGO",
|
|
20
|
+
"DIRECT_BOOKINGDOTCOM",
|
|
21
|
+
"DIRECT_AIRBNB",
|
|
22
|
+
"DIRECT_VRBO",
|
|
23
|
+
"DIRECT_HVMI",
|
|
24
|
+
"DIRECT_REDAWNING",
|
|
25
|
+
"DIRECT_GOOGLE",
|
|
26
|
+
]),
|
|
27
|
+
propertyUid: zod_1.z.string().nullable(),
|
|
28
|
+
agencyUid: zod_1.z.string().nullable(),
|
|
29
|
+
checkInZonedDateTime: zod_1.z.string(),
|
|
30
|
+
checkOutZonedDateTime: zod_1.z.string(),
|
|
31
|
+
checkInLocalDateTime: zod_1.z.string(),
|
|
32
|
+
checkOutLocalDateTime: zod_1.z.string(),
|
|
33
|
+
bookedUtcDateTime: zod_1.z.string().nullable(),
|
|
34
|
+
externalBookingId: zod_1.z.string().nullable(),
|
|
35
|
+
notes: zod_1.z.string().nullable(),
|
|
36
|
+
extraNotes: zod_1.z.string().nullable(),
|
|
37
|
+
referrer: zod_1.z.string().nullable(),
|
|
38
|
+
assignee: zod_1.z
|
|
39
|
+
.object({
|
|
40
|
+
uid: zod_1.z.string().nullable(),
|
|
41
|
+
type: zod_1.z.string().nullable(),
|
|
42
|
+
})
|
|
43
|
+
.nullable(),
|
|
44
|
+
metadata: zod_1.z.object({
|
|
45
|
+
createdUtcDateTime: zod_1.z.string().nullable(),
|
|
46
|
+
updatedUtcDateTime: zod_1.z.string().nullable(),
|
|
47
|
+
creationCircumstances: zod_1.z.string().nullable(),
|
|
48
|
+
}),
|
|
49
|
+
guestInformation: zod_1.z.object({
|
|
50
|
+
firstName: zod_1.z.string().nullable(),
|
|
51
|
+
lastName: zod_1.z.string().nullable(),
|
|
52
|
+
address1: zod_1.z.string().nullable(),
|
|
53
|
+
address2: zod_1.z.string().nullable(),
|
|
54
|
+
zipCode: zod_1.z.string().nullable(),
|
|
55
|
+
city: zod_1.z.string().nullable(),
|
|
56
|
+
state: zod_1.z.string().nullable(),
|
|
57
|
+
countryCode: zod_1.z.string().nullable(),
|
|
58
|
+
passportId: zod_1.z.string().nullable(),
|
|
59
|
+
passportCountryCode: zod_1.z.string().nullable(),
|
|
60
|
+
adultCount: zod_1.z.number().nullable(),
|
|
61
|
+
childrenCount: zod_1.z.number().nullable(),
|
|
62
|
+
petCount: zod_1.z.number().nullable(),
|
|
63
|
+
infantCount: zod_1.z.number().nullable(),
|
|
64
|
+
riskScore: zod_1.z.number().nullable(),
|
|
65
|
+
email: zod_1.z.string().nullable(),
|
|
66
|
+
secondaryEmail: zod_1.z.string().nullable(),
|
|
67
|
+
phoneNumber: zod_1.z.string().nullable(),
|
|
68
|
+
cellPhoneNumber: zod_1.z.string().nullable(),
|
|
69
|
+
flightNumber: zod_1.z.string().nullable(),
|
|
70
|
+
reasonForTrip: zod_1.z.string().nullable(),
|
|
71
|
+
willHaveParty: zod_1.z.boolean().nullable(),
|
|
72
|
+
willHaveVisit: zod_1.z.boolean().nullable(),
|
|
73
|
+
preferredCurrency: zod_1.z.string().nullable(),
|
|
74
|
+
preferredLocale: zod_1.z.unknown().nullable(),
|
|
75
|
+
arrivalLocalDateTime: zod_1.z.string().nullable(),
|
|
76
|
+
departureLocalDateTime: zod_1.z.string().nullable(),
|
|
77
|
+
}),
|
|
78
|
+
});
|
|
79
|
+
class LeadsApi {
|
|
80
|
+
api;
|
|
81
|
+
constructor(api) {
|
|
82
|
+
this.api = api;
|
|
83
|
+
}
|
|
84
|
+
async get(uid) {
|
|
85
|
+
return (await this.api.transport.fetch({
|
|
86
|
+
method: "GET",
|
|
87
|
+
path: `/api/v3.1/leads/${encodeURIComponent(uid)}`,
|
|
88
|
+
response: zod_1.z.object({ lead: exports.LeadSchema }),
|
|
89
|
+
})).lead;
|
|
90
|
+
}
|
|
91
|
+
async list(opts = {}) {
|
|
92
|
+
return await this.api.transport.fetch({
|
|
93
|
+
method: "GET",
|
|
94
|
+
path: "/api/v3.1/leads",
|
|
95
|
+
query: {
|
|
96
|
+
...(!opts.source
|
|
97
|
+
? { agencyUid: this.api.agencyUid }
|
|
98
|
+
: "property" in opts.source
|
|
99
|
+
? { propertyUid: opts.source.property.uid }
|
|
100
|
+
: { propertyUid: opts.source.propertyUid }),
|
|
101
|
+
checkInFrom: opts.checkInFrom ? opts.checkInFrom.toJSON() : undefined,
|
|
102
|
+
checkInTo: opts.checkInTo ? opts.checkInTo.toJSON() : undefined,
|
|
103
|
+
checkOutFrom: opts.checkOutFrom
|
|
104
|
+
? opts.checkOutFrom.toJSON()
|
|
105
|
+
: undefined,
|
|
106
|
+
checkOutTo: opts.checkOutTo ? opts.checkOutTo.toJSON() : undefined,
|
|
107
|
+
updatedSince: opts.updatedSince
|
|
108
|
+
? opts.updatedSince.toJSON()
|
|
109
|
+
: undefined,
|
|
110
|
+
_limit: opts.limit?.toString(),
|
|
111
|
+
_cursor: opts.cursor,
|
|
112
|
+
},
|
|
113
|
+
response: zod_1.z.object({
|
|
114
|
+
leads: zod_1.z.array(exports.LeadSchema),
|
|
115
|
+
_metadata: zod_1.z.object({
|
|
116
|
+
count: zod_1.z.number(),
|
|
117
|
+
}),
|
|
118
|
+
_paging: pagination_1.PagingSchema,
|
|
119
|
+
}),
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
async *scan(opts = {}) {
|
|
123
|
+
const { perPage, ...rest } = opts;
|
|
124
|
+
yield* (0, pagination_1.scan)(async (cursor) => {
|
|
125
|
+
return await this.list({ ...rest, limit: perPage, cursor });
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
async all(opts = {}) {
|
|
129
|
+
return await rx_1.Rx.lastValueFrom(rx_1.Rx.from(this.scan(opts)).pipe(rx_1.Rx.mergeMap(({ leads }) => leads), rx_1.Rx.toArray()));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.LeadsApi = LeadsApi;
|