@neynar/nodejs-sdk
Version:
SDK to interact with Neynar APIs (https://docs.neynar.com/reference/quickstart)
758 lines • 85.8 kB
JavaScript
"use strict";
/* tslint:disable */
/* eslint-disable */
/**
* Neynar API
* The Neynar API allows you to interact with the Farcaster protocol among other things. See the [Neynar docs](https://docs.neynar.com/reference) for more details.
*
* The version of the OpenAPI document: 3.34.0
* Contact: team@neynar.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FetchTrendingFeedProviderEnum = exports.FetchTrendingFeedTimeWindowEnum = exports.FetchRepliesAndRecastsForUserFilterEnum = exports.FetchFeedForYouProviderEnum = exports.FetchFeedEmbedTypesEnum = exports.FetchFeedFilterTypeEnum = exports.FetchFeedFeedTypeEnum = exports.FeedApi = exports.FeedApiFactory = exports.FeedApiFp = exports.FeedApiAxiosParamCreator = void 0;
const axios_1 = __importDefault(require("axios"));
// Some imports not used depending on template conditions
// @ts-ignore
const common_1 = require("../common");
// @ts-ignore
const base_1 = require("../base");
/**
* FeedApi - axios parameter creator
* @export
*/
const FeedApiAxiosParamCreator = function (configuration) {
return {
/**
* Fetch casts for a given user FID in reverse chronological order. Also allows filtering by parent_url and channel
* @summary Chronologically
* @param {number} fid FID of user whose recent casts you want to fetch
* @param {boolean} [xNeynarExperimental] Enables experimental features including filtering based on the Neynar score. See [docs](https://neynar.notion.site/Experimental-Features-1d2655195a8b80eb98b4d4ae7b76ae4a) for more details.
* @param {number} [appFid] Optionally filter to casts created via a specific app FID, e.g. 9152 for Warpcast
* @param {number} [viewerFid] FID of the user viewing the feed
* @param {number} [limit] Number of results to fetch (Default: 25, Maximum: 150)
* @param {string} [cursor] Pagination cursor
* @param {boolean | null} [includeReplies] Include reply casts by the author in the response, true by default
* @param {string} [parentUrl] Parent URL to filter the feed; mutually exclusive with channel_id
* @param {string} [channelId] Channel ID to filter the feed; mutually exclusive with parent_url
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FeedResponse>} A promise that resolves to a `FeedResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-casts-for-user)
*
*/
fetchCastsForUser: async (fid, xNeynarExperimental, appFid, viewerFid, limit, cursor, includeReplies, parentUrl, channelId, options = {}) => {
// verify required parameter 'fid' is not null or undefined
(0, common_1.assertParamExists)('fetchCastsForUser', 'fid', fid);
const localVarPath = `/v2/farcaster/feed/user/casts/`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication ApiKeyAuth required
await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "x-api-key", configuration);
if (fid !== undefined) {
localVarQueryParameter['fid'] = fid;
}
if (appFid !== undefined) {
localVarQueryParameter['app_fid'] = appFid;
}
if (viewerFid !== undefined) {
localVarQueryParameter['viewer_fid'] = viewerFid;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
if (includeReplies !== undefined) {
localVarQueryParameter['include_replies'] = includeReplies;
}
if (parentUrl !== undefined) {
localVarQueryParameter['parent_url'] = parentUrl;
}
if (channelId !== undefined) {
localVarQueryParameter['channel_id'] = channelId;
}
if (xNeynarExperimental != null) {
localVarHeaderParameter['x-neynar-experimental'] = typeof xNeynarExperimental === 'string'
? xNeynarExperimental
: JSON.stringify(xNeynarExperimental);
}
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Fetch casts based on filters. Ensure setting the correct parameters based on the feed_type and filter_type.
* @summary By filters
* @param {boolean} [xNeynarExperimental] Enables experimental features including filtering based on the Neynar score. See [docs](https://neynar.notion.site/Experimental-Features-1d2655195a8b80eb98b4d4ae7b76ae4a) for more details.
* @param {FetchFeedFeedTypeEnum} [feedType] Defaults to following (requires FID or address). If set to filter (requires filter_type)
* @param {FetchFeedFilterTypeEnum} [filterType] Used when feed_type=filter. Can be set to FIDs (requires FIDs) or parent_url (requires parent_url) or channel_id (requires channel_id)
* @param {number} [fid] (Optional) FID of user whose feed you want to create. By default, the API expects this field, except if you pass a filter_type
* @param {string} [fids] Used when filter_type=FIDs . Create a feed based on a list of FIDs. Max array size is 100. Requires feed_type and filter_type.
* @param {string} [parentUrl] Used when filter_type=parent_url can be used to fetch content under any parent url e.g. FIP-2 channels on Warpcast. Requires feed_type and filter_type.
* @param {string} [channelId] Used when filter_type=channel_id can be used to fetch casts under a channel. Requires feed_type and filter_type.
* @param {boolean | null} [membersOnly] Used when filter_type=channel_id. Only include casts from members of the channel. True by default.
* @param {string} [embedUrl] Used when filter_type=embed_url. Casts with embedded URLs prefixed by this embed_url param will be returned. We normalize your given URL prefix and prepend \'https://\' if no protocol is included. Requires feed_type and filter_type.
* @param {Array<FetchFeedEmbedTypesEnum>} [embedTypes] Used when filter_type=embed_types can be used to fetch all casts with matching content types. Requires feed_type and filter_type.
* @param {boolean | null} [withRecasts] Include recasts in the response, true by default
* @param {number} [limit] Number of results to fetch (Default: 25, Maximum: 100)
* @param {string} [cursor] Pagination cursor.
* @param {number} [viewerFid] Providing this will return a feed that respects this user\'s mutes and blocks and includes `viewer_context`.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FeedResponse>} A promise that resolves to a `FeedResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-feed)
*
*/
fetchFeed: async (xNeynarExperimental, feedType, filterType, fid, fids, parentUrl, channelId, membersOnly, embedUrl, embedTypes, withRecasts, limit, cursor, viewerFid, options = {}) => {
const localVarPath = `/v2/farcaster/feed/`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication ApiKeyAuth required
await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "x-api-key", configuration);
if (feedType !== undefined) {
localVarQueryParameter['feed_type'] = feedType;
}
if (filterType !== undefined) {
localVarQueryParameter['filter_type'] = filterType;
}
if (fid !== undefined) {
localVarQueryParameter['fid'] = fid;
}
if (fids !== undefined) {
localVarQueryParameter['fids'] = fids;
}
if (parentUrl !== undefined) {
localVarQueryParameter['parent_url'] = parentUrl;
}
if (channelId !== undefined) {
localVarQueryParameter['channel_id'] = channelId;
}
if (membersOnly !== undefined) {
localVarQueryParameter['members_only'] = membersOnly;
}
if (embedUrl !== undefined) {
localVarQueryParameter['embed_url'] = embedUrl;
}
if (embedTypes) {
localVarQueryParameter['embed_types'] = embedTypes;
}
if (withRecasts !== undefined) {
localVarQueryParameter['with_recasts'] = withRecasts;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
if (viewerFid !== undefined) {
localVarQueryParameter['viewer_fid'] = viewerFid;
}
if (xNeynarExperimental != null) {
localVarHeaderParameter['x-neynar-experimental'] = typeof xNeynarExperimental === 'string'
? xNeynarExperimental
: JSON.stringify(xNeynarExperimental);
}
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Fetch feed based on channel IDs
* @summary By channel IDs
* @param {string} channelIds Comma separated list of up to 10 channel IDs e.g. neynar,farcaster
* @param {boolean} [xNeynarExperimental] Enables experimental features including filtering based on the Neynar score. See [docs](https://neynar.notion.site/Experimental-Features-1d2655195a8b80eb98b4d4ae7b76ae4a) for more details.
* @param {boolean | null} [withRecasts] Include recasts in the response, true by default
* @param {number} [viewerFid] Providing this will return a feed that respects this user\'s mutes and blocks and includes `viewer_context`.
* @param {boolean | null} [withReplies] Include replies in the response, false by default
* @param {boolean | null} [membersOnly] Used when filter_type=channel_id. Only include casts from members of the channel. True by default.
* @param {string} [fids] Comma separated list of FIDs to filter the feed by, up to 10 at a time
* @param {number} [limit] Number of results to fetch (Default: 25, Maximum: 100)
* @param {string} [cursor] Pagination cursor.
* @param {boolean | null} [shouldModerate] If true, only casts that have been liked by the moderator (if one exists) will be returned.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FeedResponse>} A promise that resolves to a `FeedResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-feed-by-channel-ids)
*
*/
fetchFeedByChannelIds: async (channelIds, xNeynarExperimental, withRecasts, viewerFid, withReplies, membersOnly, fids, limit, cursor, shouldModerate, options = {}) => {
// verify required parameter 'channelIds' is not null or undefined
(0, common_1.assertParamExists)('fetchFeedByChannelIds', 'channelIds', channelIds);
const localVarPath = `/v2/farcaster/feed/channels/`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication ApiKeyAuth required
await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "x-api-key", configuration);
if (channelIds !== undefined) {
localVarQueryParameter['channel_ids'] = channelIds;
}
if (withRecasts !== undefined) {
localVarQueryParameter['with_recasts'] = withRecasts;
}
if (viewerFid !== undefined) {
localVarQueryParameter['viewer_fid'] = viewerFid;
}
if (withReplies !== undefined) {
localVarQueryParameter['with_replies'] = withReplies;
}
if (membersOnly !== undefined) {
localVarQueryParameter['members_only'] = membersOnly;
}
if (fids !== undefined) {
localVarQueryParameter['fids'] = fids;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
if (shouldModerate !== undefined) {
localVarQueryParameter['should_moderate'] = shouldModerate;
}
if (xNeynarExperimental != null) {
localVarHeaderParameter['x-neynar-experimental'] = typeof xNeynarExperimental === 'string'
? xNeynarExperimental
: JSON.stringify(xNeynarExperimental);
}
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Fetch feed based on parent URLs
* @summary By parent URLs
* @param {string} parentUrls Comma separated list of parent_urls
* @param {boolean} [xNeynarExperimental] Enables experimental features including filtering based on the Neynar score. See [docs](https://neynar.notion.site/Experimental-Features-1d2655195a8b80eb98b4d4ae7b76ae4a) for more details.
* @param {boolean | null} [withRecasts] Include recasts in the response, true by default
* @param {number} [viewerFid] Providing this will return a feed that respects this user\'s mutes and blocks and includes `viewer_context`.
* @param {boolean | null} [withReplies] Include replies in the response, false by default
* @param {number} [limit] Number of results to fetch (Default: 25, Maximum: 100)
* @param {string} [cursor] Pagination cursor.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FeedResponse>} A promise that resolves to a `FeedResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-feed-by-parent-urls)
*
*/
fetchFeedByParentUrls: async (parentUrls, xNeynarExperimental, withRecasts, viewerFid, withReplies, limit, cursor, options = {}) => {
// verify required parameter 'parentUrls' is not null or undefined
(0, common_1.assertParamExists)('fetchFeedByParentUrls', 'parentUrls', parentUrls);
const localVarPath = `/v2/farcaster/feed/parent_urls/`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication ApiKeyAuth required
await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "x-api-key", configuration);
if (parentUrls !== undefined) {
localVarQueryParameter['parent_urls'] = parentUrls;
}
if (withRecasts !== undefined) {
localVarQueryParameter['with_recasts'] = withRecasts;
}
if (viewerFid !== undefined) {
localVarQueryParameter['viewer_fid'] = viewerFid;
}
if (withReplies !== undefined) {
localVarQueryParameter['with_replies'] = withReplies;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
if (xNeynarExperimental != null) {
localVarHeaderParameter['x-neynar-experimental'] = typeof xNeynarExperimental === 'string'
? xNeynarExperimental
: JSON.stringify(xNeynarExperimental);
}
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Fetch a personalized For You feed for a user
* @summary For you
* @param {number} fid FID of user whose feed you want to create
* @param {boolean} [xNeynarExperimental] Enables experimental features including filtering based on the Neynar score. See [docs](https://neynar.notion.site/Experimental-Features-1d2655195a8b80eb98b4d4ae7b76ae4a) for more details.
* @param {number} [viewerFid] Providing this will return a feed that respects this user\'s mutes and blocks and includes `viewer_context`.
* @param {FetchFeedForYouProviderEnum} [provider] The provider of the For You feed.
* @param {number} [limit] Number of results to fetch (Default: 25, Maximum: 50)
* @param {string} [cursor] Pagination cursor.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FeedResponse>} A promise that resolves to a `FeedResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-feed-for-you)
*
*/
fetchFeedForYou: async (fid, xNeynarExperimental, viewerFid, provider, limit, cursor, options = {}) => {
// verify required parameter 'fid' is not null or undefined
(0, common_1.assertParamExists)('fetchFeedForYou', 'fid', fid);
const localVarPath = `/v2/farcaster/feed/for_you/`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication ApiKeyAuth required
await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "x-api-key", configuration);
if (fid !== undefined) {
localVarQueryParameter['fid'] = fid;
}
if (viewerFid !== undefined) {
localVarQueryParameter['viewer_fid'] = viewerFid;
}
if (provider !== undefined) {
localVarQueryParameter['provider'] = provider;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
if (xNeynarExperimental != null) {
localVarHeaderParameter['x-neynar-experimental'] = typeof xNeynarExperimental === 'string'
? xNeynarExperimental
: JSON.stringify(xNeynarExperimental);
}
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Fetch feed of casts with mini apps, reverse chronological order
* @summary Casts with mini apps
* @param {boolean} [xNeynarExperimental] Enables experimental features including filtering based on the Neynar score. See [docs](https://neynar.notion.site/Experimental-Features-1d2655195a8b80eb98b4d4ae7b76ae4a) for more details.
* @param {number} [limit] Number of results to fetch (Default: 25, Maximum: 100)
* @param {number} [viewerFid] Providing this will return a feed that respects this user\'s mutes and blocks and includes `viewer_context`.
* @param {string} [cursor] Pagination cursor.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FeedResponse>} A promise that resolves to a `FeedResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-frames-only-feed)
*
*/
fetchFramesOnlyFeed: async (xNeynarExperimental, limit, viewerFid, cursor, options = {}) => {
const localVarPath = `/v2/farcaster/feed/frames/`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication ApiKeyAuth required
await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "x-api-key", configuration);
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (viewerFid !== undefined) {
localVarQueryParameter['viewer_fid'] = viewerFid;
}
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
if (xNeynarExperimental != null) {
localVarHeaderParameter['x-neynar-experimental'] = typeof xNeynarExperimental === 'string'
? xNeynarExperimental
: JSON.stringify(xNeynarExperimental);
}
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Fetch 10 most popular casts for a given user FID; popularity based on replies, likes and recasts; sorted by most popular first
* @summary 10 most popular casts
* @param {number} fid FID of user whose feed you want to create
* @param {number} [viewerFid]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<BulkCastsResponse>} A promise that resolves to a `BulkCastsResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-popular-casts-by-user)
*
*/
fetchPopularCastsByUser: async (fid, viewerFid, options = {}) => {
// verify required parameter 'fid' is not null or undefined
(0, common_1.assertParamExists)('fetchPopularCastsByUser', 'fid', fid);
const localVarPath = `/v2/farcaster/feed/user/popular/`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication ApiKeyAuth required
await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "x-api-key", configuration);
if (fid !== undefined) {
localVarQueryParameter['fid'] = fid;
}
if (viewerFid !== undefined) {
localVarQueryParameter['viewer_fid'] = viewerFid;
}
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Fetch recent replies and recasts for a given user FID; sorted by most recent first
* @summary Replies and recasts
* @param {number} fid FID of user whose replies and recasts you want to fetch
* @param {FetchRepliesAndRecastsForUserFilterEnum} [filter] Filter to fetch only replies or recasts
* @param {number} [limit] Number of results to fetch (Default: 25, Maximum: 50)
* @param {string} [cursor] Pagination cursor.
* @param {number} [viewerFid] Providing this will return a feed that respects this user\'s mutes and blocks and includes `viewer_context`.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FeedResponse>} A promise that resolves to a `FeedResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-replies-and-recasts-for-user)
*
*/
fetchRepliesAndRecastsForUser: async (fid, filter, limit, cursor, viewerFid, options = {}) => {
// verify required parameter 'fid' is not null or undefined
(0, common_1.assertParamExists)('fetchRepliesAndRecastsForUser', 'fid', fid);
const localVarPath = `/v2/farcaster/feed/user/replies_and_recasts/`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication ApiKeyAuth required
await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "x-api-key", configuration);
if (fid !== undefined) {
localVarQueryParameter['fid'] = fid;
}
if (filter !== undefined) {
localVarQueryParameter['filter'] = filter;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
if (viewerFid !== undefined) {
localVarQueryParameter['viewer_fid'] = viewerFid;
}
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Fetch trending casts or on the global feed or channels feeds. 7d time window available for channel feeds only.
* @summary Trending feeds
* @param {boolean} [xNeynarExperimental] Enables experimental features including filtering based on the Neynar score. See [docs](https://neynar.notion.site/Experimental-Features-1d2655195a8b80eb98b4d4ae7b76ae4a) for more details.
* @param {number} [limit] Number of results to fetch (Default: 10, Maximum: 10)
* @param {string} [cursor] Pagination cursor
* @param {number} [viewerFid] Providing this will return a feed that respects this user\'s mutes and blocks and includes `viewer_context`.
* @param {FetchTrendingFeedTimeWindowEnum} [timeWindow] Time window for trending casts (7d window for channel feeds only)
* @param {string} [channelId] Channel ID to filter trending casts. Less active channels might have no casts in the time window selected. Provide either `channel_id` or `parent_url`, not both.
* @param {string} [parentUrl] Parent URL to filter trending casts. Less active channels might have no casts in the time window selected. Provide either `channel_id` or `parent_url`, not both.
* @param {FetchTrendingFeedProviderEnum} [provider] The provider of the trending casts feed.
* @param {string} [providerMetadata] provider_metadata is a URI-encoded stringified JSON object that can be used to pass additional metadata to the provider. Only available for mbd provider right now. See [here](https://docs.neynar.com/docs/feed-for-you-w-external-providers) on how to use.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FeedResponse>} A promise that resolves to a `FeedResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-trending-feed)
*
*/
fetchTrendingFeed: async (xNeynarExperimental, limit, cursor, viewerFid, timeWindow, channelId, parentUrl, provider, providerMetadata, options = {}) => {
const localVarPath = `/v2/farcaster/feed/trending/`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication ApiKeyAuth required
await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "x-api-key", configuration);
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
if (viewerFid !== undefined) {
localVarQueryParameter['viewer_fid'] = viewerFid;
}
if (timeWindow !== undefined) {
localVarQueryParameter['time_window'] = timeWindow;
}
if (channelId !== undefined) {
localVarQueryParameter['channel_id'] = channelId;
}
if (parentUrl !== undefined) {
localVarQueryParameter['parent_url'] = parentUrl;
}
if (provider !== undefined) {
localVarQueryParameter['provider'] = provider;
}
if (providerMetadata !== undefined) {
localVarQueryParameter['provider_metadata'] = providerMetadata;
}
if (xNeynarExperimental != null) {
localVarHeaderParameter['x-neynar-experimental'] = typeof xNeynarExperimental === 'string'
? xNeynarExperimental
: JSON.stringify(xNeynarExperimental);
}
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Fetch feed based on who a user is following
* @summary Following
* @param {number} fid FID of user whose feed you want to create
* @param {boolean} [xNeynarExperimental] Enables experimental features including filtering based on the Neynar score. See [docs](https://neynar.notion.site/Experimental-Features-1d2655195a8b80eb98b4d4ae7b76ae4a) for more details.
* @param {number} [viewerFid] Providing this will return a feed that respects this user\'s mutes and blocks and includes `viewer_context`.
* @param {boolean | null} [withRecasts] Include recasts in the response, true by default
* @param {number} [limit] Number of results to fetch (Default: 25, Maximum: 100)
* @param {string} [cursor] Pagination cursor.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FeedResponse>} A promise that resolves to a `FeedResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-following-feed)
*
*/
fetchUserFollowingFeed: async (fid, xNeynarExperimental, viewerFid, withRecasts, limit, cursor, options = {}) => {
// verify required parameter 'fid' is not null or undefined
(0, common_1.assertParamExists)('fetchUserFollowingFeed', 'fid', fid);
const localVarPath = `/v2/farcaster/feed/following/`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication ApiKeyAuth required
await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "x-api-key", configuration);
if (fid !== undefined) {
localVarQueryParameter['fid'] = fid;
}
if (viewerFid !== undefined) {
localVarQueryParameter['viewer_fid'] = viewerFid;
}
if (withRecasts !== undefined) {
localVarQueryParameter['with_recasts'] = withRecasts;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
if (xNeynarExperimental != null) {
localVarHeaderParameter['x-neynar-experimental'] = typeof xNeynarExperimental === 'string'
? xNeynarExperimental
: JSON.stringify(xNeynarExperimental);
}
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
},
};
};
exports.FeedApiAxiosParamCreator = FeedApiAxiosParamCreator;
/**
* FeedApi - functional programming interface
* @export
*/
const FeedApiFp = function (configuration) {
const localVarAxiosParamCreator = (0, exports.FeedApiAxiosParamCreator)(configuration);
return {
/**
* Fetch casts for a given user FID in reverse chronological order. Also allows filtering by parent_url and channel
* @summary Chronologically
* @param {number} fid FID of user whose recent casts you want to fetch
* @param {boolean} [xNeynarExperimental] Enables experimental features including filtering based on the Neynar score. See [docs](https://neynar.notion.site/Experimental-Features-1d2655195a8b80eb98b4d4ae7b76ae4a) for more details.
* @param {number} [appFid] Optionally filter to casts created via a specific app FID, e.g. 9152 for Warpcast
* @param {number} [viewerFid] FID of the user viewing the feed
* @param {number} [limit] Number of results to fetch (Default: 25, Maximum: 150)
* @param {string} [cursor] Pagination cursor
* @param {boolean | null} [includeReplies] Include reply casts by the author in the response, true by default
* @param {string} [parentUrl] Parent URL to filter the feed; mutually exclusive with channel_id
* @param {string} [channelId] Channel ID to filter the feed; mutually exclusive with parent_url
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FeedResponse>} A promise that resolves to a `FeedResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-casts-for-user)
*
*/
async fetchCastsForUser(fid, xNeynarExperimental, appFid, viewerFid, limit, cursor, includeReplies, parentUrl, channelId, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.fetchCastsForUser(fid, xNeynarExperimental, appFid, viewerFid, limit, cursor, includeReplies, parentUrl, channelId, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['FeedApi.fetchCastsForUser']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Fetch casts based on filters. Ensure setting the correct parameters based on the feed_type and filter_type.
* @summary By filters
* @param {boolean} [xNeynarExperimental] Enables experimental features including filtering based on the Neynar score. See [docs](https://neynar.notion.site/Experimental-Features-1d2655195a8b80eb98b4d4ae7b76ae4a) for more details.
* @param {FetchFeedFeedTypeEnum} [feedType] Defaults to following (requires FID or address). If set to filter (requires filter_type)
* @param {FetchFeedFilterTypeEnum} [filterType] Used when feed_type=filter. Can be set to FIDs (requires FIDs) or parent_url (requires parent_url) or channel_id (requires channel_id)
* @param {number} [fid] (Optional) FID of user whose feed you want to create. By default, the API expects this field, except if you pass a filter_type
* @param {string} [fids] Used when filter_type=FIDs . Create a feed based on a list of FIDs. Max array size is 100. Requires feed_type and filter_type.
* @param {string} [parentUrl] Used when filter_type=parent_url can be used to fetch content under any parent url e.g. FIP-2 channels on Warpcast. Requires feed_type and filter_type.
* @param {string} [channelId] Used when filter_type=channel_id can be used to fetch casts under a channel. Requires feed_type and filter_type.
* @param {boolean | null} [membersOnly] Used when filter_type=channel_id. Only include casts from members of the channel. True by default.
* @param {string} [embedUrl] Used when filter_type=embed_url. Casts with embedded URLs prefixed by this embed_url param will be returned. We normalize your given URL prefix and prepend \'https://\' if no protocol is included. Requires feed_type and filter_type.
* @param {Array<FetchFeedEmbedTypesEnum>} [embedTypes] Used when filter_type=embed_types can be used to fetch all casts with matching content types. Requires feed_type and filter_type.
* @param {boolean | null} [withRecasts] Include recasts in the response, true by default
* @param {number} [limit] Number of results to fetch (Default: 25, Maximum: 100)
* @param {string} [cursor] Pagination cursor.
* @param {number} [viewerFid] Providing this will return a feed that respects this user\'s mutes and blocks and includes `viewer_context`.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FeedResponse>} A promise that resolves to a `FeedResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-feed)
*
*/
async fetchFeed(xNeynarExperimental, feedType, filterType, fid, fids, parentUrl, channelId, membersOnly, embedUrl, embedTypes, withRecasts, limit, cursor, viewerFid, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.fetchFeed(xNeynarExperimental, feedType, filterType, fid, fids, parentUrl, channelId, membersOnly, embedUrl, embedTypes, withRecasts, limit, cursor, viewerFid, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['FeedApi.fetchFeed']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Fetch feed based on channel IDs
* @summary By channel IDs
* @param {string} channelIds Comma separated list of up to 10 channel IDs e.g. neynar,farcaster
* @param {boolean} [xNeynarExperimental] Enables experimental features including filtering based on the Neynar score. See [docs](https://neynar.notion.site/Experimental-Features-1d2655195a8b80eb98b4d4ae7b76ae4a) for more details.
* @param {boolean | null} [withRecasts] Include recasts in the response, true by default
* @param {number} [viewerFid] Providing this will return a feed that respects this user\'s mutes and blocks and includes `viewer_context`.
* @param {boolean | null} [withReplies] Include replies in the response, false by default
* @param {boolean | null} [membersOnly] Used when filter_type=channel_id. Only include casts from members of the channel. True by default.
* @param {string} [fids] Comma separated list of FIDs to filter the feed by, up to 10 at a time
* @param {number} [limit] Number of results to fetch (Default: 25, Maximum: 100)
* @param {string} [cursor] Pagination cursor.
* @param {boolean | null} [shouldModerate] If true, only casts that have been liked by the moderator (if one exists) will be returned.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FeedResponse>} A promise that resolves to a `FeedResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-feed-by-channel-ids)
*
*/
async fetchFeedByChannelIds(channelIds, xNeynarExperimental, withRecasts, viewerFid, withReplies, membersOnly, fids, limit, cursor, shouldModerate, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.fetchFeedByChannelIds(channelIds, xNeynarExperimental, withRecasts, viewerFid, withReplies, membersOnly, fids, limit, cursor, shouldModerate, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['FeedApi.fetchFeedByChannelIds']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Fetch feed based on parent URLs
* @summary By parent URLs
* @param {string} parentUrls Comma separated list of parent_urls
* @param