def image_put(body): # noqa: E501 """Add a new image # noqa: E501 :param body: :type body: dict | bytes :rtype: Image """ if connexion.request.is_json: body = Image.from_dict(connexion.request.get_json()) # noqa: E501 engine = QueryEngine() result = engine.put_image(body) if result: return Image(id=result.id), 200 return Error('400', f'Bad Request'), 400
def image_id_patch(body, id_): # noqa: E501 """Update the image identified by the ID in the path. # noqa: E501 :param body: :type body: dict | bytes :param id_: ID number of the image to update. :type id_: int :rtype: None """ if connexion.request.is_json: body = Image.from_dict(connexion.request.get_json()) # noqa: E501 engine = QueryEngine() result = engine.patch_image(id_, body) if result: return None, 204 return Error('404', f'Image {id_} not found'), 404