def register(self, intent):
        """Registers a new intent and returns the Intent object with an ID"""
        response = self.api.post_intent(intent.serialize)
        print(response)
        print()
        if response['status']['code'] == 200:
            intent.id = response['id']
        elif response['status']['code'] == 409: # intent already exists
            intent.id = next(i.id for i in self.api.agent_intents if i.name == intent.name)
            self.update(intent)
        return intent
def register ( self , intent ) : response = self . api . post_intent ( intent . serialize ) print ( response ) print ( ) if response [ 'status' ] [ 'code' ] == 200 : intent . id = response [ 'id' ] elif response [ 'status' ] [ 'code' ] == 409 : intent . id = next ( i . id for i in self . api . agent_intents if i . name == intent . name ) self . update ( intent ) return intent
Registers a new intent and returns the Intent object with an ID