def put_edge(edges: List[Edge], request: Request): if authentication.is_authorized(request.headers): return store.upsert_edge(edges) else: return JSONResponse( status_code=status.HTTP_401_UNAUTHORIZED, content={"Error": "This operation requires authorization"})
def delete_node_type(node_type: str, request: Request): """ - **node_type**: type of node to delete """ if authentication.is_authorized(request.headers): return store.delete_node_by_type(node_type) else: return JSONResponse(status_code=status.HTTP_401_UNAUTHORIZED, content={"Error": "This operation requires authorization"})
async def set_azure_max_throughput(throughput: Throughput, request: Request): """ Set the max throughput for cosmosdb - **throughput**: new throughput value """ if authentication.is_authorized(request.headers): return store.set_azure_max_throughput(throughput) else: return JSONResponse( status_code=status.HTTP_401_UNAUTHORIZED, content={"Error": "This operation requires authorization"})
def upsert_node_and_create_edge(payload: NodeRelationPayload, request: Request): """ Creates a node based and generates an edge based on the payload - **payload**: Payload containing a node_body to generate a new node, and a source_id and edge_label to generate the relationship for the new node """ if authentication.is_authorized(request.headers): return store.upsert_node_and_create_edge(payload) else: return JSONResponse(status_code=status.HTTP_401_UNAUTHORIZED, content={"Error": "This operation requires authorization"})
def delete_all_edge_of_node(node_id: str, request: Request): """ Delete all edges of a node - **node_id**: Id of node """ if authentication.is_authorized(request.headers): return store.delete_all_edges_of_node(node_id) else: return JSONResponse( status_code=status.HTTP_401_UNAUTHORIZED, content={"Error": "This operation requires authorization"})
def delete_edge(label: str, request: Request): """ Delete edge by label - **label**: Edge label """ if authentication.is_authorized(request.headers): return store.delete_edge_by_label(label) else: return JSONResponse( status_code=status.HTTP_401_UNAUTHORIZED, content={"Error": "This operation requires authorization"})
def delete_edge(n1: str, n2: str, request: Request): """ Delete edge by n1 and n2 - **n1**: ID of source node - **n2**: ID of target node """ if authentication.is_authorized(request.headers): return store.delete_edge(n1, n2) else: return JSONResponse( status_code=status.HTTP_401_UNAUTHORIZED, content={"Error": "This operation requires authorization"})
def put_node(node_ids: List[str], request: Request): if authentication.is_authorized(request.headers): return store.invalidate_nodes(node_ids) else: return JSONResponse(status_code=status.HTTP_401_UNAUTHORIZED, content={"Error": "This operation requires authorization"})