Skip to content

Commit

Permalink
open api specs
Browse files Browse the repository at this point in the history
  • Loading branch information
matusdrobuliak66 committed Dec 10, 2024
1 parent 06f5743 commit dbd1ffe
Show file tree
Hide file tree
Showing 6 changed files with 339 additions and 113 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@
from models_library.generics import Envelope
from models_library.rest_error import EnvelopedError
from simcore_service_webserver._meta import API_VTAG
from simcore_service_webserver.catalog.licenses._exceptions_handlers import (
_TO_HTTP_ERROR_MAP,
)
from simcore_service_webserver.catalog.licenses._models import (
from simcore_service_webserver.licenses._exceptions_handlers import _TO_HTTP_ERROR_MAP
from simcore_service_webserver.licenses._models import (
LicensedItemsBodyParams,
LicensedItemsListQueryParams,
LicensedItemsPathParams,
Expand Down
55 changes: 55 additions & 0 deletions api/specs/web-server/_licensed_items_purchases.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
""" Helper script to generate OAS automatically
"""

# pylint: disable=redefined-outer-name
# pylint: disable=unused-argument
# pylint: disable=unused-variable
# pylint: disable=too-many-arguments

from typing import Annotated

from _common import as_query
from fastapi import APIRouter, Depends
from models_library.api_schemas_webserver.licensed_items_purchases import (
LicensedItemPurchaseGet,
)
from models_library.generics import Envelope
from models_library.rest_error import EnvelopedError
from simcore_service_webserver._meta import API_VTAG
from simcore_service_webserver.licenses._exceptions_handlers import _TO_HTTP_ERROR_MAP
from simcore_service_webserver.licenses._models import (
LicensedItemsPurchasesListQueryParams,
LicensedItemsPurchasesPathParams,
)
from simcore_service_webserver.wallets._handlers import WalletsPathParams

router = APIRouter(
prefix=f"/{API_VTAG}",
tags=[
"licenses",
],
responses={
i.status_code: {"model": EnvelopedError} for i in _TO_HTTP_ERROR_MAP.values()
},
)


@router.get(
"/wallets/{wallet_id}/licensed-items-purchases",
response_model=Envelope[list[LicensedItemPurchaseGet]],
)
async def list_wallet_licensed_items_purchases(
_path: Annotated[WalletsPathParams, Depends()],
_query: Annotated[as_query(LicensedItemsPurchasesListQueryParams), Depends()],
):
...


@router.get(
"/licensed-items-purchases/{licensed_item_purchase_id}",
response_model=Envelope[LicensedItemPurchaseGet],
)
async def get_licensed_item_purchase(
_path: Annotated[LicensedItemsPurchasesPathParams, Depends()],
):
...
3 changes: 2 additions & 1 deletion api/specs/web-server/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@
"_announcements",
"_catalog",
"_catalog_tags", # MUST BE after _catalog
"_catalog_licensed_items",
"_computations",
"_exporter",
"_folders",
"_long_running_tasks",
"_licensed_items",
"_licensed_items_purchases",
"_metamodeling",
"_nih_sparc",
"_nih_sparc_redirections",
Expand Down
Loading

0 comments on commit dbd1ffe

Please sign in to comment.