-
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 <[email protected]>
- Loading branch information
Showing
5 changed files
with
105 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import type { Agent, Query } from '@aries-framework/core' | ||
import type { | ||
GenericRecord, | ||
SaveGenericRecordOption | ||
} from '@aries-framework/core/build/modules/generic-records/repository/GenericRecord' | ||
|
||
/** | ||
* Retrieves all credential exchange records from the agent. | ||
* | ||
* @param agent The agent instance to use for retrieving the credential exchange records. | ||
* @returns A promise that resolves to an array of credential exchange records. | ||
*/ | ||
export const addWalletRecord = async (agent: Agent, options: SaveGenericRecordOption) => { | ||
return agent.genericRecords.save(options) | ||
} | ||
|
||
/** | ||
* Retrieves the generic record for a given record ID. | ||
* @param agent The agent instance to use for retrieving the generic record. | ||
* @param id The ID of the generic record to retrieve. | ||
* @returns A Promise that resolves with the generic record for the given ID. | ||
*/ | ||
export const findWalletRecordById = async (agent: Agent, id: string) => { | ||
return agent.genericRecords.findById(id) | ||
} | ||
|
||
/** | ||
* Retrieves all generic records from the agent. | ||
* | ||
* @param agent The agent instance to use for retrieving the generic records. | ||
* @returns A promise that resolves to an array of generic records. | ||
*/ | ||
export const getAllWalletRecords = async (agent: Agent) => { | ||
return agent.genericRecords.getAll() | ||
} | ||
|
||
/** | ||
* Updates a generic record. | ||
* | ||
* @param agent The agent instance to use for updating the generic record. | ||
* @param record The generic record to update. | ||
* @returns A promise that resolves with the updated generic record. | ||
*/ | ||
export const updateWalletRecord = async (agent: Agent, record: GenericRecord) => { | ||
return agent.genericRecords.update(record) | ||
} | ||
|
||
/** | ||
* Deletes a generic record. | ||
* | ||
* @param agent The agent instance to use for deleting the generic record. | ||
* @param record The generic record to delete. | ||
* @returns A promise that resolves with the deleted generic record. | ||
*/ | ||
export const deleteWalletRecord = async (agent: Agent, record: GenericRecord) => { | ||
return agent.genericRecords.delete(record) | ||
} | ||
|
||
/** | ||
* Deletes a generic record by ID. | ||
* | ||
* @param agent The agent instance to use for deleting the generic record. | ||
* @param id The ID of the generic record to delete. | ||
* @returns A promise that resolves with the deleted generic record. | ||
*/ | ||
export const deleteWalletRecordById = async (agent: Agent, id: string) => { | ||
return agent.genericRecords.deleteById(id) | ||
} | ||
|
||
/** | ||
* Retrieves all generic records from the agent that match the given query. | ||
* | ||
* @param agent The agent instance to use for retrieving the generic records. | ||
* @param query The query to use for retrieving the generic records. | ||
* @returns A promise that resolves to an array of generic records. | ||
*/ | ||
export const findWalletRecordsByQuery = async (agent: Agent, query: Query<GenericRecord>) => { | ||
return agent.genericRecords.findAllByQuery(query) | ||
} |
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 './genericRecords' |
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