lnbits/extensions/streamalerts/views_api.py
async def api_update_service(
    data: CreateService, service_id=None, g: WalletTypeInfo = Depends(get_key_type)
):
    """Update a service with the data given in the request"""
    if service_id:
        service = await get_service(service_id)

        if not service:
            raise HTTPException(
                status_code=HTTPStatus.NOT_FOUND, detail="Service does not exist."
            )

        if service.wallet != g.wallet.id:
            raise HTTPException(
                status_code=HTTPStatus.FORBIDDEN, detail="Not your service."
            )

        service = await update_service(service_id, **data.dict())
    else:
        raise HTTPException(
            status_code=HTTPStatus.BAD_REQUEST, detail="No service ID specified"
        )
    return service.dict()
Update a service with the data given in the request
Update a service with the data given in the request
Update a service with the data given in the request
async def api_update_service(
    data: CreateService, service_id=None, g: WalletTypeInfo = Depends(get_key_type)
):
    if service_id:
        service = await get_service(service_id)
        if not service:
            raise HTTPException(
                status_code=HTTPStatus.NOT_FOUND, detail="Service does not exist."
            )
        if service.wallet != g.wallet.id:
            raise HTTPException(
                status_code=HTTPStatus.FORBIDDEN, detail="Not your service."
            )
        service = await update_service(service_id, **data.dict())
    else:
        raise HTTPException(
            status_code=HTTPStatus.BAD_REQUEST, detail="No service ID specified"
        )
    return service.dict()
async def api_update_service ( data : CreateService , service_id = None , g : WalletTypeInfo = Depends ( get_key_type ) ) : if service_id : service = await get_service ( service_id ) if not service : raise HTTPException ( status_code = HTTPStatus . NOT_FOUND , detail = "Service does not exist." ) if service . wallet != g . wallet . id : raise HTTPException ( status_code = HTTPStatus . FORBIDDEN , detail = "Not your service." ) service = await update_service ( service_id , ** data . dict ( ) ) else : raise HTTPException ( status_code = HTTPStatus . BAD_REQUEST , detail = "No service ID specified" ) return service . dict ( )
Update a service with the data given in the request
Update a service with the data given in the request
"""Update a service with the data given in the request"""
data
CreateService
service_id
g
WalletTypeInfo