コード例 #1
0
def get_item_metadata_5(
    request,
    item_id: int = Path(None),
    name: str = Path(None),
    kind: str = Path(None)
) -> str:
    return f"{item_id} {name} {kind}"
コード例 #2
0
ファイル: api.py プロジェクト: h0rn3t/django-ninja
def test_multi_path(
        request,
        i: int = Path(...),
        s: str = Path("a-str"),
        data: TestData4 = Path(...),
        nested_data: TestData = Path(..., alias="nested-data"),
):
    return dict(s=s, i=i, data=data, nested_data=nested_data)
コード例 #3
0
def put_datapoint_forecast_latest(
        request,
        forecast_messages_by_datapoint_id: ForecastMessageListByDatapointId,
        product_run_filter_params: dp_forecast_view.PathParams = Path(...),
):
    """
    Return the historic setpoint for datapoints targeted by the filter.
    """

    response = dp_forecast_view.update_history(
        request=request,
        related_data=forecast_messages_by_datapoint_id,
        second_related_filter_params=product_run_filter_params,
    )
    return response
コード例 #4
0
def get_datapoint_forecast_latest(
    request,
    product_run_filter_params: dp_forecast_view.PathParams = Path(...),
    datapoint_filter_params: DatapointFilterParams = Query(...),
    forecast_filter_params: dp_forecast_view.ForecastFilterParams = Query(...),
):
    """
    Return the latest setpoints for datapoints targeted by the filter.
    """

    response = dp_forecast_view.list_history(
        request=request,
        datapoint_filter_params=datapoint_filter_params,
        related_filter_params=forecast_filter_params,
        second_related_filter_params=product_run_filter_params,
    )
    return response
コード例 #5
0
def get_path_param_lt0(request, item_id: float = Path(..., lt=0)):
    return item_id
コード例 #6
0
def get_path_param_gt(request, item_id: float = Path(..., gt=3)):
    return item_id
コード例 #7
0
def get_path_param_min_max_length(request,
                                  item_id: str = Path(...,
                                                      max_length=3,
                                                      min_length=2)):
    return item_id
コード例 #8
0
def get_path_param_required_id(request, item_id: str = Path(...)):
    return item_id
コード例 #9
0
def get_path_param_id(request, item_id: str = Path(None)):
    return item_id
コード例 #10
0
def get_path_param_le_ge_int(request, item_id: int = Path(..., le=3, ge=1)):
    return item_id
コード例 #11
0
def get_item_metadata_4(request, item_id: str = Path(None)) -> str:
    return item_id
コード例 #12
0
def get_path_param_lt_int(request, item_id: int = Path(..., lt=3)):
    return item_id
コード例 #13
0
def events(request, date: PathDate = Path(...)):
    return {"date": date.value()}
コード例 #14
0
def get_path_param_le(request, item_id: float = Path(..., le=3)):
    return item_id
コード例 #15
0
def get_path_param_ge_int(request, item_id: int = Path(..., ge=3)):
    return item_id
コード例 #16
0
def get_path_param_lt_gt(request, item_id: float = Path(..., lt=3, gt=1)):
    return item_id
コード例 #17
0
def get_item_metadata(request, item_id: int = Path(None)) -> int:
    return item_id