Skip to content

Commit b6ee3e0

Browse files
Enhance booking_experts component with new actions and properties (#19060)
* Enhance booking_experts component with new actions and properties - Added new actions: `getBooking`, `deleteGuest`, `updateGuest`, `listAvailabilities`, and `listRentableTypeAvailabilities`. - Introduced new properties for administration and booking IDs, guest details, and rentable type availability. - Updated existing actions to improve functionality and consistency. - Incremented package version to 0.2.0 and updated action versions accordingly. * Update versions for booking_experts actions and sources to 0.0.3 and 0.0.2 respectively - Incremented version for actions: `create-agenda-period`, `get-complex-prices`, and `list-inventory-objects` to 0.0.3. - Updated version for sources: `booking-updated`, `inventory-object-updated`, `new-booking-created`, and `new-inventory-object-created` to 0.0.2. * Update components/booking_experts/actions/delete-guest/delete-guest.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor booking_experts component for improved functionality - Simplified options method in booking_experts.app.mjs by removing unused channelId parameter. - Updated description in get-booking action to point to the correct documentation link. - Enhanced list-rentabletype-availabilities action to conditionally include date_range parameter based on start and end dates. - Removed unnecessary closing brace in delete-guest action for cleaner code. * Refactor list-rentabletype-availabilities action to streamline props - Removed the administrationId prop definition and its associated logic from the list-rentabletype-availabilities action for improved clarity and simplicity. * Enhance booking_experts actions with additional alerts and prop updates - Added warning alerts to listAvailabilities, deleteGuest, updateGuest, and listRentableTypeAvailabilities actions to inform users about API limitations. - Updated label formatting in booking_experts.app.mjs to include booking number for better identification. - Refactored administrationChannelId prop in list-bookings action for clarity. * Refactor booking_experts actions to improve consistency and functionality - Removed unnecessary console log from booking_experts.app.mjs for cleaner code. - Added missing `$` parameter to addGuestToReservation, deleteGuest, listInventoryObjects, searchContacts, and updateGuest actions for better integration. - Updated readOnlyHint in listAvailabilities action to true for improved user guidance. --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 1e51e88 commit b6ee3e0

File tree

17 files changed

+495
-22
lines changed

17 files changed

+495
-22
lines changed

components/booking_experts/actions/add-guest-to-reservation/add-guest-to-reservation.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import bookingExperts from "../../booking_experts.app.mjs";
33
export default {
44
key: "booking_experts-add-guest-to-reservation",
55
name: "Add Guest to Reservation",
6-
description: "Add a guest to a reservation.. [See the documentation](https://developers.bookingexperts.com/reference/administration-reservation-guests-create)",
7-
version: "0.0.2",
6+
description: "Add a guest to a reservation. [See the documentation](https://developers.bookingexperts.com/reference/administration-reservation-guests-create)",
7+
version: "0.0.3",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,
@@ -77,6 +77,7 @@ export default {
7777
},
7878
async run({ $ }) {
7979
const { data } = await this.bookingExperts.addGuestToReservation({
80+
$,
8081
administrationId: this.administrationId,
8182
reservationId: this.reservationId,
8283
data: {

components/booking_experts/actions/create-agenda-period/create-agenda-period.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "booking_experts-create-agenda-period",
55
name: "Create Agenda Period",
66
description: "Creates a new agenda period. [See the documentation](https://developers.bookingexperts.com/reference/administration-maintenance-agenda-periods-create)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import bookingExperts from "../../booking_experts.app.mjs";
2+
3+
export default {
4+
key: "booking_experts-delete-guest",
5+
name: "Delete Guest",
6+
description: "Delete a guest for a reservation. [See the documentation](https://developers.bookingexperts.com/reference/administration-reservation-guests-delete)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: true,
10+
openWorldHint: true,
11+
readOnlyHint: false,
12+
},
13+
type: "action",
14+
props: {
15+
bookingExperts,
16+
administrationId: {
17+
propDefinition: [
18+
bookingExperts,
19+
"administrationId",
20+
],
21+
},
22+
reservationId: {
23+
propDefinition: [
24+
bookingExperts,
25+
"reservationId",
26+
({ administrationId }) => ({
27+
administrationId,
28+
}),
29+
],
30+
},
31+
info: {
32+
type: "alert",
33+
alertType: "warning",
34+
content: "**The API will only list guests created through the Booking Experts API.**",
35+
},
36+
guestId: {
37+
propDefinition: [
38+
bookingExperts,
39+
"guestId",
40+
({
41+
administrationId, reservationId,
42+
}) => ({
43+
administrationId,
44+
reservationId,
45+
}),
46+
],
47+
},
48+
},
49+
async run({ $ }) {
50+
const response = await this.bookingExperts.deleteGuest({
51+
$,
52+
administrationId: this.administrationId,
53+
reservationId: this.reservationId,
54+
guestId: this.guestId,
55+
});
56+
57+
$.export("$summary", `Successfully deleted guest with ID ${this.guestId}`);
58+
return response;
59+
},
60+
};
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import bookingExperts from "../../booking_experts.app.mjs";
2+
3+
export default {
4+
key: "booking_experts-get-booking",
5+
name: "Get Booking",
6+
description: "Returns a booking. [See the documentation](https://developers.bookingexperts.com/reference/administration-bookings-show)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: false,
12+
},
13+
type: "action",
14+
props: {
15+
bookingExperts,
16+
administrationId: {
17+
propDefinition: [
18+
bookingExperts,
19+
"administrationId",
20+
],
21+
},
22+
bookingId: {
23+
propDefinition: [
24+
bookingExperts,
25+
"bookingId",
26+
({ administrationId }) => ({
27+
administrationId,
28+
}),
29+
],
30+
},
31+
},
32+
async run({ $ }) {
33+
const { data } = await this.bookingExperts.getBooking({
34+
$,
35+
administrationId: this.administrationId,
36+
bookingId: this.bookingId,
37+
});
38+
$.export("$summary", `Successfully retrieved booking with ID ${this.bookingId}`);
39+
return data;
40+
},
41+
};

components/booking_experts/actions/get-complex-prices/get-complex-prices.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "booking_experts-get-complex-prices",
55
name: "Get Complex Prices",
66
description: "Returns all complex prices of a master price list. [See the documentation](https://developers.bookingexperts.com/reference/administration-masterpricelist-complexprices-index)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import bookingExperts from "../../booking_experts.app.mjs";
2+
3+
export default {
4+
key: "booking_experts-list-availabilities",
5+
name: "List Availabilities",
6+
description: "List availabilities of a channel you have access to. [See the documentation](https://developers.bookingexperts.com/reference/availabilities-index)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: true,
12+
},
13+
type: "action",
14+
props: {
15+
bookingExperts,
16+
info: {
17+
type: "alert",
18+
alertType: "warning",
19+
content: "**You must have at least one channel created through the Booking Experts API.**",
20+
},
21+
},
22+
async run({ $ }) {
23+
const { data } = await this.bookingExperts.listAvailabilities({
24+
$,
25+
});
26+
$.export("$summary", `Found ${data.length} availabilities`);
27+
return data;
28+
},
29+
};

components/booking_experts/actions/list-bookings/list-bookings.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "booking_experts-list-bookings",
55
name: "List Bookings",
66
description: "Returns a list of bookings for an administration. [See the documentation](https://developers.bookingexperts.com/reference/administration-bookings-index)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,
@@ -29,10 +29,10 @@ export default {
2929
],
3030
description: "Filter by owner",
3131
},
32-
channelId: {
32+
administrationChannelId: {
3333
propDefinition: [
3434
bookingExperts,
35-
"channelId",
35+
"administrationChannelId",
3636
(c) => ({
3737
administrationId: c.administrationId,
3838
}),
@@ -69,7 +69,7 @@ export default {
6969
administrationId: this.administrationId,
7070
params: {
7171
"filter[owner]": this.ownerId,
72-
"filter[channel]": this.channelId,
72+
"filter[channel]": this.listAdministrationChannels,
7373
"filter[reservations]": this.reservationId,
7474
"filter[created_at]": this.createdAt,
7575
"filter[updated_at]": this.updatedAt,

components/booking_experts/actions/list-inventory-objects/list-inventory-objects.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "booking_experts-list-inventory-objects",
55
name: "List Inventory Objects",
66
description: "Returns inventory objects of the administration. [See the documentation](https://developers.bookingexperts.com/reference/administration-inventoryobjects-index)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,
@@ -46,6 +46,7 @@ export default {
4646
},
4747
async run({ $ }) {
4848
const { data } = await this.bookingExperts.listInventoryObjects({
49+
$,
4950
administrationId: this.administrationId,
5051
params: {
5152
"filter[name]": this.name,
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import { ConfigurationError } from "@pipedream/platform";
2+
import bookingExperts from "../../booking_experts.app.mjs";
3+
4+
export default {
5+
key: "booking_experts-list-rentabletype-availabilities",
6+
name: "List RentableType Availabilities",
7+
description: "List availabilities of a RentableType you have access to. [See the documentation](https://developers.bookingexperts.com/reference/channel-rentabletype-availabilities-index)",
8+
version: "0.0.1",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
type: "action",
15+
props: {
16+
bookingExperts,
17+
info: {
18+
type: "alert",
19+
alertType: "warning",
20+
content: "**The API will only list channels created through the Booking Experts API.**",
21+
},
22+
channelId: {
23+
propDefinition: [
24+
bookingExperts,
25+
"channelId",
26+
],
27+
optional: false,
28+
},
29+
rentableTypeId: {
30+
propDefinition: [
31+
bookingExperts,
32+
"rentableTypeId",
33+
({ channelId }) => ({
34+
channelId,
35+
}),
36+
],
37+
},
38+
startDate: {
39+
type: "string",
40+
label: "Start Date",
41+
description: "The start date of the availability. Yields availability for the given date range. Format: `YYYY-MM-DD`",
42+
optional: true,
43+
},
44+
endDate: {
45+
type: "string",
46+
label: "End Date",
47+
description: "The end date of the availability. Will be capped to 2 years in the future. Max LOS is capped to 30. Format: `YYYY-MM-DD`",
48+
optional: true,
49+
},
50+
},
51+
async run({ $ }) {
52+
if ((!this.startDate && this.endDate) || (this.startDate && !this.endDate)) {
53+
throw new ConfigurationError("You should provide both the start and end date parameters.");
54+
}
55+
const { data } = await this.bookingExperts.listRentableTypeAvailabilities({
56+
$,
57+
channelId: this.channelId,
58+
rentableTypeId: this.rentableTypeId,
59+
params: {
60+
...(this.startDate && this.endDate
61+
&& {
62+
"date_range": `${this.startDate}..${this.endDate}`,
63+
}),
64+
},
65+
});
66+
$.export("$summary", `Found ${data.length} rentable type availabilities`);
67+
return data;
68+
},
69+
};

components/booking_experts/actions/search-contacts/search-contacts.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import bookingExperts from "../../booking_experts.app.mjs";
21
import { ConfigurationError } from "@pipedream/platform";
2+
import bookingExperts from "../../booking_experts.app.mjs";
33

44
export default {
55
key: "booking_experts-search-contacts",
66
name: "Search Contacts",
77
description: "Search for contacts by email or phone. [See the documentation](https://developers.bookingexperts.com/reference/contact-search-first)",
8-
version: "0.0.2",
8+
version: "0.0.3",
99
annotations: {
1010
destructiveHint: false,
1111
openWorldHint: true,
@@ -34,6 +34,7 @@ export default {
3434

3535
try {
3636
const { data } = await this.bookingExperts.searchContacts({
37+
$,
3738
params: {
3839
email: this.email,
3940
phone: this.phone,

0 commit comments

Comments
 (0)