askexperts
Version:
AskExperts SDK: build and use AI experts - ask them questions and pay with bitcoin on an open protocol
119 lines (118 loc) • 4.28 kB
TypeScript
import { DBInterface, DBWallet, DBExpert } from "./interfaces.js";
/**
* Client implementation of the DBInterface
* Passes all calls to the DB instance except getUserId()
*/
export declare class DBClient implements DBInterface {
#private;
private db;
/**
* Creates a new DBClient instance
*/
constructor();
private user_id;
/**
* List all wallets
* @returns Promise resolving to an array of wallet objects
*/
listWallets(): Promise<DBWallet[]>;
/**
* List wallets by specific IDs
* @param ids - Array of wallet IDs to retrieve
* @returns Promise resolving to an array of wallet objects matching the provided IDs
*/
listWalletsByIds(ids: string[]): Promise<DBWallet[]>;
/**
* Get a wallet by ID
* @param id - ID of the wallet to get
* @returns Promise resolving to the wallet if found, null otherwise
*/
getWallet(id: string): Promise<DBWallet | null>;
/**
* Get a wallet by name
* @param name - Name of the wallet to get
* @returns Promise resolving to the wallet if found, null otherwise
*/
getWalletByName(name: string): Promise<DBWallet | null>;
/**
* Get the default wallet
* @returns Promise resolving to the default wallet if found, null otherwise
*/
getDefaultWallet(): Promise<DBWallet | null>;
/**
* Insert a new wallet
* @param wallet - Wallet to insert (without id)
* @returns Promise resolving to the ID of the inserted wallet
*/
insertWallet(wallet: Omit<DBWallet, "id">): Promise<string>;
/**
* Update an existing wallet
* @param wallet - Wallet to update
* @returns Promise resolving to true if wallet was updated, false otherwise
*/
updateWallet(wallet: DBWallet): Promise<boolean>;
/**
* Delete a wallet
* @param id - ID of the wallet to delete
* @returns Promise resolving to true if wallet was deleted, false otherwise
*/
deleteWallet(id: string): Promise<boolean>;
/**
* List all experts
* @returns Promise resolving to an array of expert objects
*/
listExperts(): Promise<DBExpert[]>;
/**
* List experts by specific IDs
* @param ids - Array of expert pubkeys to retrieve
* @returns Promise resolving to an array of expert objects matching the provided IDs
*/
listExpertsByIds(ids: string[]): Promise<DBExpert[]>;
/**
* List experts with timestamp newer than the provided timestamp
* @param timestamp - Only return experts with timestamp newer than this
* @param limit - Maximum number of experts to return (default: 1000)
* @returns Promise resolving to an array of expert objects
*/
listExpertsAfter(timestamp: number, limit?: number): Promise<DBExpert[]>;
/**
* Get an expert by pubkey
* @param pubkey - Pubkey of the expert to get
* @returns Promise resolving to the expert if found, null otherwise
*/
getExpert(pubkey: string): Promise<DBExpert | null>;
/**
* Insert a new expert
* @param expert - Expert to insert
* @returns Promise resolving to true if expert was inserted, false otherwise
*/
insertExpert(expert: DBExpert): Promise<boolean>;
/**
* Update an existing expert
* @param expert - Expert to update
* @returns Promise resolving to true if expert was updated, false otherwise
*/
updateExpert(expert: DBExpert): Promise<boolean>;
/**
* Set the disabled status of an expert
* @param pubkey - Pubkey of the expert to update
* @param disabled - Whether the expert should be disabled
* @returns Promise resolving to true if expert was updated, false otherwise
*/
setExpertDisabled(pubkey: string, disabled: boolean): Promise<boolean>;
/**
* Delete an expert
* @param pubkey - Pubkey of the expert to delete
* @returns Promise resolving to true if expert was deleted, false otherwise
*/
deleteExpert(pubkey: string): Promise<boolean>;
/**
* Get the current user ID
* @returns Promise resolving to the current user ID
*/
getUserId(): Promise<string>;
/**
* Symbol.dispose method for releasing resources
*/
[Symbol.dispose](): void;
}