137 err_msg: str =
"PathManager could not be found"
138 self.
disp.log_critical(err_msg)
139 raise RuntimeError(err_msg)
144 f
"{self.v1_str}/register", self.
user.post_register, [
"POST"],
145 decorators=[decorators.public_endpoint(), decorators.user_endpoint]
149 f
"{self.v1_str}/login", self.
user.post_login, [
"POST"],
150 decorators=[decorators.public_endpoint(), decorators.user_endpoint]
154 f
"{self.v1_str}/logout", self.
user.post_logout, [
"POST"],
155 decorators=[decorators.auth_endpoint(), decorators.user_endpoint]
160 f
"{self.v1_str}/send_email_verification", self.
user.post_send_email_verification,
161 [
"POST"], decorators=[decorators.auth_endpoint(), decorators.user_endpoint]
166 f
"{self.v1_str}/reset_password", self.
user.put_reset_password,
167 [
"PUT"], decorators=[decorators.public_endpoint(), decorators.user_endpoint]
172 f
"{self.v1_str}/user", self.
user.put_user, [
"PUT"],
173 decorators=[decorators.auth_endpoint(), decorators.user_endpoint]
176 f
"{self.v1_str}/user", self.
user.patch_user, [
"PATCH"],
177 decorators=[decorators.auth_endpoint(), decorators.user_endpoint]
182 f
"{self.v1_str}/user", self.
user.get_user, [
"GET"],
183 decorators=[decorators.auth_endpoint(), decorators.user_endpoint]
186 f
"{self.v1_str}/user_id", self.
user.get_user_id, [
"GET"],
187 decorators=[decorators.auth_endpoint(), decorators.user_endpoint]
192 f
"{self.v1_str}/user", self.
user.delete_user, [
"DELETE"],
193 decorators=[decorators.admin_endpoint(), decorators.user_endpoint]
198 f
"{self.v1_str}/feeder", self.
cat_endpoints.put_register_feeder,
"PUT",
200 decorators.auth_endpoint(),
201 decorators.cat_endpoint,
202 decorators.json_body(
203 "Register a new cat feeder with location and details",
207 "city_locality":
"Paris",
209 "mac":
"AA:BB:CC:DD:EE:FF",
216 f
"{self.v1_str}/feeder", self.
cat_endpoints.patch_feeder,
"PATCH",
218 decorators.auth_endpoint(),
219 decorators.cat_endpoint,
220 decorators.json_body(
221 "Update feeder details - provide id or mac, and fields to update",
223 "mac":
"AA:BB:CC:DD:EE:FF",
224 "name":
"Updated Feeder Name",
232 f
"{self.v1_str}/feeder", self.
cat_endpoints.get_feeder,
"GET",
234 decorators.auth_endpoint(),
235 decorators.cat_endpoint,
236 decorators.json_body(
237 "Get feeder status by mac, name, or id",
238 example={
"mac":
"AA:BB:CC:DD:EE:FF"}
243 f
"{self.v1_str}/feeder/status", self.
cat_endpoints.get_feeder_status,
"GET",
245 decorators.auth_endpoint(),
246 decorators.cat_endpoint,
247 decorators.json_body(
248 "Get feeder status by mac, name, or id",
249 example={
"mac":
"AA:BB:CC:DD:EE:FF"}
254 f
"{self.v1_str}/feeder", self.
cat_endpoints.delete_feeder,
"DELETE",
256 decorators.auth_endpoint(),
257 decorators.cat_endpoint,
258 decorators.json_body(
259 "Remove a feeder based on it's mac or id",
260 example={
"mac":
"AA:BB:CC:DD:EE:FF"}
265 f
"{self.v1_str}/feeders", self.
cat_endpoints.get_feeders,
"GET",
267 decorators.auth_endpoint(),
268 decorators.cat_endpoint,
269 decorators.set_operation_id(
"get_feeders"),
270 decorators.set_summary(
"Get all feeders"),
271 decorators.set_description(
272 "Retrieve a list of all feeders registered by the authenticated user")
276 f
"{self.v1_str}/feeder/fed", self.
cat_endpoints.get_distribute_food,
"GET",
278 decorators.auth_endpoint(),
279 decorators.cat_endpoint,
280 decorators.json_body(
281 "Get food distribution status",
282 example={
"beacon_mac":
"AA:BB:CC:DD:EE:FF"}
287 f
"{self.v1_str}/feeder/fed", self.
cat_endpoints.post_distribute_food,
"POST",
289 decorators.auth_endpoint(),
290 decorators.cat_endpoint,
291 decorators.json_body(
292 "Distribute food to feeder",
294 "beacon_mac":
"AA:BB:CC:DD:EE:FF",
295 "feeder_mac":
"11:22:33:44:55:66",
302 f
"{self.v1_str}/feeder/ip", self.
cat_endpoints.put_feeder_ip,
"PUT",
304 decorators.public_endpoint(),
305 decorators.cat_endpoint,
306 decorators.json_body(
307 "Feeder IP update - called by feeder itself after reboot",
309 "mac":
"AA:BB:CC:DD:EE:FF",
310 "ip":
"192.168.1.100"
313 decorators.set_operation_id(
"update_feeder_ip_address"),
314 decorators.set_summary(
"Update feeder IP address"),
315 decorators.set_description(
316 "Allows feeder to update its IP address after reboot")
321 f
"{self.v1_str}/feeder/beacon", self.
cat_endpoints.put_register_beacon,
"PUT",
323 decorators.auth_endpoint(),
324 decorators.cat_endpoint,
325 decorators.json_body(
326 "Register a new beacon for a feeder",
328 "mac":
"AA:BB:CC:DD:EE:FF",
335 f
"{self.v1_str}/feeder/beacon/status", self.
cat_endpoints.get_beacon_status,
"GET",
337 decorators.auth_endpoint(),
338 decorators.cat_endpoint,
339 decorators.json_body(
340 "Get beacon status by mac, name, or id",
341 example={
"mac":
"AA:BB:CC:DD:EE:FF"}
346 f
"{self.v1_str}/feeder/beacon", self.
cat_endpoints.patch_beacon,
"PATCH",
348 decorators.auth_endpoint(),
349 decorators.cat_endpoint,
350 decorators.json_body(
351 "Update beacon details - provide id or name, and fields to update",
354 "name":
"Updated Beacon"
360 f
"{self.v1_str}/feeder/beacon", self.
cat_endpoints.delete_beacon,
"DELETE",
362 decorators.auth_endpoint(),
363 decorators.cat_endpoint,
364 decorators.json_body(
365 "Remove a beacon based on it's id",
371 f
"{self.v1_str}/beacons", self.
cat_endpoints.get_beacons,
"GET",
373 decorators.auth_endpoint(),
374 decorators.cat_endpoint,
375 decorators.set_operation_id(
"get_beacons"),
376 decorators.set_summary(
"Get all beacons"),
377 decorators.set_description(
378 "Retrieve a list of all beacons registered by the authenticated user")
383 f
"{self.v1_str}/feeder/beacon/locations", self.
cat_endpoints.get_beacon_locations,
"GET",
385 decorators.auth_endpoint(),
386 decorators.cat_endpoint,
387 decorators.json_body(
388 "Get beacon location history",
389 example={
"mac":
"AA:BB:CC:DD:EE:FF"}
394 f
"{self.v1_str}/feeder/beacon/location", self.
cat_endpoints.post_beacon_location,
"POST",
396 decorators.auth_endpoint(),
397 decorators.cat_endpoint,
398 decorators.json_body(
399 "Post new beacon location",
401 "beacon_mac":
"AA:BB:CC:DD:EE:FF",
402 "feeder_mac":
"11:22:33:44:55:66"
408 f
"{self.v1_str}/feeder/visits", self.
cat_endpoints.get_feeder_visits,
"GET",
410 decorators.auth_endpoint(),
411 decorators.cat_endpoint,
412 decorators.json_body(
413 "Get feeder visit history",
414 example={
"mac":
"AA:BB:CC:DD:EE:FF"}
419 f
"{self.v1_str}/feeder/visit", self.
cat_endpoints.post_feeder_visit,
"POST",
421 decorators.auth_endpoint(),
422 decorators.cat_endpoint,
423 decorators.json_body(
424 "Record a feeder visit by a pet",
426 "feeder_mac":
"11:22:33:44:55:66",
427 "beacon_mac":
"AA:BB:CC:DD:EE:FF"
435 f
"{self.v1_str}/pet", self.
cat_endpoints.put_register_pet,
"PUT",
437 decorators.auth_endpoint(),
438 decorators.cat_endpoint,
439 decorators.json_body(
440 "Pet registration data with beacon_mac and name",
442 "beacon_mac":
"AA:BB:CC:DD:EE:FF",
445 "time_reset_hours": 24
448 decorators.requires_bearer_auth()
454 decorators.auth_endpoint(),
455 decorators.cat_endpoint,
456 decorators.json_body(
457 "Pet update data with id and fields to update",
460 "name":
"Whiskers Updated",
464 decorators.requires_bearer_auth()
470 decorators.auth_endpoint(),
471 decorators.cat_endpoint,
472 decorators.json_body(
473 "JSON body with pet ID to retrieve",
476 decorators.requires_bearer_auth()
480 f
"{self.v1_str}/pet", self.
cat_endpoints.delete_pet,
"DELETE",
482 decorators.auth_endpoint(),
483 decorators.cat_endpoint,
484 decorators.json_body(
485 "JSON body with pet ID to delete",
488 decorators.requires_bearer_auth()
494 decorators.auth_endpoint(),
495 decorators.cat_endpoint,
496 decorators.set_operation_id(
"get_pets"),
497 decorators.set_summary(
"Get all pets"),
498 decorators.set_description(
499 "Retrieve a list of all pets registered by the authenticated user")
508 "", self.
bonus.root_beacon_get,
"GET",
509 decorators=[decorators.public_endpoint(),
510 decorators.system_endpoint]
513 "", self.
bonus.root_beacon_post,
"POST",
514 decorators=[decorators.public_endpoint(),
515 decorators.system_endpoint]
518 "", self.
bonus.root_beacon_put,
"PUT",
519 decorators=[decorators.public_endpoint(),
520 decorators.system_endpoint]
523 "", self.
bonus.root_beacon_patch,
"PATCH",
524 decorators=[decorators.public_endpoint(),
525 decorators.system_endpoint]
528 "", self.
bonus.root_beacon_delete,
"DELETE",
529 decorators=[decorators.public_endpoint(),
530 decorators.system_endpoint]
533 "", self.
bonus.root_beacon_head,
"HEAD",
534 decorators=[decorators.public_endpoint(),
535 decorators.system_endpoint]
538 "", self.
bonus.root_beacon_options,
"OPTIONS",
539 decorators=[decorators.public_endpoint(),
540 decorators.system_endpoint]
545 "/", self.
bonus.home_beacon_get,
"GET",
546 decorators=[decorators.public_endpoint(),
547 decorators.system_endpoint]
550 "/", self.
bonus.home_beacon_post,
"POST",
551 decorators=[decorators.public_endpoint(),
552 decorators.system_endpoint]
555 "/", self.
bonus.home_beacon_put,
"PUT",
556 decorators=[decorators.public_endpoint(),
557 decorators.system_endpoint]
560 "/", self.
bonus.home_beacon_patch,
"PATCH",
561 decorators=[decorators.public_endpoint(),
562 decorators.system_endpoint]
565 "/", self.
bonus.home_beacon_delete,
"DELETE",
566 decorators=[decorators.public_endpoint(),
567 decorators.system_endpoint]
570 "/", self.
bonus.home_beacon_head,
"HEAD",
571 decorators=[decorators.public_endpoint(),
572 decorators.system_endpoint]
575 "/", self.
bonus.home_beacon_options,
"OPTIONS",
576 decorators=[decorators.public_endpoint(),
577 decorators.system_endpoint]
582 f
"{self.v1_str}/", self.
bonus.api_v1_beacon_get,
"GET",
583 decorators=[decorators.public_endpoint(),
584 decorators.system_endpoint]
587 f
"{self.v1_str}/", self.
bonus.api_v1_beacon_post,
"POST",
588 decorators=[decorators.public_endpoint(),
589 decorators.system_endpoint]
592 f
"{self.v1_str}/", self.
bonus.api_v1_beacon_put,
"PUT",
593 decorators=[decorators.public_endpoint(),
594 decorators.system_endpoint]
597 f
"{self.v1_str}/", self.
bonus.api_v1_beacon_patch,
"PATCH",
598 decorators=[decorators.public_endpoint(),
599 decorators.system_endpoint]
602 f
"{self.v1_str}/", self.
bonus.api_v1_beacon_delete,
"DELETE",
603 decorators=[decorators.public_endpoint(),
604 decorators.system_endpoint]
607 f
"{self.v1_str}/", self.
bonus.api_v1_beacon_head,
"HEAD",
608 decorators=[decorators.public_endpoint(),
609 decorators.system_endpoint]
612 f
"{self.v1_str}/", self.
bonus.api_v1_beacon_options,
"OPTIONS",
613 decorators=[decorators.public_endpoint(),
614 decorators.system_endpoint]
619 f
"{self.v1_str}/stop", self.
bonus.post_stop_server,
"PUT",
621 decorators.admin_endpoint(),
622 decorators.system_endpoint
628 "/health", self.
bonus.get_health,
"GET",
630 decorators.public_endpoint(),
631 decorators.system_endpoint
637 "/favicon.ico", self.
bonus.get_favicon,
"GET",
639 decorators.public_endpoint(),
640 decorators.system_endpoint
646 "/static/logo.png", self.
bonus.get_static_logo,
"GET",
648 decorators.public_endpoint(),
649 decorators.system_endpoint
659 self.
disp.log_error(
"OAuth Authentication is missing")
660 raise RuntimeError(
"Token validation service unavailable")
664 decorators=[decorators.public_endpoint(),
665 decorators.oauth_endpoint]
670 decorators=[decorators.public_endpoint(),
671 decorators.oauth_endpoint]
674 f
"{self.oauth_str}/{'{provider}'}",
677 decorators=[decorators.admin_endpoint(), decorators.oauth_endpoint]
680 f
"{self.oauth_str}/{'{provider}'}",
683 decorators=[decorators.admin_endpoint(), decorators.oauth_endpoint]
686 f
"{self.oauth_str}/{'{provider}'}",
689 decorators=[decorators.admin_endpoint(), decorators.oauth_endpoint]
692 f
"{self.oauth_str}/{'{provider}'}",
695 decorators=[decorators.admin_endpoint(), decorators.oauth_endpoint]
700 f
"{self.token_endpoint}/valid", self.
token_endpoints.get_token_valid,
"GET",
702 decorators=[decorators.auth_endpoint(), decorators.token_endpoint]
707 decorators=[decorators.admin_endpoint(), decorators.token_endpoint]
710 f
"{self.token_endpoint}/ttl", self.
token_endpoints.get_time_to_live,
"GET",
712 decorators=[decorators.auth_endpoint(), decorators.token_endpoint]
715 f
"{self.token_endpoint}/info", self.
token_endpoints.get_token_info,
"GET",
717 decorators=[decorators.auth_endpoint(), decorators.token_endpoint]
720 f
"{self.token_endpoint}/refresh", self.
token_endpoints.post_refresh_token,
"POST",
722 decorators=[decorators.auth_endpoint(), decorators.token_endpoint]
725 f
"{self.token_endpoint}/revoke_account_tokens", self.
token_endpoints.delete_revoke_account_token,
"DELETE",
727 decorators=[decorators.admin_endpoint(), decorators.token_endpoint]
731 if ENDPOINT_CONST.TEST_ENABLE_TESTING_ENDPOINTS:
732 self.
disp.log_debug(
"Testing endpoints enabled")
736 decorators=[decorators.test_endpoint(
737 ), decorators.admin_endpoint()]
740 f
"{self.sql_endpoint}/table/columns", self.
testing_endpoints.get_table_columns,
"GET",
741 decorators=[decorators.test_endpoint(
742 ), decorators.admin_endpoint()]
745 f
"{self.sql_endpoint}/table/describe", self.
testing_endpoints.describe_table,
"GET",
746 decorators=[decorators.test_endpoint(
747 ), decorators.admin_endpoint()]
751 decorators=[decorators.test_endpoint(
752 ), decorators.admin_endpoint()]
755 f
"{self.sql_endpoint}/version", self.
testing_endpoints.get_database_version,
"GET",
756 decorators=[decorators.test_endpoint(
757 ), decorators.admin_endpoint()]
760 f
"{self.sql_endpoint}/connected", self.
testing_endpoints.test_sql_connection,
"GET",
761 decorators=[decorators.test_endpoint(
762 ), decorators.admin_endpoint()]
766 decorators=[decorators.test_endpoint(
767 ), decorators.admin_endpoint()]
770 f
"{self.sql_endpoint}/triggers/names", self.
testing_endpoints.get_trigger_names,
"GET",
771 decorators=[decorators.test_endpoint(
772 ), decorators.admin_endpoint()]
775 f
"{self.sql_endpoint}/datetime/now", self.
testing_endpoints.get_current_datetime,
"GET",
776 decorators=[decorators.test_endpoint(
777 ), decorators.admin_endpoint()]
780 f
"{self.sql_endpoint}/datetime/today", self.
testing_endpoints.get_current_date,
"GET",
781 decorators=[decorators.test_endpoint(
782 ), decorators.admin_endpoint()]
785 f
"{self.sql_endpoint}/datetime/to-string", self.
testing_endpoints.convert_datetime_to_string,
"GET",
786 decorators=[decorators.test_endpoint(
787 ), decorators.admin_endpoint()]
790 f
"{self.sql_endpoint}/datetime/from-string", self.
testing_endpoints.convert_string_to_datetime,
"GET",
791 decorators=[decorators.test_endpoint(
792 ), decorators.admin_endpoint()]
797 decorators=[decorators.test_endpoint(
798 ), decorators.admin_endpoint()]
801 f
"{self.bucket_endpoint}/connected", self.
testing_endpoints.test_bucket_connection,
"GET",
802 decorators=[decorators.test_endpoint(
803 ), decorators.admin_endpoint()]
806 f
"{self.bucket_endpoint}/create", self.
testing_endpoints.create_test_bucket,
"POST",
807 decorators=[decorators.test_endpoint(
808 ), decorators.admin_endpoint()]
811 f
"{self.bucket_endpoint}/upload", self.
testing_endpoints.upload_test_file_stream,
"POST",
812 decorators=[decorators.test_endpoint(
813 ), decorators.admin_endpoint()]
817 decorators=[decorators.test_endpoint(
818 ), decorators.admin_endpoint()]
821 f
"{self.bucket_endpoint}/files/info", self.
testing_endpoints.get_bucket_file_info,
"GET",
822 decorators=[decorators.test_endpoint(
823 ), decorators.admin_endpoint()]
826 f
"{self.bucket_endpoint}/download", self.
testing_endpoints.download_test_file_stream,
"GET",
827 decorators=[decorators.test_endpoint(
828 ), decorators.admin_endpoint()]
831 f
"{self.bucket_endpoint}/delete", self.
testing_endpoints.delete_test_bucket,
"DELETE",
832 decorators=[decorators.test_endpoint(
833 ), decorators.admin_endpoint()]
836 f
"{self.bucket_endpoint}/delete-file", self.
testing_endpoints.delete_test_file,
"DELETE",
837 decorators=[decorators.test_endpoint(
838 ), decorators.admin_endpoint()]
841 self.
disp.log_debug(
"Testing endpoints disabled")