-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Enhance booking_experts component with new actions and properties #19060
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
69c2520
5a4a1ce
83d39da
de345a2
07a2ae2
75f1499
a837505
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import bookingExperts from "../../booking_experts.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "booking_experts-delete-guest", | ||
| name: "Delete Guest", | ||
| description: "Delete a guest for a reservation. [See the documentation](https://developers.bookingexperts.com/reference/administration-reservation-guests-delete)", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| destructiveHint: true, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| bookingExperts, | ||
| administrationId: { | ||
| propDefinition: [ | ||
| bookingExperts, | ||
| "administrationId", | ||
| ], | ||
| }, | ||
| reservationId: { | ||
| propDefinition: [ | ||
| bookingExperts, | ||
| "reservationId", | ||
| ({ administrationId }) => ({ | ||
| administrationId, | ||
| }), | ||
| ], | ||
| }, | ||
| info: { | ||
|
Check warning on line 31 in components/booking_experts/actions/delete-guest/delete-guest.mjs
|
||
| type: "alert", | ||
| alertType: "warning", | ||
| content: "**The API will only list guests created through the Booking Experts API.**", | ||
| }, | ||
| guestId: { | ||
| propDefinition: [ | ||
| bookingExperts, | ||
| "guestId", | ||
| ({ | ||
| administrationId, reservationId, | ||
| }) => ({ | ||
| administrationId, | ||
| reservationId, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.bookingExperts.deleteGuest({ | ||
| administrationId: this.administrationId, | ||
| reservationId: this.reservationId, | ||
| guestId: this.guestId, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully deleted guest with ID ${this.guestId}`); | ||
| return response; | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import bookingExperts from "../../booking_experts.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "booking_experts-get-booking", | ||
| name: "Get Booking", | ||
| description: "Returns a booking. [See the documentation](https://developers.bookingexperts.com/reference/administration-bookings-show)", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| bookingExperts, | ||
| administrationId: { | ||
| propDefinition: [ | ||
| bookingExperts, | ||
| "administrationId", | ||
| ], | ||
| }, | ||
| bookingId: { | ||
| propDefinition: [ | ||
| bookingExperts, | ||
| "bookingId", | ||
| ({ administrationId }) => ({ | ||
| administrationId, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { data } = await this.bookingExperts.getBooking({ | ||
| $, | ||
| administrationId: this.administrationId, | ||
| bookingId: this.bookingId, | ||
| }); | ||
| $.export("$summary", `Successfully retrieved booking with ID ${this.bookingId}`); | ||
| return data; | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import bookingExperts from "../../booking_experts.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "booking_experts-list-availabilities", | ||
| name: "List Availabilities", | ||
| description: "List availabilities of a channel you have access to. [See the documentation](https://developers.bookingexperts.com/reference/availabilities-index)", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| type: "action", | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| props: { | ||
| bookingExperts, | ||
| info: { | ||
|
Check warning on line 16 in components/booking_experts/actions/list-availabilities/list-availabilities.mjs
|
||
| type: "alert", | ||
| alertType: "warning", | ||
| content: "**You must have at least one channel created through the Booking Experts API.**", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { data } = await this.bookingExperts.listAvailabilities({ | ||
| $, | ||
| }); | ||
| $.export("$summary", `Found ${data.length} availabilities`); | ||
| return data; | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
| import bookingExperts from "../../booking_experts.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "booking_experts-list-rentabletype-availabilities", | ||
| name: "List RentableType Availabilities", | ||
| description: "List availabilities of a RentableType you have access to. [See the documentation](https://developers.bookingexperts.com/reference/channel-rentabletype-availabilities-index)", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: true, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| bookingExperts, | ||
| info: { | ||
|
Check warning on line 17 in components/booking_experts/actions/list-rentabletype-availabilities/list-rentabletype-availabilities.mjs
|
||
| type: "alert", | ||
| alertType: "warning", | ||
| content: "**The API will only list channels created through the Booking Experts API.**", | ||
| }, | ||
| channelId: { | ||
| propDefinition: [ | ||
| bookingExperts, | ||
| "channelId", | ||
| ], | ||
| optional: false, | ||
| }, | ||
| rentableTypeId: { | ||
| propDefinition: [ | ||
| bookingExperts, | ||
| "rentableTypeId", | ||
| ({ channelId }) => ({ | ||
| channelId, | ||
| }), | ||
| ], | ||
| }, | ||
| startDate: { | ||
| type: "string", | ||
| label: "Start Date", | ||
| description: "The start date of the availability. Yields availability for the given date range. Format: `YYYY-MM-DD`", | ||
| optional: true, | ||
| }, | ||
| endDate: { | ||
| type: "string", | ||
| label: "End Date", | ||
| 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`", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| if ((!this.startDate && this.endDate) || (this.startDate && !this.endDate)) { | ||
| throw new ConfigurationError("You should provide both the start and end date parameters."); | ||
| } | ||
| const { data } = await this.bookingExperts.listRentableTypeAvailabilities({ | ||
| $, | ||
| channelId: this.channelId, | ||
| rentableTypeId: this.rentableTypeId, | ||
| params: { | ||
| ...(this.startDate && this.endDate | ||
| && { | ||
| "date_range": `${this.startDate}..${this.endDate}`, | ||
| }), | ||
| }, | ||
| }); | ||
| $.export("$summary", `Found ${data.length} rentable type availabilities`); | ||
| return data; | ||
| }, | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.