-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Expose
/licensed-items
endpoint in api server (#6958)
Co-authored-by: matusdrobuliak66 <[email protected]> Co-authored-by: Matus Drobuliak <[email protected]>
- Loading branch information
1 parent
ed110f4
commit e97f83b
Showing
51 changed files
with
459 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
services/api-server/src/simcore_service_api_server/api/dependencies/webserver_rpc.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from typing import Annotated, cast | ||
|
||
from fastapi import Depends, FastAPI | ||
from servicelib.fastapi.dependencies import get_app | ||
|
||
from ...services_rpc.wb_api_server import WbApiRpcClient | ||
|
||
|
||
async def get_wb_api_rpc_client( | ||
app: Annotated[FastAPI, Depends(get_app)] | ||
) -> WbApiRpcClient: | ||
assert app.state.wb_api_rpc_client # nosec | ||
return cast(WbApiRpcClient, app.state.wb_api_rpc_client) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
services/api-server/src/simcore_service_api_server/api/routes/licensed_items.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from typing import Annotated, Any | ||
|
||
from fastapi import APIRouter, Depends, status | ||
|
||
from ...api.dependencies.authentication import get_product_name | ||
from ...api.dependencies.webserver_rpc import get_wb_api_rpc_client | ||
from ...exceptions.service_errors_utils import DEFAULT_BACKEND_SERVICE_STATUS_CODES | ||
from ...models.pagination import Page, PaginationParams | ||
from ...models.schemas.model_adapter import LicensedItemGet | ||
from ...services_rpc.wb_api_server import WbApiRpcClient | ||
|
||
router = APIRouter() | ||
|
||
_LICENSE_ITEMS_STATUS_CODES: dict[int | str, dict[str, Any]] = { | ||
**DEFAULT_BACKEND_SERVICE_STATUS_CODES, | ||
} | ||
|
||
|
||
@router.get( | ||
"", | ||
response_model=Page[LicensedItemGet], | ||
status_code=status.HTTP_200_OK, | ||
responses=_LICENSE_ITEMS_STATUS_CODES, | ||
description="Get all licensed items", | ||
include_in_schema=False, | ||
) | ||
async def get_licensed_items( | ||
page_params: Annotated[PaginationParams, Depends()], | ||
web_api_rpc: Annotated[WbApiRpcClient, Depends(get_wb_api_rpc_client)], | ||
product_name: Annotated[str, Depends(get_product_name)], | ||
): | ||
return await web_api_rpc.get_licensed_items( | ||
product_name=product_name, page_params=page_params | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
services/api-server/src/simcore_service_api_server/exceptions/handlers/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...api-server/src/simcore_service_api_server/exceptions/handlers/_handlers_backend_errors.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.