Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import bookingExperts from "../../booking_experts.app.mjs";

export default {
name: "Get Reservation",
description: "Fetches a reservation by ID from Booking Experts. [See the documentation](https://developers.bookingexperts.com/reference/reservations-show)",
key: "booking_experts-get-reservation",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
props: {
bookingExperts,
reservationId: {
propDefinition: [
bookingExperts,
"reservationId",
],
},
},
async run({ $ }) {
const response = await this.bookingExperts.getReservation({
$,
reservationId: this.reservationId,
});
$.export("$summary", `Successfully retrieved reservation with ID ${this.reservationId}`);
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 {
name: "List Reservations",
description: "Lists all reservations for the current organization from Booking Experts. [See the documentation](https://developers.bookingexperts.com/reference/reservations-index)",
key: "booking_experts-list-reservations",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
props: {
bookingExperts,
page: {
type: "integer",
label: "Page Number",
description: "Page number for paginating reservations",
optional: true,
default: 1,
},
perPage: {
propDefinition: [
bookingExperts,
"perPage",
],
},
},
async run({ $ }) {
const response = await this.bookingExperts.listReservations({
$,
params: {
"page[number]": this.page,
"page[size]": this.perPage,
},
});
$.export("$summary", `Found ${response.data.length} reservations`);
return response;
},
};
33 changes: 26 additions & 7 deletions components/booking_experts/booking_experts.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,17 @@ export default {
async options({
page, administrationId,
}) {
const { data } = await this.listReservations({
administrationId,
params: {
"page[number]": page + 1,
},
});
const params = {
"page[number]": page + 1,
};
const { data } = administrationId
? await this.listReservationsInAdministration({
administrationId,
params,
})
: await this.listReservations({
params,
});
return data?.map(({
id, attributes,
}) => ({
Expand Down Expand Up @@ -276,6 +281,14 @@ export default {
...opts,
});
},
getReservation({
reservationId, ...opts
}) {
return this._makeRequest({
path: `/reservations/${reservationId}`,
...opts,
});
},
listAdministrations(opts = {}) {
return this._makeRequest({
path: "/administrations",
Expand Down Expand Up @@ -350,7 +363,13 @@ export default {
...opts,
});
},
listReservations({
listReservations(opts = {}) {
return this._makeRequest({
path: "/reservations",
...opts,
});
},
listReservationsInAdministration({
administrationId, ...opts
}) {
return this._makeRequest({
Expand Down
2 changes: 1 addition & 1 deletion components/booking_experts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/booking_experts",
"version": "0.2.0",
"version": "0.3.0",
"description": "Pipedream Booking Experts Components",
"main": "booking_experts.app.mjs",
"keywords": [
Expand Down
Loading