UNPKG

@standard-crypto/farcaster-js-warpcast

Version:

A tool for interacting with the private APIs of the Warpcast client.

35 lines (34 loc) 1.49 kB
import { type AxiosInstance } from 'axios'; import { Conversation, ConversationDetails, ConversationMessage, DirectCastsApi, User, UsersApi } from './index.js'; import { Logger } from './logger.js'; export interface WarpcastAPIClientConfig { axiosInstance?: AxiosInstance; hubUrl?: string; logger?: Logger; } export declare const WARPCAST_API_URL = "https://client.warpcast.com"; export declare class WarpcastAPIClient { private readonly logger; readonly apis: { directCasts: DirectCastsApi; users: UsersApi; }; constructor(authToken: string, { axiosInstance, logger, }?: WarpcastAPIClientConfig); getCurrentUser(): Promise<User>; getUserByFid(fid: number): Promise<User>; listConversations(): AsyncGenerator<Conversation, void, undefined>; /** * Get the details of a conversation. * * Be aware that the `messages` field is paginated by the server. * To iterate through all messages, see `listConversationMessages`. * @param conversationId The ID of the conversation */ getConversationDetails(conversationId: string): Promise<ConversationDetails>; /** * Paginates through all messages of a given conversation. * The server will return messages in reverse-chronological order (most recent messages first). * @param conversationId The ID of the conversation */ listConversationMessages(conversationId: string): AsyncGenerator<ConversationMessage, void, undefined>; }