| 1 |
<?php |
| 2 |
|
| 3 |
defined('ABSPATH') || exit; |
| 4 |
|
| 5 |
/** |
| 6 |
* @var FluentBooking\Framework\Http\Router $router |
| 7 |
*/ |
| 8 |
|
| 9 |
$router->prefix('calendars')->withPolicy('CalendarPolicy')->group(function ($router) { |
| 10 |
|
| 11 |
$router->get('/', 'CalendarController@getAllCalendars')->meta('calendar_type', 'booking'); |
| 12 |
|
| 13 |
$router->post('/', 'CalendarController@createCalendar'); |
| 14 |
$router->post('check-slug', 'CalendarController@checkSlug'); |
| 15 |
|
| 16 |
$router->get('/{id}', 'CalendarController@getCalendar')->int('id'); |
| 17 |
$router->post('/{id}', 'CalendarController@updateCalendar')->int('id'); |
| 18 |
$router->delete('/{id}', 'CalendarController@deleteCalendar')->int('id'); |
| 19 |
|
| 20 |
$router->post('/{id}/events', 'CalendarController@createCalendarEvent')->int('id'); |
| 21 |
$router->get('/{id}/event-schema', 'CalendarController@getEventSchema')->int('id'); |
| 22 |
|
| 23 |
// Landing Page API |
| 24 |
$router->get('/{id}/sharing-settings', 'CalendarController@getSharingSettings')->int('id'); |
| 25 |
$router->post('/{id}/sharing-settings', 'CalendarController@saveSharingSettings')->int('id'); |
| 26 |
|
| 27 |
$router->post('/{id}/event-order', 'CalendarController@saveCalendarEventOrder')->int('id'); |
| 28 |
|
| 29 |
$router->post('/{id}/clone-event/{event_id}', 'CalendarController@cloneCalendarEvent')->int('id')->int('event_id'); |
| 30 |
|
| 31 |
$router->get('/{id}/events/{event_id}', 'CalendarController@getEvent')->int('id')->int('event_id'); |
| 32 |
$router->put('/{id}/events/{event_id}', 'CalendarController@patchCalendarEvent')->int('id')->int('event_id'); |
| 33 |
$router->delete('/{id}/events/{event_id}', 'CalendarController@deleteCalendarEvent')->int('id')->int('event_id'); |
| 34 |
|
| 35 |
$router->get('/{id}/events/{event_id}/availability', 'CalendarController@getAvailabilitySettings')->int('id')->int('event_id'); |
| 36 |
$router->post('/{id}/events/{event_id}/details', 'CalendarController@updateEventDetails')->int('id')->int('event_id'); |
| 37 |
$router->post('/{id}/events/{event_id}/availability', 'CalendarController@updateEventAvailability')->int('id')->int('event_id'); |
| 38 |
$router->post('/{id}/events/{event_id}/limits', 'CalendarController@updateEventLimits')->int('id')->int('event_id'); |
| 39 |
|
| 40 |
$router->get('/{id}/events/{event_id}/email-notifications', 'CalendarController@getEventEmailNotifications')->int('id')->int('event_id'); |
| 41 |
$router->post('/{id}/events/{event_id}/email-notifications', 'CalendarController@saveEventEmailNotifications')->int('id')->int('event_id'); |
| 42 |
$router->post('/{id}/events/{event_id}/email-notifications/clone', 'CalendarController@cloneEventEmailNotification')->int('id')->int('event_id'); |
| 43 |
|
| 44 |
$router->get('/{id}/events/{event_id}/booking-fields', 'CalendarController@getEventBookingFields')->int('id')->int('event_id'); |
| 45 |
$router->post('/{id}/events/{event_id}/booking-fields', 'CalendarController@saveEventBookingFields')->int('id')->int('event_id'); |
| 46 |
|
| 47 |
if (!defined('FLUENT_BOOKING_PRO_DIR_FILE')) { |
| 48 |
// Pro registers this path (plus the POST) via PaymentMethodController; only own it standalone. |
| 49 |
$router->get('/{id}/events/{event_id}/payment-settings', 'CalendarController@getEventPaymentSettings')->int('id')->int('event_id'); |
| 50 |
} |
| 51 |
}); |
| 52 |
|
| 53 |
$router->prefix('admin')->withPolicy('AdminPolicy')->group(function ($router) { |
| 54 |
$router->get('remaining-hosts', 'AdminController@getRemainingHosts'); |
| 55 |
$router->get('other-hosts', 'AdminController@getOtherHosts'); |
| 56 |
$router->get('all-hosts', 'AdminController@getAllHosts'); |
| 57 |
}); |
| 58 |
|
| 59 |
$router->prefix('events')->withPolicy('CalendarEventPolicy')->group(function ($router) { |
| 60 |
$router->get('/{event_id}', 'EventController@getEvent')->int('event_id'); |
| 61 |
}); |
| 62 |
|
| 63 |
$router->prefix('bookings')->withPolicy('CalendarEventPolicy')->group(function ($router) { |
| 64 |
$router->get('/', 'BookingController@getBookings'); |
| 65 |
$router->get('event/{event_id}', 'BookingController@getEvent')->int('event_id'); |
| 66 |
$router->get('slots/{event_id}', 'BookingController@getSlots')->int('event_id'); |
| 67 |
$router->post('create/{event_id}', 'BookingController@createBooking')->int('event_id'); |
| 68 |
}); |
| 69 |
|
| 70 |
$router->prefix('schedules')->withPolicy('MeetingPolicy')->group(function ($router) { |
| 71 |
$router->get('/', 'SchedulesController@index'); // Need to check permission on the controller method |
| 72 |
$router->get('/export', 'SchedulesController@export'); |
| 73 |
$router->get('/crm-contact-prefill', 'SchedulesController@getCrmContactPrefill'); |
| 74 |
$router->get('/crm-contact-search', 'SchedulesController@searchCrmContacts'); |
| 75 |
$router->get('/{id}', 'SchedulesController@getBooking')->int('id'); |
| 76 |
$router->delete('/{id}', 'SchedulesController@deleteBooking')->int('id'); |
| 77 |
$router->put('/{id}', 'SchedulesController@patchBooking')->int('id'); |
| 78 |
$router->get('/{id}/activities', 'SchedulesController@getBookingActivities')->int('id'); |
| 79 |
$router->get('/{id}/meta-info', 'SchedulesController@getBookingMetaInfo')->int('id'); |
| 80 |
$router->get('/{id}/crm-contact', 'SchedulesController@getCrmContact')->int('id'); |
| 81 |
$router->get('/{id}/crm-options', 'SchedulesController@getCrmOptions')->int('id'); |
| 82 |
$router->post('/{id}/crm-contact/tags', 'SchedulesController@updateCrmTags')->int('id'); |
| 83 |
$router->post('/{id}/crm-contact/lists', 'SchedulesController@updateCrmLists')->int('id'); |
| 84 |
$router->post('/{id}/send-confirmation-email', 'SchedulesController@sendConfirmationEmail')->int('id'); |
| 85 |
|
| 86 |
$router->get('/group-bookings/{group_id}/attendees', 'SchedulesController@getGroupAttendees')->int('group_id'); |
| 87 |
}); |
| 88 |
|
| 89 |
$router->prefix('integrations')->withPolicy('SettingsPolicy')->group(function ($router) { |
| 90 |
$router->get('/', 'IntegrationController@index'); |
| 91 |
$router->post('/', 'IntegrationController@update'); |
| 92 |
}); |
| 93 |
|
| 94 |
$router->prefix('settings')->withPolicy('SettingsPolicy')->group(function ($router) { |
| 95 |
$router->get('/general', 'SettingsController@getGeneralSettings'); |
| 96 |
$router->post('/general', 'SettingsController@updateGeneralSettings'); |
| 97 |
$router->post('/payment', 'SettingsController@updatePaymentSettings'); |
| 98 |
$router->post('/theme', 'SettingsController@updateThemeSettings'); |
| 99 |
$router->get('/menu', 'SettingsController@getSettingsMenu'); |
| 100 |
$router->get('/global-modules', 'SettingsController@getGlobalModules'); |
| 101 |
$router->post('/global-modules', 'SettingsController@updateGlobalModules'); |
| 102 |
$router->get('/pages', 'SettingsController@getPages'); |
| 103 |
$router->post('/addons-settings', 'SettingsController@saveAddonsSettings'); |
| 104 |
$router->post('/install-plugin', 'SettingsController@installPlugin'); |
| 105 |
|
| 106 |
// MCP server settings — see docs/mcp-server-spec.md. |
| 107 |
$router->get('/mcp', 'McpController@getSettings'); |
| 108 |
$router->post('/mcp', 'McpController@updateSettings'); |
| 109 |
$router->post('/mcp/install-adapter', 'McpController@installAdapter'); |
| 110 |
}); |
| 111 |
|
| 112 |
$router->prefix('availability')->withPolicy('AvailabilityPolicy')->group(function ($router) { |
| 113 |
$router->get('/', 'AvailabilityController@index'); |
| 114 |
$router->post('/', 'AvailabilityController@createSchedule'); |
| 115 |
|
| 116 |
$router->get('/{schedule_id}', 'AvailabilityController@getSchedule')->int('schedule_id'); |
| 117 |
$router->get('/{schedule_id}/usages', 'AvailabilityController@getAvailabilityUsages')->int('schedule_id'); |
| 118 |
$router->post('/{schedule_id}', 'AvailabilityController@updateSchedule')->int('schedule_id'); |
| 119 |
$router->post('/{schedule_id}/update-title', 'AvailabilityController@updateScheduleTitle')->int('schedule_id'); |
| 120 |
$router->post('/{schedule_id}/update-status', 'AvailabilityController@updateDefaultStatus')->int('schedule_id'); |
| 121 |
$router->post('/{schedule_id}/clone', 'AvailabilityController@cloneSchedule')->int('schedule_id'); |
| 122 |
$router->delete('/{schedule_id}', 'AvailabilityController@deleteSchedule')->int('schedule_id'); |
| 123 |
|
| 124 |
}); |
| 125 |
|
| 126 |
$router->prefix('reports')->withPolicy('UserPolicy')->group(function ($router) { |
| 127 |
$router->get('/', 'ReportController@getReports'); |
| 128 |
$router->get('/graph-reports', 'ReportController@getGraphReports'); |
| 129 |
$router->get('/activities', 'ReportController@getActivities'); |
| 130 |
}); |
| 131 |
|
| 132 |
$router->prefix('calendars')->withPolicy('CalendarPolicy')->group(function ($router) { |
| 133 |
$router->prefix('{id}/events/{event_id}/integrations')->group(function ($router) { |
| 134 |
$router->get('/', 'CalendarIntegrationController@index')->int('id')->int('event_id'); |
| 135 |
$router->post('/clone', 'CalendarIntegrationController@cloneIntegrations')->int('id')->int('event_id'); |
| 136 |
|
| 137 |
$router->prefix('{integration_id}')->group(function ($router) { |
| 138 |
$router->get('/', 'CalendarIntegrationController@find')->int('id')->int('event_id')->int('integration_id'); |
| 139 |
$router->post('/', 'CalendarIntegrationController@update')->int('id')->int('event_id')->int('integration_id'); |
| 140 |
$router->delete('/', 'CalendarIntegrationController@delete')->int('id')->int('event_id')->int('integration_id'); |
| 141 |
$router->get('/merge-fields', 'CalendarIntegrationController@integrationListComponent')->int('id')->int('event_id')->int('integration_id'); |
| 142 |
$router->get('/config-field-options', 'CalendarIntegrationController@getConfigFieldOptions')->int('id')->int('event_id')->int('integration_id'); |
| 143 |
$router->post('/crm-taxonomy', 'CalendarIntegrationController@createCrmTaxonomy')->int('id')->int('event_id')->int('integration_id'); |
| 144 |
}); |
| 145 |
}); |
| 146 |
}); |
| 147 |
|