@neynar/nodejs-sdk
Version:
SDK to interact with Neynar APIs (https://docs.neynar.com/reference/quickstart)
1,084 lines (1,083 loc) • 191 kB
TypeScript
import { Logger } from "../common/logger";
import { AxiosError, AxiosInstance } from "axios";
import type { SetRequired } from "type-fest";
import { Configuration } from './configuration';
import type { AppHostGetEventEventEnum, AppHostGetEventResponse, AppHostPostEventResponse, AppHostUserStateResponse, AssociateDeployment200Response, AssociateDeploymentRequest, AuthorizationUrlResponse, BalanceResponse, BanListResponse, BanResponse, BestFriendsResponse, BlockListResponse, BuildRequest, BulkCastsResponse, BulkFollowResponse, BulkUsersByAddressResponse, BulkUsersResponse, CastEmbedCrawlResponse, CastResponse, CastsMetricsResponse, CastsResponse, CastsSearchResponse, ChannelListResponse, ChannelMemberInviteListResponse, ChannelMemberListResponse, ChannelMemberRole, ChannelResponse, ChannelResponseBulk, ChannelSearchResponse, Conversation, ConversationSummary, CreateDeploymentRequest, CreateX402Signature200Response, CreateX402SignatureRequest, DeleteDeployment200Response, DeleteDeploymentRequest, DeployFungibleFactoryEnum, DeployFungibleMetadataNsfwEnum, DeployFungibleNetworkEnum, DeployFungibleResponse, DeployToVercel200Response, DeployToVercelRequest, DeveloperManagedSigner, ErrorRes, FarcasterActionReqBodyAction, FeedResponse, FetchAllNotificationsTypeEnum, FetchAuthorizationUrlResponseTypeEnum, FetchBulkCastsSortTypeEnum, FetchBulkChannelsTypeEnum, FetchBulkUsersByEthOrSolAddressAddressTypesEnum, FetchCastMetricsIntervalEnum, FetchCastQuotes200Response, FetchCastQuotesTypeEnum, FetchCastReactionsTypesEnum, FetchFeedEmbedTypesEnum, FetchFeedFeedTypeEnum, FetchFeedFilterTypeEnum, FetchFeedForYouProviderEnum, FetchFrameCatalogCategoriesEnum, FetchFrameCatalogNetworksEnum, FetchFrameCatalogTimeWindowEnum, FetchFungibleTrades200Response, FetchFungibleTradesNetworkEnum, FetchFungibleTradesTimeWindowEnum, FetchRelevantFrames200Response, FetchRelevantFramesNetworksEnum, FetchRelevantFramesTimeWindowEnum, FetchRelevantFungibleOwnersNetworkEnum, FetchRepliesAndRecastsForUserFilterEnum, FetchSubscribedToForFidSubscriptionProviderEnum, FetchSubscribersForFidSubscriptionProviderEnum, FetchSubscriptionsForFidSubscriptionProviderEnum, FetchTrendingChannelsTimeWindowEnum, FetchTrendingFeedProviderEnum, FetchTrendingFeedTimeWindowEnum, FetchTrendingFungibles200Response, FetchTrendingFungiblesNetworkEnum, FetchTrendingFungiblesTimeWindowEnum, FetchUserBalanceNetworksEnum, FetchUserFollowersSortTypeEnum, FetchUserFollowingSortTypeEnum, FetchUserInteractions200Response, FetchUserInteractionsTypeEnum, FetchUserReactionsTypeEnum, FetchUserReciprocalFollowers200Response, FetchUserReciprocalFollowersSortTypeEnum, FetchVerifications200Response, FnameAvailabilityResponse, FollowersResponse, FrameCatalogResponse, FrameNotificationTokens, FramePayTransactionReqBodyTransaction, FungiblesResponseSchema, GetConversationMessages200Response, GetDeploymentFile200Response, GetDevStatus200Response, GetNotificationCampaignStats200Response, ListConversations200Response, ListDeploymentFiles200Response, ListDeployments200ResponseInner, LookupCastByHashOrUrlTypeEnum, LookupCastConversationFoldEnum, LookupCastConversationSortTypeEnum, LookupCastConversationTypeEnum, LookupChannelTypeEnum, MintNft200Response, MintNftRequest, MuteListResponse, MuteResponse, NonceResponse, NotificationType, NotificationsResponse, OperationResponse, PostCastReqBodyEmbeds, PostCastResponse, PromptDeploymentStreamRequest, ReactionType, ReactionsCastResponse, ReactionsResponse, RegisterSignedKeyForDeveloperManagedAuthAddress200Response, RegisterUserOnChainReqBodyPreRegistrationCallsInner, RegisterUserOnChainReqBodyRegistration, RegisterUserOnChainReqBodySignersInner, RegisterUserOnChainResponse, RegisterUserReqBodyMetadata, RegisterUserReqBodySigner, RegisterUserResponse, RelevantFollowersResponse, RelevantFungibleOwnersResponse, SearchCastsModeEnum, SearchCastsSortTypeEnum, SearchFramesNetworksEnum, SendFrameNotificationsReqBodyFilters, SendFrameNotificationsReqBodyNotification, SendFrameNotificationsResponse, SignedKeyRequestSponsor, Signer, SignerListResponse, SimulateNftMintNetworkEnum, SimulateNftMintResponse, StartApp200Response, StartAppRequest, StorageAllocationsResponse, StorageUsageResponse, SubscribedToResponse, SubscribersResponse, SubscriptionCheckResponse, SubscriptionsResponse, TransactionFrameConfig, TransactionFrameResponse, TransactionSendFungiblesRecipient, TransactionSendFungiblesReqBodyNetworkEnum, TransactionSendFungiblesResponse, TrendingChannelResponse, TrendingTopicsResponse, UpdateUserReqBodyLocation, UpdateUserReqBodyVerifiedAccounts, UploadImage200Response, UploadImageUrlRequest, UserFIDResponse, UserResponse, UserSearchResponse, UsersActiveChannelsResponse, UsersResponse, VercelDeploymentLogs200Response, VercelDeploymentStatus200Response, VerificationChainId, VerificationType, WebhookListResponse, WebhookPatchReqBodyActiveEnum, WebhookResponse, WebhookSubscriptionFilters } from '../api';
export interface NeynarAPIClientOptions {
logger?: Logger;
axiosInstance?: AxiosInstance;
}
export declare class NeynarAPIClient {
private readonly logger;
private config;
private readonly apis;
constructor(config: Configuration, options?: NeynarAPIClientOptions);
static isApiErrorResponse(error: any): error is SetRequired<AxiosError<ErrorRes>, "response">;
/**
* Securely communicate and perform actions on behalf of users across different apps. It enables an app to send data or trigger actions in another app on behalf of a mutual user by signing messages using the user\'s Farcaster signer.
*
* @summary User actions across apps
*
* @param {object} params
* @param {string} params.signerUuid - The signer_uuid of the user on behalf of whom the action is being performed.
* @param {string} params.baseUrl - The base URL of the app on which the action is being performed.
* @param {FarcasterActionReqBodyAction} params.action
*
* @returns {Promise<{ [key: string]: any; }>} A promise that resolves to a `{ [key: string]: any; }` object.
*
* @example
*
* // Fill in the appropriate values
* const signerUuid =
* const baseUrl =
* const action =
*
* client.publishFarcasterAction({signerUuid, baseUrl, action}).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/publish-farcaster-action)
*
*/
publishFarcasterAction(params: {
signerUuid: string;
baseUrl: string;
action: FarcasterActionReqBodyAction;
}): Promise<{
[key: string]: any;
}>;
/**
* Creates a new transaction pay mini app that can be used to collect payments through a mini app
*
* @summary Create transaction pay mini app
*
* @param {object} params
* @param {FramePayTransactionReqBodyTransaction} params.transaction
* @param {TransactionFrameConfig} params.config
* @param {string} params.idem [optional] - An Idempotency key is a unique identifier for the request. **Note:** 1) This is used to prevent duplicate requests. Use the same idem key on retry attempts. 2) This should be a unique identifier for each request. 3) Recommended format is a 16-character string generated by the developer at the time of making this request.
*
* @returns {Promise<TransactionFrameResponse>} A promise that resolves to a `TransactionFrameResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const transaction =
* const config =
* const idem =
*
* client.createTransactionPayFrame({transaction, config, idem}).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/create-transaction-pay-frame)
*
*/
createTransactionPayFrame(params: {
transaction: FramePayTransactionReqBodyTransaction;
config: TransactionFrameConfig;
idem?: string;
}): Promise<TransactionFrameResponse>;
/**
* Returns a list of interactions between two users
*
* @summary User interactions
*
* @param {object} params
* @param {number[]} params.fids - Comma separated list of two FIDs
* @param {Array<FetchUserInteractionsTypeEnum>} params.type [optional] - Comma seperated list of Interaction type to fetch
*
* @returns {Promise<FetchUserInteractions200Response>} A promise that resolves to a `FetchUserInteractions200Response` object.
*
* @example
*
* // Fill in the appropriate values
* const fids =
* const type =
*
* client.fetchUserInteractions({ fids, type }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-interactions)
*
*/
fetchUserInteractions(params: {
fids: number[];
type?: Array<FetchUserInteractionsTypeEnum>;
}): Promise<FetchUserInteractions200Response>;
/**
* Generates a summary of all casts related to a conversation surrounding a cast by passing in a cast hash or Farcaster URL. Summary is generated by an LLM and is intended to be passed as a context to AI agents.
*
* @summary Cast conversation summary
*
* @param {object} params
* @param {string} params.identifier - Cast identifier (It's either a URL or a hash))
* @param {number} params.limit [optional] - Number of casts to consider in a summary up to a point of target cast (Default: 20, Maximum: 50)
* @param {string} params.prompt [optional] - Additional prompt used to generate a summary
*
* @returns {Promise<ConversationSummary>} A promise that resolves to a `ConversationSummary` object.
*
* @example
*
* // Fill in the appropriate values
* const identifier =
* const limit =
* const prompt =
*
* client.lookupCastConversationSummary({ identifier, limit, prompt }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-cast-conversation-summary)
*
*/
lookupCastConversationSummary(params: {
identifier: string;
limit?: number;
prompt?: string;
}): Promise<ConversationSummary>;
/**
* Returns event object for app host events. Used if the app host intends to sign the event message instead of using Neynar-hosted signers.
*
* @summary Generate event
*
* @param {object} params
* @param {string} params.appDomain - The domain of the mini app
* @param {number} params.fid - The FID of the user who initiated the event
* @param {AppHostGetEventEventEnum} params.event - The type of event
*
* @returns {Promise<AppHostGetEventResponse>} A promise that resolves to a `AppHostGetEventResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const appDomain =
* const fid =
* const event =
*
* client.appHostGetEvent({ appDomain, fid, event }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/app-host-get-event)
*
*/
appHostGetEvent(params: {
appDomain: string;
fid: number;
event: AppHostGetEventEventEnum;
}): Promise<AppHostGetEventResponse>;
/**
* Returns the current notification state for a specific user across all mini app domains in this app host. Shows which domains have notifications enabled.
*
* @summary Enabled notifications
*
* @param {object} params
* @param {number} params.fid - The FID of the user
*
* @returns {Promise<AppHostUserStateResponse>} A promise that resolves to a `AppHostUserStateResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const fid =
*
* client.appHostGetUserState({ fid }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/app-host-get-user-state)
*
*/
appHostGetUserState(params: {
fid: number;
}): Promise<AppHostUserStateResponse>;
/**
* Post an app_host event to the domain\'s webhook. Events such as enabling or disabling notifications for a user. Provide either a signed message or the signer UUID of an authorized neynar-hosted signers.
*
* @summary Send event
*
* @param {object} params
* @param {any} params.appHostPostEventReqBody
*
* @returns {Promise<AppHostPostEventResponse>} A promise that resolves to a `AppHostPostEventResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const appHostPostEventReqBody =
*
* client.appHostPostEvent({appHostPostEventReqBody}).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/app-host-post-event)
*
*/
appHostPostEvent(params: {
appHostPostEventReqBody: any;
}): Promise<AppHostPostEventResponse>;
/**
* Fetches the status of a developer managed auth address by auth address
*
* @summary Status by auth address
*
* @param {object} params
* @param {string} params.address - Ethereum address
*
* @returns {Promise<RegisterSignedKeyForDeveloperManagedAuthAddress200Response>} A promise that resolves to a `RegisterSignedKeyForDeveloperManagedAuthAddress200Response` object.
*
* @example
*
* // Fill in the appropriate values
* const address =
*
* client.lookupDeveloperManagedAuthAddress({ address }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-developer-managed-auth-address)
*
*/
lookupDeveloperManagedAuthAddress(params: {
address: string;
}): Promise<RegisterSignedKeyForDeveloperManagedAuthAddress200Response>;
/**
* Allow apps to register an Ethereum addresses as authorized \"auth addresses\" for a user\'s Farcaster account, enabling seamless Sign-In With Farcaster (SIWF) across applications without repeated custody wallet authorizations.
*
* @summary Register Signed Key
*
* @param {object} params
* @param {string} params.address - Ethereum address
* @param {number} params.appFid - The unique identifier of a farcaster user or app (unsigned integer)
* @param {number} params.deadline - unix timestamp in seconds that controls how long the signed key request is valid for. (24 hours from now is recommended)
* @param {string} params.signature - Signature generated by the custody address of the app. Signed data includes app_fid, deadline, 32 bytes padded auth address. [Refer guide for more details.](https://docs.neynar.com/docs/auth-address-signature-generation)
* @param {string} params.redirectUrl [optional] - Url to redirect to after the signer is approved. **Note** : This should only be used when requesting a signer from a native mobile application.
* @param {SignedKeyRequestSponsor} params.sponsor [optional]
*
* @returns {Promise<RegisterSignedKeyForDeveloperManagedAuthAddress200Response>} A promise that resolves to a `RegisterSignedKeyForDeveloperManagedAuthAddress200Response` object.
*
* @example
*
* // Fill in the appropriate values
* const address =
* const appFid =
* const deadline =
* const signature =
* const redirectUrl =
* const sponsor =
*
* client.registerSignedKeyForDeveloperManagedAuthAddress({address, appFid, deadline, signature, redirectUrl, sponsor}).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/register-signed-key-for-developer-managed-auth-address)
*
*/
registerSignedKeyForDeveloperManagedAuthAddress(params: {
address: string;
appFid: number;
deadline: number;
signature: string;
redirectUrl?: string;
sponsor?: SignedKeyRequestSponsor;
}): Promise<RegisterSignedKeyForDeveloperManagedAuthAddress200Response>;
/**
* Deletes a list of FIDs from the app associated with your API key.
*
* @summary Unban FIDs from app
*
* @param {object} params
* @param {Array<number>} params.fids
*
* @returns {Promise<BanResponse>} A promise that resolves to a `BanResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const fids =
*
* client.deleteBans({fids}).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/delete-bans)
*
*/
deleteBans(params: {
fids: Array<number>;
}): Promise<BanResponse>;
/**
* Fetches all FIDs that your app has banned.
*
* @summary Banned FIDs of app
*
* @param {object} params
* @param {number} params.limit [optional] - Number of results to fetch (Default: 20, Maximum: 100)
* @param {string} params.cursor [optional] - Pagination cursor.
*
* @returns {Promise<BanListResponse>} A promise that resolves to a `BanListResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const limit =
*
* client.fetchBanList({ limit }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-ban-list)
*
*/
fetchBanList(params: {
limit?: number;
cursor?: string;
}): Promise<BanListResponse>;
/**
* Bans a list of FIDs from the app associated with your API key. Banned users, their casts and reactions will not appear in feeds.
*
* @summary Ban FIDs from app
*
* @param {object} params
* @param {Array<number>} params.fids
*
* @returns {Promise<BanResponse>} A promise that resolves to a `BanResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const fids =
*
* client.publishBans({fids}).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/publish-bans)
*
*/
publishBans(params: {
fids: Array<number>;
}): Promise<BanResponse>;
/**
* Deletes a block for a given FID.
*
* @summary Unblock FID
*
* @param {object} params
* @param {string} params.signerUuid - UUID of the signer. `signer_uuid` is paired with API key, can't use a `uuid` made with a different API key.
* @param {number} params.blockedFid - The unique identifier of a farcaster user or app (unsigned integer)
*
* @returns {Promise<OperationResponse>} A promise that resolves to a `OperationResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const signerUuid =
* const blockedFid =
*
* client.deleteBlock({signerUuid, blockedFid}).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/delete-block)
*
*/
deleteBlock(params: {
signerUuid: string;
blockedFid: number;
}): Promise<OperationResponse>;
/**
* Fetches all FIDs that a user has blocked or has been blocked by
*
* @summary Blocked / Blocked by FIDs
*
* @param {object} params
* @param {number} params.blockerFid [optional] - Providing this will return the users that this user has blocked
* @param {number} params.blockedFid [optional] - Providing this will return the users that have blocked this user
* @param {number} params.limit [optional] - Number of results to fetch (Default: 20, Maximum: 100)
* @param {string} params.cursor [optional] - Pagination cursor.
*
* @returns {Promise<BlockListResponse>} A promise that resolves to a `BlockListResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const blockerFid =
* const blockedFid =
* const limit =
*
* client.fetchBlockList({ blockerFid, blockedFid, limit }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-block-list)
*
*/
fetchBlockList(params: {
blockerFid?: number;
blockedFid?: number;
limit?: number;
cursor?: string;
}): Promise<BlockListResponse>;
/**
* Adds a block for a given FID.
*
* @summary Block FID
*
* @param {object} params
* @param {string} params.signerUuid - UUID of the signer. `signer_uuid` is paired with API key, can't use a `uuid` made with a different API key.
* @param {number} params.blockedFid - The unique identifier of a farcaster user or app (unsigned integer)
*
* @returns {Promise<OperationResponse>} A promise that resolves to a `OperationResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const signerUuid =
* const blockedFid =
*
* client.publishBlock({signerUuid, blockedFid}).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/publish-block)
*
*/
publishBlock(params: {
signerUuid: string;
blockedFid: number;
}): Promise<OperationResponse>;
/**
* Delete an existing cast. (In order to delete a cast `signer_uuid` must be approved)
*
* @summary Delete a cast
*
* @param {object} params
* @param {string} params.signerUuid - UUID of the signer. `signer_uuid` is paired with API key, can't use a `uuid` made with a different API key.
* @param {string} params.targetHash
*
* @returns {Promise<OperationResponse>} A promise that resolves to a `OperationResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const signerUuid =
* const targetHash =
*
* client.deleteCast({signerUuid, targetHash}).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/delete-cast)
*
*/
deleteCast(params: {
signerUuid: string;
targetHash: string;
}): Promise<OperationResponse>;
/**
* Fetch multiple casts using their respective hashes.
*
* @summary Bulk fetch casts
*
* @param {object} params
* @param {string[]} params.casts - Hashes of the cast to be retrived (Comma separated, no spaces)
* @param {number} params.viewerFid [optional] - adds viewer_context to cast object to show whether viewer has liked or recasted the cast.
* @param {FetchBulkCastsSortTypeEnum} params.sortType [optional] - Optional parameter to sort the casts based on different criteria
*
* @returns {Promise<CastsResponse>} A promise that resolves to a `CastsResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const casts =
* const viewerFid =
* const sortType =
*
* client.fetchBulkCasts({ casts, viewerFid, sortType }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-bulk-casts)
*
*/
fetchBulkCasts(params: {
casts: string[];
viewerFid?: number;
sortType?: FetchBulkCastsSortTypeEnum;
}): Promise<CastsResponse>;
/**
* Fetch casts that quote a given cast
*
* @summary Cast Quotes
*
* @param {object} params
* @param {string} params.identifier - Cast identifier (It's either a URL or a hash)
* @param {FetchCastQuotesTypeEnum} params.type - The query param accepted by the API. Sent along with identifier param. url - Cast identifier is a url hash - Cast identifier is a hash
* @param {number} params.viewerFid [optional]
* @param {number} params.limit [optional] - Number of results to fetch (Default: 25, Maximum: 100)
* @param {string} params.cursor [optional] - Pagination cursor.
*
* @returns {Promise<FetchCastQuotes200Response>} A promise that resolves to a `FetchCastQuotes200Response` object.
*
* @example
*
* // Fill in the appropriate values
* const identifier =
* const type =
* const viewerFid =
* const limit =
*
* client.fetchCastQuotes({ identifier, type, viewerFid, limit }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-cast-quotes)
*
*/
fetchCastQuotes(params: {
identifier: string;
type: FetchCastQuotesTypeEnum;
viewerFid?: number;
limit?: number;
cursor?: string;
}): Promise<FetchCastQuotes200Response>;
/**
* Crawls the given URL and returns metadata useful when embedding the URL in a cast.
*
* @summary Embedded URL metadata
*
* @param {object} params
* @param {string} params.url - URL to crawl metadata of
*
* @returns {Promise<CastEmbedCrawlResponse>} A promise that resolves to a `CastEmbedCrawlResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const url =
*
* client.fetchEmbeddedUrlMetadata({ url }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-embedded-url-metadata)
*
*/
fetchEmbeddedUrlMetadata(params: {
url: string;
}): Promise<CastEmbedCrawlResponse>;
/**
* Gets information about an individual cast by passing in a Farcaster web URL or cast hash
*
* @summary By hash or URL
*
* @param {object} params
* @param {string} params.identifier - Cast identifier (It's either a URL or a hash)
* @param {LookupCastByHashOrUrlTypeEnum} params.type - The query param accepted by the API. Sent along with identifier param. url - Cast identifier is a url hash - Cast identifier is a hash
* @param {number} params.viewerFid [optional] - adds viewer_context to cast object to show whether viewer has liked or recasted the cast.
*
* @returns {Promise<CastResponse>} A promise that resolves to a `CastResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const identifier =
* const type =
* const viewerFid =
*
* client.lookupCastByHashOrUrl({ identifier, type, viewerFid }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-cast-by-hash-or-url)
*
*/
lookupCastByHashOrUrl(params: {
identifier: string;
type: LookupCastByHashOrUrlTypeEnum;
viewerFid?: number;
}): Promise<CastResponse>;
/**
* Gets all casts related to a conversation surrounding a cast by passing in a cast hash or Farcaster URL. Includes all the ancestors of a cast up to the root parent in a chronological order. Includes all direct_replies to the cast up to the reply_depth specified in the query parameter.
*
* @summary Conversation for a cast
*
* @param {object} params
* @param {string} params.identifier - Cast identifier (It's either a URL or a hash)
* @param {LookupCastConversationTypeEnum} params.type - The query param accepted by the API. Sent along with identifier param. url - Cast identifier is a url hash - Cast identifier is a hash
* @param {number | null} params.replyDepth [optional] - The depth of replies in the conversation that will be returned (default 2)
* @param {boolean | null} params.includeChronologicalParentCasts [optional] - Include all parent casts in chronological order
* @param {number} params.viewerFid [optional] - Providing this will return a conversation that respects this user's mutes and blocks and includes `viewer_context`.
* @param {LookupCastConversationSortTypeEnum} params.sortType [optional] - Sort type for the ordering of descendants. Default is `chron`
* @param {LookupCastConversationFoldEnum} params.fold [optional] - Show conversation above or below the fold. Lower quality responses are hidden below the fold. Not passing in a value shows the full conversation without any folding.
* @param {number} params.limit [optional] - Number of results to fetch (Default: 20, Maximum: 50)
* @param {string} params.cursor [optional] - Pagination cursor.
*
* @returns {Promise<Conversation>} A promise that resolves to a `Conversation` object.
*
* @example
*
* // Fill in the appropriate values
* const identifier =
* const type =
* const replyDepth =
* const includeChronologicalParentCasts =
* const viewerFid =
* const sortType =
* const fold =
* const limit =
*
* client.lookupCastConversation({ identifier, type, replyDepth, includeChronologicalParentCasts, viewerFid, sortType, fold, limit }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-cast-conversation)
*
*/
lookupCastConversation(params: {
identifier: string;
type: LookupCastConversationTypeEnum;
replyDepth?: number | null;
includeChronologicalParentCasts?: boolean | null;
viewerFid?: number;
sortType?: LookupCastConversationSortTypeEnum;
fold?: LookupCastConversationFoldEnum;
limit?: number;
cursor?: string;
}): Promise<Conversation>;
/**
* Posts a cast or cast reply. Works with mentions and embeds. (In order to post a cast `signer_uuid` must be approved)
*
* @summary Post a cast
*
* @param {object} params
* @param {string} params.signerUuid - UUID of the signer. `signer_uuid` is paired with API key, can't use a `uuid` made with a different API key.
* @param {string} params.text [optional]
* @param {Array<PostCastReqBodyEmbeds>} params.embeds [optional]
* @param {string} params.parent [optional] - parent_url of the channel the cast is in, or hash of the cast
* @param {string} params.channelId [optional] - Channel ID of the channel where the cast is to be posted. e.g. neynar, farcaster, warpcast
* @param {string} params.idem [optional] - An Idempotency key is a unique identifier for the request. **Note:** 1) This is used to prevent duplicate requests. Use the same idem key on retry attempts. 2) This should be a unique identifier for each request. 3) Recommended format is a 16-character string generated by the developer at the time of making this request.
* @param {number} params.parentAuthorFid [optional] - The unique identifier of a farcaster user or app (unsigned integer)
*
* @returns {Promise<PostCastResponse>} A promise that resolves to a `PostCastResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const signerUuid =
* const text =
* const embeds =
* const parent =
* const channelId =
* const idem =
* const parentAuthorFid =
*
* client.publishCast({signerUuid, text, embeds, parent, channelId, idem, parentAuthorFid}).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/publish-cast)
*
*/
publishCast(params: {
signerUuid: string;
text?: string;
embeds?: Array<PostCastReqBodyEmbeds>;
parent?: string;
channelId?: string;
idem?: string;
parentAuthorFid?: number;
}): Promise<PostCastResponse>;
/**
* Search for casts based on a query string, with optional AND filters
*
* @summary Search for casts
*
* @param {object} params
* @param {string} params.q - Query string to search for casts. Supported operators: | Operator | Description | | --------- | -------------------------------------------------------------------------------------------------------- | | `+` | Acts as the AND operator. This is the default operator between terms and can usually be omitted. | | `|` | Acts as the OR operator. | | `*` | When used at the end of a term, signifies a prefix query. | | `"` | Wraps several terms into a phrase (for example, `"star wars"`). | | `(`, `)` | Wrap a clause for precedence (for example, `star + (wars | trek)`). | | `~n` | When used after a term (for example, `satr~3`), sets `fuzziness`. When used after a phrase, sets `slop`. | | `-` | Negates the term. | | `before:` | Search for casts before a specific date. (e.g. `before:2025-04-20` or `before:2025-04-20T23:59:59`) | | `after:` | Search for casts after a specific date. (e.g. `after:2025-04-20` or `after:2025-04-20T00:00:00`) |
* @param {SearchCastsModeEnum} params.mode [optional] - Choices are: - `literal` - Searches for the words in the query string (default) - `semantic` - Searches for the meaning of the query string - `hybrid` - Combines both literal and semantic results
* @param {SearchCastsSortTypeEnum} params.sortType [optional] - Choices are: - `desc_chron` - All casts sorted by time in a descending order (default) - `chron` - All casts sorted by time in ascending order - `algorithmic` - Casts sorted by engagement and time
* @param {number} params.authorFid [optional] - Fid of the user whose casts you want to search
* @param {number} params.viewerFid [optional] - Providing this will return search results that respects this user's mutes and blocks and includes `viewer_context`.
* @param {string} params.parentUrl [optional] - Parent URL of the casts you want to search
* @param {string} params.channelId [optional] - Channel ID of the casts you want to search
* @param {number} params.limit [optional] - Number of results to fetch (Default: 25, Maximum: 100)
* @param {string} params.cursor [optional] - Pagination cursor
*
* @returns {Promise<CastsSearchResponse>} A promise that resolves to a `CastsSearchResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const q =
* const mode =
* const sortType =
* const authorFid =
* const viewerFid =
* const parentUrl =
* const channelId =
* const limit =
*
* client.searchCasts({ q, mode, sortType, authorFid, viewerFid, parentUrl, channelId, limit }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/search-casts)
*
*/
searchCasts(params: {
q: string;
mode?: SearchCastsModeEnum;
sortType?: SearchCastsSortTypeEnum;
authorFid?: number;
viewerFid?: number;
parentUrl?: string;
channelId?: string;
limit?: number;
cursor?: string;
}): Promise<CastsSearchResponse>;
/**
* Returns a list of all channels with their details
*
* @summary Fetch all channels with their details
*
* @param {object} params
* @param {number} params.limit [optional] - Number of results to fetch (Default: 20, Maximum: 200)
* @param {string} params.cursor [optional] - Pagination cursor.
*
* @returns {Promise<ChannelListResponse>} A promise that resolves to a `ChannelListResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const limit =
*
* client.fetchAllChannels({ limit }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-all-channels)
*
*/
fetchAllChannels(params: {
limit?: number;
cursor?: string;
}): Promise<ChannelListResponse>;
/**
* Returns details of multiple channels
*
* @summary Bulk fetch
*
* @param {object} params
* @param {string[]} params.ids - Comma separated list of channel IDs or parent_urls, up to 100 at a time
* @param {FetchBulkChannelsTypeEnum} params.type [optional] - Type of identifier being used to query the channels. Defaults to ID.
* @param {number} params.viewerFid [optional] - FID of the user viewing the channels.
*
* @returns {Promise<ChannelResponseBulk>} A promise that resolves to a `ChannelResponseBulk` object.
*
* @example
*
* // Fill in the appropriate values
* const ids =
* const type =
* const viewerFid =
*
* client.fetchBulkChannels({ ids, type, viewerFid }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-bulk-channels)
*
*/
fetchBulkChannels(params: {
ids: string[];
type?: FetchBulkChannelsTypeEnum;
viewerFid?: number;
}): Promise<ChannelResponseBulk>;
/**
* Fetch a list of invites, either in a channel or for a user. If both are provided, open channel invite for that user is returned.
*
* @summary Open invites
*
* @param {object} params
* @param {string} params.channelId [optional] - Channel ID for the channel being queried
* @param {number} params.invitedFid [optional] - FID of the user being invited
* @param {number} params.limit [optional] - Number of results to fetch (Default: 20, Maximum: 100)
* @param {string} params.cursor [optional] - Pagination cursor.
*
* @returns {Promise<ChannelMemberInviteListResponse>} A promise that resolves to a `ChannelMemberInviteListResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const channelId =
* const invitedFid =
* const limit =
*
* client.fetchChannelInvites({ channelId, invitedFid, limit }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-channel-invites)
*
*/
fetchChannelInvites(params: {
channelId?: string;
invitedFid?: number;
limit?: number;
cursor?: string;
}): Promise<ChannelMemberInviteListResponse>;
/**
* Fetch a list of members in a channel
*
* @summary Fetch members
*
* @param {object} params
* @param {string} params.channelId - Channel ID for the channel being queried
* @param {number} params.fid [optional] - FID of the user being queried. Specify this to check if a user is a member of the channel without paginating through all members.
* @param {number} params.limit [optional] - Number of results to fetch (Default: 20, Maximum: 100)
* @param {string} params.cursor [optional] - Pagination cursor.
*
* @returns {Promise<ChannelMemberListResponse>} A promise that resolves to a `ChannelMemberListResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const channelId =
* const fid =
* const limit =
*
* client.fetchChannelMembers({ channelId, fid, limit }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-channel-members)
*
*/
fetchChannelMembers(params: {
channelId: string;
fid?: number;
limit?: number;
cursor?: string;
}): Promise<ChannelMemberListResponse>;
/**
* Returns a list of followers for a specific channel. Max limit is 1000. Use cursor for pagination.
*
* @summary For channel
*
* @param {object} params
* @param {string} params.id - Channel ID for the channel being queried
* @param {number} params.viewerFid [optional] - Providing this will return a list of followers that respects this user's mutes and blocks and includes `viewer_context`.
* @param {string} params.cursor [optional] - Pagination cursor.
* @param {number} params.limit [optional] - Number of followers to fetch (Default: 25, Maximum: 1000)
*
* @returns {Promise<UsersResponse>} A promise that resolves to a `UsersResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const id =
* const viewerFid =
* const limit =
*
* client.fetchFollowersForAChannel({ id, viewerFid, limit }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-followers-for-a-channel)
*
*/
fetchFollowersForAChannel(params: {
id: string;
viewerFid?: number;
cursor?: string;
limit?: number;
}): Promise<UsersResponse>;
/**
* Returns a list of relevant channel followers for a specific FID. This usually shows on a channel as \"X, Y, Z follow this channel\".
*
* @summary Relevant followers
*
* @param {object} params
* @param {string} params.id - Channel ID being queried
* @param {number} params.viewerFid - The FID of the user to customize this response for. Providing this will also return a list of followers that respects this user's mutes and blocks and includes `viewer_context`.
*
* @returns {Promise<RelevantFollowersResponse>} A promise that resolves to a `RelevantFollowersResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const id =
* const viewerFid =
*
* client.fetchRelevantFollowersForAChannel({ id, viewerFid }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-relevant-followers-for-a-channel)
*
*/
fetchRelevantFollowersForAChannel(params: {
id: string;
viewerFid: number;
}): Promise<RelevantFollowersResponse>;
/**
* Returns a list of trending channels based on activity
*
* @summary Channels by activity
*
* @param {object} params
* @param {FetchTrendingChannelsTimeWindowEnum} params.timeWindow [optional]
* @param {number} params.limit [optional] - Number of results to fetch (Default: 10, Maximum: 25)
* @param {string} params.cursor [optional] - Pagination cursor.
*
* @returns {Promise<TrendingChannelResponse>} A promise that resolves to a `TrendingChannelResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const timeWindow =
* const limit =
*
* client.fetchTrendingChannels({ timeWindow, limit }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-trending-channels)
*
*/
fetchTrendingChannels(params: {
timeWindow?: FetchTrendingChannelsTimeWindowEnum;
limit?: number;
cursor?: string;
}): Promise<TrendingChannelResponse>;
/**
* Returns a list of all channels with their details that an FID is a member of. Data may have a delay of up to 1 hour.
*
* @summary Member of
*
* @param {object} params
* @param {number} params.fid - The FID of the user.
* @param {number} params.limit [optional] - Number of results to fetch (Default: 20, Maximum: 100)
* @param {string} params.cursor [optional] - Pagination cursor.
*
* @returns {Promise<ChannelMemberListResponse>} A promise that resolves to a `ChannelMemberListResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const fid =
* const limit =
*
* client.fetchUserChannelMemberships({ fid, limit }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-channel-memberships)
*
*/
fetchUserChannelMemberships(params: {
fid: number;
limit?: number;
cursor?: string;
}): Promise<ChannelMemberListResponse>;
/**
* Returns a list of all channels with their details that a FID follows.
*
* @summary Following
*
* @param {object} params
* @param {number} params.fid - The FID of the user.
* @param {number} params.limit [optional] - Number of results to fetch (Default: 25, Maximum: 100)
* @param {string} params.cursor [optional] - Pagination cursor.
*
* @returns {Promise<ChannelListResponse>} A promise that resolves to a `ChannelListResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const fid =
* const limit =
*
* client.fetchUserChannels({ fid, limit }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-channels)
*
*/
fetchUserChannels(params: {
fid: number;
limit?: number;
cursor?: string;
}): Promise<ChannelListResponse>;
/**
* Fetches all channels that a user has casted in, in reverse chronological order.
*
* @summary Fetch channels that user is active in
*
* @param {object} params
* @param {number} params.fid - The user's FID (identifier)
* @param {number} params.limit [optional] - Number of results to fetch (Default: 20, Maximum: 100)
* @param {string} params.cursor [optional] - Pagination cursor.
*
* @returns {Promise<UsersActiveChannelsResponse>} A promise that resolves to a `UsersActiveChannelsResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const fid =
* const limit =
*
* client.fetchUsersActiveChannels({ fid, limit }).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-users-active-channels)
*
*/
fetchUsersActiveChannels(params: {
fid: number;
limit?: number;
cursor?: string;
}): Promise<UsersActiveChannelsResponse>;
/**
* Follow a channel
*
* @summary Follow a channel
*
* @param {object} params
* @param {string} params.signerUuid - UUID of the signer. `signer_uuid` is paired with API key, can't use a `uuid` made with a different API key.
* @param {string} params.channelId - The unique identifier of a farcaster channel
*
* @returns {Promise<OperationResponse>} A promise that resolves to a `OperationResponse` object.
*
* @example
*
* // Fill in the appropriate values
* const signerUuid =
* const channelId =
*
* client.followChannel({signerUuid, channelId}).then(response => {
* console.log('response:', response);
* });
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/follow-channel)
*
*/
followChannel(params: {
signerUuid: string;
channelId: string;
}): Promise<OperationResponse>;
/**
* Invite a user to a channel
*
* @summary Invite
*
* @param {object} params
* @param {string} params.signerUuid - UUID of the signer. `signer_uuid` is paired with API key, can't use a `uuid` made with a different API key.
* @param {string} params.channelId - The unique identifier of a farcaster channel
* @param {number} params.fid - The unique identifier of a farcaster user or app (unsigned integer)
* @param {ChannelMemberRole} params.role