Skip to content

Commit

Permalink
docs: Add JSDoc documentation to relationships.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
madjin committed Dec 29, 2024
1 parent 6d8772d commit 204448a
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions packages/core/src/relationships.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import { IAgentRuntime, type Relationship, type UUID } from "./types.ts";

/**
* Asynchronously creates a relationship between two users in the database.
*
* @param {Object} params - The parameters for creating the relationship.
* @param {IAgentRuntime} params.runtime - The runtime environment for the operation.
* @param {UUID} params.userA - The ID of the first user in the relationship.
* @param {UUID} params.userB - The ID of the second user in the relationship.
* @returns {Promise<boolean>} A Promise that resolves to a boolean indicating the success of creating the relationship.
*/
export async function createRelationship({
runtime,
userA,
Expand All @@ -15,6 +24,15 @@ export async function createRelationship({
});
}

/**
* Retrieves the relationship between two users from the database.
*
* @param {Object} options - The options for retrieving the relationship.
* @param {IAgentRuntime} options.runtime - The agent runtime.
* @param {UUID} options.userA - The ID of the first user.
* @param {UUID} options.userB - The ID of the second user.
* @returns {Promise} A promise that resolves with the relationship between the two users.
*/
export async function getRelationship({
runtime,
userA,
Expand All @@ -30,6 +48,13 @@ export async function getRelationship({
});
}

/**
* Fetches relationships for a user from the database.
* @param {Object} params - The parameters for fetching relationships.
* @param {IAgentRuntime} params.runtime - The agent runtime instance.
* @param {UUID} params.userId - The ID of the user to fetch relationships for.
* @returns {Promise} A promise that resolves with the user's relationships from the database.
*/
export async function getRelationships({
runtime,
userId,
Expand All @@ -40,6 +65,14 @@ export async function getRelationships({
return runtime.databaseAdapter.getRelationships({ userId });
}

/**
* Formats relationships for a specific user.
* @async
* @param {Object} options - The options object.
* @param {IAgentRuntime} options.runtime - The runtime interface.
* @param {UUID} options.userId - The ID of the user.
* @returns {Promise<Array<UUID>>} The formatted relationships.
*/
export async function formatRelationships({
runtime,
userId,
Expand Down

0 comments on commit 204448a

Please sign in to comment.