2525from godel .queries .CreateEntity import Operations as CreateEntityOperations
2626from godel .queries .CreateValidation import Operations as CreateValidationOperations
2727from godel .queries .CreateStatement import Operations as CreateStatementOperations
28+ from godel .queries .CreateTripleFlag import Operations as CreateTripleFlagOperations
2829
2930# from godel.queries.CurrentUserBlockchainData import Operations as CurrentUserBlockchainDataOperations
3031from godel .queries .CurrentUserValidations import (
@@ -705,6 +706,15 @@ def create_statement(
705706 # Validation Submissions
706707
707708 def create_validation (self , triple_id : str , validation_type : str , ** kwargs ) -> dict :
709+ """Create verification vote
710+
711+ Args:
712+ triple_id (str): Your triple id
713+ validation_type (str): Verfication type "ACCEPTED", "REJECTED", "SKIPPED"
714+
715+ Returns:
716+ dict: created verification task
717+ """
708718 x_metrics = json .loads (self .headers .get ("X-metrics" ))
709719 x_metrics .update ({"cv" : time .time ()})
710720 if x_metrics .get ("uv" ):
@@ -723,22 +733,29 @@ def create_validation(self, triple_id: str, validation_type: str, **kwargs) -> d
723733 # Create Triple Flag
724734
725735 def create_triple_flag (
726- self , triple_id : str , flag : str , reason : str , ** kwargs
736+ self , create_triple_flag_input : schema . CreateTripleFlagInput , ** kwargs
727737 ) -> dict :
728- query = f"""mutation MyMutation {{
729- createTripleFlag(
730- input: {{
731- tripleId: "{ triple_id } "
732- flag: { flag }
733- reason: "{ reason } "
734- }}
735- ) {{
736- clientMutationId
737- }}
738- }}"""
739- print (query )
740- variables = {}
741- data = self .endpoint (query , variables )
738+ """Create triple flag given the triple flag inputs consisting of triple_id and your flag
739+
740+ Args:
741+ create_triple_flag_input (schema.CreateTripleFlagInput): Triple flag input
742+
743+ Returns:
744+ dict: created triple flag
745+ """
746+ # Special case for parsing input
747+ variables = create_triple_flag_input .__to_json_value__ ()
748+ for p , v in variables .items ():
749+ p = self .to_camel_case (p )
750+ if p in variables :
751+ variables [p ] = v
752+
753+ params = locals ()
754+ params .pop ("kwargs" )
755+ params .pop ("self" )
756+ params .update (kwargs )
757+ op = CreateTripleFlagOperations .mutation .create_triple_flag
758+ data = self .endpoint (op , variables )
742759 return data
743760
744761 def add_triple_to_entity (
0 commit comments