-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sai Ranjit Tummalapalli <sairanjit.tummalapalli@ayanworks.com>
- Loading branch information
Showing
6 changed files
with
67 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './questionAnswer' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import type { Agent, Query } from '@aries-framework/core' | ||
import type { QuestionAnswerRecord, ValidResponse } from '@aries-framework/question-answer' | ||
|
||
export type SendQuestionConfig = { | ||
question: string | ||
validResponses: ValidResponse[] | ||
detail?: string | ||
} | ||
|
||
/** | ||
* Sends a question to the connection with the given connection id. | ||
* | ||
* @param agent The agent instance . | ||
* @param connectionId The connection id. | ||
* @param config The question to send. | ||
*/ | ||
export const sendQuestion = async (agent: Agent, connectionId: string, config: SendQuestionConfig) => { | ||
return agent.modules.questionAnswer.sendQuestion(connectionId, config) | ||
} | ||
|
||
/** | ||
* Sends an answer to the question with the given question record id. | ||
* | ||
* @param agent The agent instance. | ||
* @param questionRecordId The question record id. | ||
* @param response The response to send. | ||
*/ | ||
export const sendAnswer = async (agent: Agent, questionRecordId: string, response: string) => { | ||
return agent.modules.questionAnswer.sendAnswer(questionRecordId, response) | ||
} | ||
|
||
/** | ||
* Retrieves the question record with the given id. | ||
* | ||
* @param agent The agent instance. | ||
* @param query The query to use to find the question record. | ||
*/ | ||
export const getQuestion = async (agent: Agent, query: Query<QuestionAnswerRecord>) => { | ||
return agent.modules.questionAnswer.findAllByQuery(query) | ||
} | ||
|
||
/** | ||
* Retrieves the question answer record with the given id. | ||
* | ||
* @param agent The agent instance. | ||
* @param questionAnswerRecordId The question record id. | ||
*/ | ||
export const getQuestionAnswerRecordById = async (agent: Agent, questionRecordId: string) => { | ||
return agent.modules.questionAnswer.findById(questionRecordId) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.