lnbits/extensions/streamalerts/views_api.py
async def api_update_donation(
    data: CreateDonation, donation_id=None, g: WalletTypeInfo = Depends(get_key_type)
):
    """Update a donation with the data given in the request"""
    if donation_id:
        donation = await get_donation(donation_id)

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

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

        donation = await update_donation(donation_id, **data.dict())
    else:
        raise HTTPException(
            status_code=HTTPStatus.BAD_REQUEST, detail="No donation ID specified"
        )

    return donation.dict()
Update a donation with the data given in the request
Update a donation with the data given in the request
Update a donation with the data given in the request
async def api_update_donation(
    data: CreateDonation, donation_id=None, g: WalletTypeInfo = Depends(get_key_type)
):
    if donation_id:
        donation = await get_donation(donation_id)
        if not donation:
            raise HTTPException(
                status_code=HTTPStatus.NOT_FOUND, detail="Donation does not exist."
            )
        if donation.wallet != g.wallet.id:
            raise HTTPException(
                status_code=HTTPStatus.FORBIDDEN, detail="Not your donation."
            )
        donation = await update_donation(donation_id, **data.dict())
    else:
        raise HTTPException(
            status_code=HTTPStatus.BAD_REQUEST, detail="No donation ID specified"
        )
    return donation.dict()
async def api_update_donation ( data : CreateDonation , donation_id = None , g : WalletTypeInfo = Depends ( get_key_type ) ) : if donation_id : donation = await get_donation ( donation_id ) if not donation : raise HTTPException ( status_code = HTTPStatus . NOT_FOUND , detail = "Donation does not exist." ) if donation . wallet != g . wallet . id : raise HTTPException ( status_code = HTTPStatus . FORBIDDEN , detail = "Not your donation." ) donation = await update_donation ( donation_id , ** data . dict ( ) ) else : raise HTTPException ( status_code = HTTPStatus . BAD_REQUEST , detail = "No donation ID specified" ) return donation . dict ( )
Update a donation with the data given in the request
Update a donation with the data given in the request
"""Update a donation with the data given in the request"""
data
CreateDonation
donation_id
g
WalletTypeInfo