mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-09 03:04:54 -04:00
docs: Update API Docs (#3856)
This commit is contained in:
parent
ca1ab33291
commit
17f9eef551
@ -17,18 +17,14 @@ from mealie.services.scheduler import SchedulerRegistry, SchedulerService, tasks
|
|||||||
|
|
||||||
settings = get_app_settings()
|
settings = get_app_settings()
|
||||||
|
|
||||||
description = f"""
|
description = """
|
||||||
Mealie is a web application for managing your recipes, meal plans, and shopping lists. This is the Restful
|
Mealie is a web application for managing your recipes, meal plans, and shopping lists. This is the Restful
|
||||||
API interactive documentation that can be used to explore the API. If you're justing getting started with
|
API interactive documentation that can be used to explore the API. If you're justing getting started with
|
||||||
the API and want to get started quickly, you can use the
|
the API and want to get started quickly, you can use the
|
||||||
[API Usage | Mealie Docs](https://nightly.mealie.io/documentation/getting-started/api-usage/)
|
[API Usage | Mealie Docs](https://docs.mealie.io/documentation/getting-started/api-usage/)
|
||||||
as a reference for how to get started.
|
as a reference for how to get started.
|
||||||
|
|
||||||
|
|
||||||
As of this release <b>{APP_VERSION}</b>, Mealie is still in rapid development and therefore some of these APIs may
|
|
||||||
change from version to version.
|
|
||||||
|
|
||||||
|
|
||||||
If you have any questions or comments about mealie, please use the discord server to talk to the developers or other
|
If you have any questions or comments about mealie, please use the discord server to talk to the developers or other
|
||||||
community members. If you'd like to file an issue, please use the
|
community members. If you'd like to file an issue, please use the
|
||||||
[GitHub Issue Tracker | Mealie](https://github.com/mealie-recipes/mealie/issues/new/choose)
|
[GitHub Issue Tracker | Mealie](https://github.com/mealie-recipes/mealie/issues/new/choose)
|
||||||
@ -36,10 +32,9 @@ community members. If you'd like to file an issue, please use the
|
|||||||
|
|
||||||
## Helpful Links
|
## Helpful Links
|
||||||
- [Home Page](https://mealie.io)
|
- [Home Page](https://mealie.io)
|
||||||
- [Documentation](https://nightly.mealie.io)
|
- [Documentation](https://docs.mealie.io)
|
||||||
- [Discord](https://discord.gg/QuStdQGSGK)
|
- [Discord](https://discord.gg/QuStdQGSGK)
|
||||||
- [Demo](https://demo.mealie.io)
|
- [Demo](https://demo.mealie.io)
|
||||||
- [Beta](https://demo.mealie.io)
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
logger = get_logger()
|
logger = get_logger()
|
||||||
|
@ -131,7 +131,7 @@ class BaseCrudController(BaseUserController):
|
|||||||
Base class for all CRUD controllers to facilitate common CRUD functions.
|
Base class for all CRUD controllers to facilitate common CRUD functions.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
event_bus: EventBusService = Depends(EventBusService.create)
|
event_bus: EventBusService = Depends(EventBusService.as_dependency)
|
||||||
|
|
||||||
def publish_event(self, event_type: EventTypes, document_data: EventDocumentDataBase, message: str = "") -> None:
|
def publish_event(self, event_type: EventTypes, document_data: EventDocumentDataBase, message: str = "") -> None:
|
||||||
self.event_bus.dispatch(
|
self.event_bus.dispatch(
|
||||||
|
@ -6,7 +6,7 @@ from mealie.routes._base import BaseAdminController, controller
|
|||||||
from mealie.schema.analytics.analytics import MealieAnalytics
|
from mealie.schema.analytics.analytics import MealieAnalytics
|
||||||
from mealie.services.analytics.service_analytics import AnalyticsService
|
from mealie.services.analytics.service_analytics import AnalyticsService
|
||||||
|
|
||||||
router = APIRouter(prefix="/analytics")
|
router = APIRouter(prefix="/analytics", include_in_schema=False) # deprecated - use statistics route instead
|
||||||
|
|
||||||
|
|
||||||
@controller(router)
|
@controller(router)
|
||||||
|
@ -35,7 +35,7 @@ router = APIRouter(
|
|||||||
|
|
||||||
@controller(router)
|
@controller(router)
|
||||||
class GroupEventsNotifierController(BaseUserController):
|
class GroupEventsNotifierController(BaseUserController):
|
||||||
event_bus: EventBusService = Depends(EventBusService.create)
|
event_bus: EventBusService = Depends(EventBusService.as_dependency)
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def repo(self):
|
def repo(self):
|
||||||
|
@ -221,6 +221,6 @@ def mount_spa(app: FastAPI):
|
|||||||
global __contents
|
global __contents
|
||||||
__contents = pathlib.Path(__app_settings.STATIC_FILES).joinpath("index.html").read_text()
|
__contents = pathlib.Path(__app_settings.STATIC_FILES).joinpath("index.html").read_text()
|
||||||
|
|
||||||
app.get("/g/{group_slug}/r/{recipe_slug}")(serve_recipe_with_meta)
|
app.get("/g/{group_slug}/r/{recipe_slug}", include_in_schema=False)(serve_recipe_with_meta)
|
||||||
app.get("/g/{group_slug}/shared/r/{token_id}")(serve_shared_recipe_with_meta)
|
app.get("/g/{group_slug}/shared/r/{token_id}", include_in_schema=False)(serve_shared_recipe_with_meta)
|
||||||
app.mount("/", SPAStaticFiles(directory=__app_settings.STATIC_FILES, html=True), name="spa")
|
app.mount("/", SPAStaticFiles(directory=__app_settings.STATIC_FILES, html=True), name="spa")
|
||||||
|
@ -15,7 +15,7 @@ router = APIRouter(prefix="/register")
|
|||||||
|
|
||||||
@controller(router)
|
@controller(router)
|
||||||
class RegistrationController(BasePublicController):
|
class RegistrationController(BasePublicController):
|
||||||
event_bus: EventBusService = Depends(EventBusService.create)
|
event_bus: EventBusService = Depends(EventBusService.as_dependency)
|
||||||
|
|
||||||
@router.post("", response_model=UserOut, status_code=status.HTTP_201_CREATED)
|
@router.post("", response_model=UserOut, status_code=status.HTTP_201_CREATED)
|
||||||
def register_new_user(self, data: CreateUserRegistration):
|
def register_new_user(self, data: CreateUserRegistration):
|
||||||
|
@ -6,4 +6,4 @@ prefix = "/validators"
|
|||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
router.include_router(validators.router, prefix=prefix, tags=["Validators"])
|
router.include_router(validators.router, prefix=prefix, tags=["Validators"], include_in_schema=False)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from fastapi import BackgroundTasks, Depends
|
from fastapi import BackgroundTasks, Depends, Query
|
||||||
from pydantic import UUID4
|
from pydantic import UUID4
|
||||||
from sqlalchemy.orm.session import Session
|
from sqlalchemy.orm.session import Session
|
||||||
|
|
||||||
@ -84,5 +84,11 @@ class EventBusService:
|
|||||||
listener.publish_to_subscribers(event, subscribers)
|
listener.publish_to_subscribers(event, subscribers)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, bg: BackgroundTasks, session=Depends(generate_session), group_id: UUID4 | None = None):
|
def as_dependency(
|
||||||
|
cls,
|
||||||
|
bg: BackgroundTasks,
|
||||||
|
session=Depends(generate_session),
|
||||||
|
group_id: UUID4 | None = Query(None, include_in_schema=False),
|
||||||
|
):
|
||||||
|
"""Convenience method to use as a dependency in FastAPI routes"""
|
||||||
return cls(bg, session, group_id)
|
return cls(bg, session, group_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user