Skip to content

Commit 420c33b

Browse files
committed
new components
1 parent 8a4945f commit 420c33b

File tree

8 files changed

+522
-21
lines changed

8 files changed

+522
-21
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import bookingExperts from "../../booking_experts.app.mjs";
2+
3+
export default {
4+
key: "booking_experts-add-guest-to-reservation",
5+
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.1",
8+
type: "action",
9+
props: {
10+
bookingExperts,
11+
administrationId: {
12+
propDefinition: [
13+
bookingExperts,
14+
"administrationId",
15+
],
16+
},
17+
reservationId: {
18+
propDefinition: [
19+
bookingExperts,
20+
"reservationId",
21+
(c) => ({
22+
administrationId: c.administrationId,
23+
}),
24+
],
25+
},
26+
firstName: {
27+
type: "string",
28+
label: "First Name",
29+
description: "The first name of the guest",
30+
},
31+
lastName: {
32+
type: "string",
33+
label: "Last Name",
34+
description: "The last name of the guest",
35+
},
36+
email: {
37+
type: "string",
38+
label: "Email",
39+
description: "The email of the guest",
40+
optional: true,
41+
},
42+
phone: {
43+
type: "string",
44+
label: "Phone",
45+
description: "The phone number of the guest",
46+
optional: true,
47+
},
48+
address: {
49+
type: "string",
50+
label: "Address",
51+
description: "The street address of the guest",
52+
optional: true,
53+
},
54+
city: {
55+
type: "string",
56+
label: "City",
57+
description: "The city of the guest",
58+
optional: true,
59+
},
60+
postalCode: {
61+
type: "string",
62+
label: "Postal Code",
63+
description: "The postal code of the guest",
64+
optional: true,
65+
},
66+
countryCode: {
67+
type: "string",
68+
label: "Country Code",
69+
description: "The country code of the guest",
70+
optional: true,
71+
},
72+
},
73+
async run({ $ }) {
74+
const { data } = await this.bookingExperts.addGuestToReservation({
75+
administrationId: this.administrationId,
76+
reservationId: this.reservationId,
77+
data: {
78+
data: {
79+
type: "guest",
80+
attributes: {
81+
first_name: this.firstName,
82+
last_name: this.lastName,
83+
email: this.email,
84+
phone: this.phone,
85+
address: this.address,
86+
city: this.city,
87+
postal_code: this.postalCode,
88+
country_code: this.countryCode,
89+
},
90+
},
91+
},
92+
});
93+
$.export("$summary", "Guest added to reservation");
94+
return data;
95+
},
96+
};
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import bookingExperts from "../../booking_experts.app.mjs";
2+
3+
export default {
4+
key: "booking_experts-create-agenda-period",
5+
name: "Create Agenda Period",
6+
description: "Creates a new agenda period. [See the documentation](https://developers.bookingexperts.com/reference/administration-maintenance-agenda-periods-create)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
bookingExperts,
11+
administrationId: {
12+
propDefinition: [
13+
bookingExperts,
14+
"administrationId",
15+
],
16+
},
17+
type: {
18+
type: "string",
19+
label: "Type",
20+
description: "The type of agenda period to create",
21+
options: [
22+
"maintenance_agenda_periods",
23+
"external_blocked_agenda_periods",
24+
],
25+
},
26+
label: {
27+
type: "string",
28+
label: "Label",
29+
description: "The label of the agenda period",
30+
},
31+
startDate: {
32+
type: "string",
33+
label: "Start Date",
34+
description: "The start date of the agenda period. Example: `2025-08-28`",
35+
},
36+
endDate: {
37+
type: "string",
38+
label: "End Date",
39+
description: "The end date of the agenda period",
40+
},
41+
inventoryObjectId: {
42+
propDefinition: [
43+
bookingExperts,
44+
"inventoryObjectId",
45+
(c) => ({
46+
administrationId: c.administrationId,
47+
}),
48+
],
49+
},
50+
rentableId: {
51+
propDefinition: [
52+
bookingExperts,
53+
"rentableId",
54+
(c) => ({
55+
administrationId: c.administrationId,
56+
inventoryObjectId: c.inventoryObjectId,
57+
}),
58+
],
59+
},
60+
},
61+
async run({ $ }) {
62+
const { data } = await this.bookingExperts.createAgendaPeriod({
63+
$,
64+
administrationId: this.administrationId,
65+
type: this.type,
66+
data: {
67+
data: {
68+
type: "agenda_period",
69+
attributes: {
70+
label: this.label,
71+
start_date: this.startDate,
72+
end_date: this.endDate,
73+
},
74+
relationships: {
75+
inventory_object: this.inventoryObjectId
76+
? {
77+
data: {
78+
type: "inventory_object",
79+
id: this.inventoryObjectId,
80+
},
81+
}
82+
: undefined,
83+
rentable: {
84+
data: {
85+
type: "rentable",
86+
id: this.rentableId,
87+
},
88+
},
89+
},
90+
},
91+
},
92+
});
93+
$.export("$summary", "Agenda period created");
94+
return data;
95+
},
96+
};
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import bookingExperts from "../../booking_experts.app.mjs";
2+
3+
export default {
4+
key: "booking_experts-get-complex-prices",
5+
name: "Get Complex Prices",
6+
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.1",
8+
type: "action",
9+
props: {
10+
bookingExperts,
11+
administrationId: {
12+
propDefinition: [
13+
bookingExperts,
14+
"administrationId",
15+
],
16+
},
17+
masterPriceListId: {
18+
propDefinition: [
19+
bookingExperts,
20+
"masterPriceListId",
21+
(c) => ({
22+
administrationId: c.administrationId,
23+
}),
24+
],
25+
},
26+
page: {
27+
propDefinition: [
28+
bookingExperts,
29+
"page",
30+
],
31+
},
32+
perPage: {
33+
propDefinition: [
34+
bookingExperts,
35+
"perPage",
36+
],
37+
},
38+
},
39+
async run({ $ }) {
40+
const { data } = await this.bookingExperts.getComplexPrices({
41+
$,
42+
administrationId: this.administrationId,
43+
masterPriceListId: this.masterPriceListId,
44+
params: {
45+
"page[number]": this.page,
46+
"page[size]": this.perPage,
47+
},
48+
});
49+
$.export("$summary", `Found ${data.length} complex prices`);
50+
return data;
51+
},
52+
};

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

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,31 +43,19 @@ export default {
4343
}),
4444
],
4545
description: "Filter by reservation",
46-
},
47-
createdAt: {
48-
type: "string",
49-
label: "Created At",
50-
description: "Filter by created at date. Example: `2025-08-28`",
51-
optional: true,
52-
},
53-
updatedAt: {
54-
type: "string",
55-
label: "Updated At",
56-
description: "Filter by updated at date. Example: `2025-08-28`",
5746
optional: true,
5847
},
5948
page: {
60-
type: "integer",
61-
label: "Page",
62-
description: "Page number",
63-
optional: true,
49+
propDefinition: [
50+
bookingExperts,
51+
"page",
52+
],
6453
},
6554
perPage: {
66-
type: "integer",
67-
label: "Per Page",
68-
description: "Number of items per page",
69-
max: 100,
70-
optional: true,
55+
propDefinition: [
56+
bookingExperts,
57+
"perPage",
58+
],
7159
},
7260
},
7361
async run({ $ }) {
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import bookingExperts from "../../booking_experts.app.mjs";
2+
3+
export default {
4+
key: "booking_experts-list-inventory-objects",
5+
name: "List Inventory Objects",
6+
description: "Returns inventory objects of the administration. [See the documentation](https://developers.bookingexperts.com/reference/administration-inventoryobjects-index)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
bookingExperts,
11+
administrationId: {
12+
propDefinition: [
13+
bookingExperts,
14+
"administrationId",
15+
],
16+
},
17+
name: {
18+
type: "string",
19+
label: "Name",
20+
description: "Filter by name",
21+
optional: true,
22+
},
23+
labels: {
24+
type: "string[]",
25+
label: "Labels",
26+
description: "Filter by labels",
27+
optional: true,
28+
},
29+
page: {
30+
propDefinition: [
31+
bookingExperts,
32+
"page",
33+
],
34+
},
35+
perPage: {
36+
propDefinition: [
37+
bookingExperts,
38+
"perPage",
39+
],
40+
},
41+
},
42+
async run({ $ }) {
43+
const { data } = await this.bookingExperts.listInventoryObjects({
44+
administrationId: this.administrationId,
45+
params: {
46+
"filter[name]": this.name,
47+
"filter[labels]": this.labels
48+
? this.labels.join(",")
49+
: undefined,
50+
"page[number]": this.page,
51+
"page[size]": this.perPage,
52+
},
53+
});
54+
$.export("$summary", `Found ${data.length} inventory objects`);
55+
return data;
56+
},
57+
};

0 commit comments

Comments
 (0)