UNPKG

@neynar/nodejs-sdk

Version:

SDK to interact with Neynar APIs (https://docs.neynar.com/reference/quickstart)

680 lines (679 loc) 64.2 kB
"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.115.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.SearchCastsSortTypeEnum = exports.SearchCastsModeEnum = exports.LookupCastConversationFoldEnum = exports.LookupCastConversationSortTypeEnum = exports.LookupCastConversationTypeEnum = exports.LookupCastByHashOrUrlTypeEnum = exports.FetchCastQuotesTypeEnum = exports.FetchBulkCastsSortTypeEnum = exports.CastApi = exports.CastApiFactory = exports.CastApiFp = exports.CastApiAxiosParamCreator = 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"); /** * CastApi - axios parameter creator * @export */ const CastApiAxiosParamCreator = function (configuration) { return { /** * Delete an existing cast. (In order to delete a cast `signer_uuid` must be approved) * @summary Delete a cast * @param {DeleteCastReqBody} deleteCastReqBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<OperationResponse>} A promise that resolves to a `OperationResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/delete-cast) * */ deleteCast: async (deleteCastReqBody, options = {}) => { // verify required parameter 'deleteCastReqBody' is not null or undefined (0, common_1.assertParamExists)('deleteCast', 'deleteCastReqBody', deleteCastReqBody); const localVarPath = `/v2/farcaster/cast/`; // 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: 'DELETE' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication ApiKeyAuth required await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "x-api-key", configuration); localVarHeaderParameter['Content-Type'] = 'application/json'; (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); localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(deleteCastReqBody, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Fetch multiple casts using their respective hashes. * @summary Bulk fetch casts * @param {string} casts Hashes of the cast to be retrived (Comma separated, no spaces) * @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] adds viewer_context to cast object to show whether viewer has liked or recasted the cast. * @param {FetchBulkCastsSortTypeEnum} [sortType] Optional parameter to sort the casts based on different criteria * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<CastsResponse>} A promise that resolves to a `CastsResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-bulk-casts) * */ fetchBulkCasts: async (casts, xNeynarExperimental, viewerFid, sortType, options = {}) => { // verify required parameter 'casts' is not null or undefined (0, common_1.assertParamExists)('fetchBulkCasts', 'casts', casts); const localVarPath = `/v2/farcaster/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 (casts !== undefined) { localVarQueryParameter['casts'] = casts; } if (viewerFid !== undefined) { localVarQueryParameter['viewer_fid'] = viewerFid; } if (sortType !== undefined) { localVarQueryParameter['sort_type'] = sortType; } 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 that quote a given cast * @summary Cast Quotes * @param {string} identifier Cast identifier (It\&#39;s either a URL or a hash) * @param {FetchCastQuotesTypeEnum} 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 {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] * @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<FetchCastQuotes200Response>} A promise that resolves to a `FetchCastQuotes200Response` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-cast-quotes) * */ fetchCastQuotes: async (identifier, type, xNeynarExperimental, viewerFid, limit, cursor, options = {}) => { // verify required parameter 'identifier' is not null or undefined (0, common_1.assertParamExists)('fetchCastQuotes', 'identifier', identifier); // verify required parameter 'type' is not null or undefined (0, common_1.assertParamExists)('fetchCastQuotes', 'type', type); const localVarPath = `/v2/farcaster/cast/quotes/`; // 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 (identifier !== undefined) { localVarQueryParameter['identifier'] = identifier; } if (type !== undefined) { localVarQueryParameter['type'] = type; } if (viewerFid !== undefined) { localVarQueryParameter['viewer_fid'] = viewerFid; } 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, }; }, /** * Crawls the given URL and returns metadata useful when embedding the URL in a cast. * @summary Embedded URL metadata * @param {string} url URL to crawl metadata of * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<CastEmbedCrawlResponse>} A promise that resolves to a `CastEmbedCrawlResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-embedded-url-metadata) * */ fetchEmbeddedUrlMetadata: async (url, options = {}) => { // verify required parameter 'url' is not null or undefined (0, common_1.assertParamExists)('fetchEmbeddedUrlMetadata', 'url', url); const localVarPath = `/v2/farcaster/cast/embed/crawl/`; // 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 (url !== undefined) { localVarQueryParameter['url'] = url; } (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, }; }, /** * Gets information about an individual cast by passing in a Farcaster web URL or cast hash * @summary By hash or URL * @param {string} identifier Cast identifier (It\&#39;s either a URL or a hash) * @param {LookupCastByHashOrUrlTypeEnum} 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 {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] adds viewer_context to cast object to show whether viewer has liked or recasted the cast. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<CastResponse>} A promise that resolves to a `CastResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-cast-by-hash-or-url) * */ lookupCastByHashOrUrl: async (identifier, type, xNeynarExperimental, viewerFid, options = {}) => { // verify required parameter 'identifier' is not null or undefined (0, common_1.assertParamExists)('lookupCastByHashOrUrl', 'identifier', identifier); // verify required parameter 'type' is not null or undefined (0, common_1.assertParamExists)('lookupCastByHashOrUrl', 'type', type); const localVarPath = `/v2/farcaster/cast/`; // 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 (identifier !== undefined) { localVarQueryParameter['identifier'] = identifier; } if (type !== undefined) { localVarQueryParameter['type'] = type; } 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, }; }, /** * 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 {string} identifier Cast identifier (It\&#39;s either a URL or a hash) * @param {LookupCastConversationTypeEnum} 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 {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 | null} [replyDepth] The depth of replies in the conversation that will be returned (default 2) * @param {boolean | null} [includeChronologicalParentCasts] Include all parent casts in chronological order * @param {number} [viewerFid] Providing this will return a conversation that respects this user\&#39;s mutes and blocks and includes &#x60;viewer_context&#x60;. * @param {LookupCastConversationSortTypeEnum} [sortType] Sort type for the ordering of descendants. Default is &#x60;chron&#x60; * @param {LookupCastConversationFoldEnum} [fold] 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} [limit] Number of results to fetch (Default: 20, Maximum: 50) * @param {string} [cursor] Pagination cursor. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<Conversation>} A promise that resolves to a `Conversation` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-cast-conversation) * */ lookupCastConversation: async (identifier, type, xNeynarExperimental, replyDepth, includeChronologicalParentCasts, viewerFid, sortType, fold, limit, cursor, options = {}) => { // verify required parameter 'identifier' is not null or undefined (0, common_1.assertParamExists)('lookupCastConversation', 'identifier', identifier); // verify required parameter 'type' is not null or undefined (0, common_1.assertParamExists)('lookupCastConversation', 'type', type); const localVarPath = `/v2/farcaster/cast/conversation/`; // 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 (identifier !== undefined) { localVarQueryParameter['identifier'] = identifier; } if (type !== undefined) { localVarQueryParameter['type'] = type; } if (replyDepth !== undefined) { localVarQueryParameter['reply_depth'] = replyDepth; } if (includeChronologicalParentCasts !== undefined) { localVarQueryParameter['include_chronological_parent_casts'] = includeChronologicalParentCasts; } if (viewerFid !== undefined) { localVarQueryParameter['viewer_fid'] = viewerFid; } if (sortType !== undefined) { localVarQueryParameter['sort_type'] = sortType; } if (fold !== undefined) { localVarQueryParameter['fold'] = fold; } 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, }; }, /** * 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 {PostCastReqBody} postCastReqBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<PostCastResponse>} A promise that resolves to a `PostCastResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/publish-cast) * */ publishCast: async (postCastReqBody, options = {}) => { // verify required parameter 'postCastReqBody' is not null or undefined (0, common_1.assertParamExists)('publishCast', 'postCastReqBody', postCastReqBody); const localVarPath = `/v2/farcaster/cast/`; // 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: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication ApiKeyAuth required await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "x-api-key", configuration); localVarHeaderParameter['Content-Type'] = 'application/json'; (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); localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(postCastReqBody, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Search for casts based on a query string, with optional AND filters * @summary Search for casts * @param {string} q Query string to search for casts. Supported operators: | Operator | Description | | --------- | -------------------------------------------------------------------------------------------------------- | | &#x60;+&#x60; | Acts as the AND operator. This is the default operator between terms and can usually be omitted. | | &#x60;\\|&#x60; | Acts as the OR operator. | | &#x60;*&#x60; | When used at the end of a term, signifies a prefix query. | | &#x60;\&quot;&#x60; | Wraps several terms into a phrase (for example, &#x60;\&quot;star wars\&quot;&#x60;). | | &#x60;(&#x60;, &#x60;)&#x60; | Wrap a clause for precedence (for example, &#x60;star + (wars \\| trek)&#x60;). | | &#x60;~n&#x60; | When used after a term (for example, &#x60;satr~3&#x60;), sets &#x60;fuzziness&#x60;. When used after a phrase, sets &#x60;slop&#x60;. | | &#x60;-&#x60; | Negates the term. | | &#x60;before:&#x60; | Search for casts before a specific date. (e.g. &#x60;before:2025-04-20&#x60; or &#x60;before:2025-04-20T23:59:59&#x60;) | | &#x60;after:&#x60; | Search for casts after a specific date. (e.g. &#x60;after:2025-04-20&#x60; or &#x60;after:2025-04-20T00:00:00&#x60;) | * @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 {SearchCastsModeEnum} [mode] Choices are: - &#x60;literal&#x60; - Searches for the words in the query string (default) - &#x60;semantic&#x60; - Searches for the meaning of the query string - &#x60;hybrid&#x60; - Combines both literal and semantic results * @param {SearchCastsSortTypeEnum} [sortType] Choices are: - &#x60;desc_chron&#x60; - All casts sorted by time in a descending order (default) - &#x60;chron&#x60; - All casts sorted by time in ascending order - &#x60;algorithmic&#x60; - Casts sorted by engagement and time * @param {number} [authorFid] Fid of the user whose casts you want to search * @param {number} [viewerFid] Providing this will return search results that respects this user\&#39;s mutes and blocks and includes &#x60;viewer_context&#x60;. * @param {string} [parentUrl] Parent URL of the casts you want to search * @param {string} [channelId] Channel ID of the casts you want to search * @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<CastsSearchResponse>} A promise that resolves to a `CastsSearchResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/search-casts) * */ searchCasts: async (q, xNeynarExperimental, mode, sortType, authorFid, viewerFid, parentUrl, channelId, limit, cursor, options = {}) => { // verify required parameter 'q' is not null or undefined (0, common_1.assertParamExists)('searchCasts', 'q', q); const localVarPath = `/v2/farcaster/cast/search/`; // 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 (q !== undefined) { localVarQueryParameter['q'] = q; } if (mode !== undefined) { localVarQueryParameter['mode'] = mode; } if (sortType !== undefined) { localVarQueryParameter['sort_type'] = sortType; } if (authorFid !== undefined) { localVarQueryParameter['author_fid'] = authorFid; } if (viewerFid !== undefined) { localVarQueryParameter['viewer_fid'] = viewerFid; } if (parentUrl !== undefined) { localVarQueryParameter['parent_url'] = parentUrl; } if (channelId !== undefined) { localVarQueryParameter['channel_id'] = channelId; } 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.CastApiAxiosParamCreator = CastApiAxiosParamCreator; /** * CastApi - functional programming interface * @export */ const CastApiFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.CastApiAxiosParamCreator)(configuration); return { /** * Delete an existing cast. (In order to delete a cast `signer_uuid` must be approved) * @summary Delete a cast * @param {DeleteCastReqBody} deleteCastReqBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<OperationResponse>} A promise that resolves to a `OperationResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/delete-cast) * */ async deleteCast(deleteCastReqBody, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.deleteCast(deleteCastReqBody, 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['CastApi.deleteCast']) === 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 multiple casts using their respective hashes. * @summary Bulk fetch casts * @param {string} casts Hashes of the cast to be retrived (Comma separated, no spaces) * @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] adds viewer_context to cast object to show whether viewer has liked or recasted the cast. * @param {FetchBulkCastsSortTypeEnum} [sortType] Optional parameter to sort the casts based on different criteria * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<CastsResponse>} A promise that resolves to a `CastsResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-bulk-casts) * */ async fetchBulkCasts(casts, xNeynarExperimental, viewerFid, sortType, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.fetchBulkCasts(casts, xNeynarExperimental, viewerFid, sortType, 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['CastApi.fetchBulkCasts']) === 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 that quote a given cast * @summary Cast Quotes * @param {string} identifier Cast identifier (It\&#39;s either a URL or a hash) * @param {FetchCastQuotesTypeEnum} 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 {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] * @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<FetchCastQuotes200Response>} A promise that resolves to a `FetchCastQuotes200Response` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-cast-quotes) * */ async fetchCastQuotes(identifier, type, xNeynarExperimental, viewerFid, limit, cursor, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.fetchCastQuotes(identifier, type, xNeynarExperimental, viewerFid, limit, cursor, 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['CastApi.fetchCastQuotes']) === 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); }, /** * Crawls the given URL and returns metadata useful when embedding the URL in a cast. * @summary Embedded URL metadata * @param {string} url URL to crawl metadata of * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<CastEmbedCrawlResponse>} A promise that resolves to a `CastEmbedCrawlResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-embedded-url-metadata) * */ async fetchEmbeddedUrlMetadata(url, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.fetchEmbeddedUrlMetadata(url, 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['CastApi.fetchEmbeddedUrlMetadata']) === 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); }, /** * Gets information about an individual cast by passing in a Farcaster web URL or cast hash * @summary By hash or URL * @param {string} identifier Cast identifier (It\&#39;s either a URL or a hash) * @param {LookupCastByHashOrUrlTypeEnum} 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 {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] adds viewer_context to cast object to show whether viewer has liked or recasted the cast. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<CastResponse>} A promise that resolves to a `CastResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-cast-by-hash-or-url) * */ async lookupCastByHashOrUrl(identifier, type, xNeynarExperimental, viewerFid, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.lookupCastByHashOrUrl(identifier, type, xNeynarExperimental, 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['CastApi.lookupCastByHashOrUrl']) === 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); }, /** * 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 {string} identifier Cast identifier (It\&#39;s either a URL or a hash) * @param {LookupCastConversationTypeEnum} 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 {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 | null} [replyDepth] The depth of replies in the conversation that will be returned (default 2) * @param {boolean | null} [includeChronologicalParentCasts] Include all parent casts in chronological order * @param {number} [viewerFid] Providing this will return a conversation that respects this user\&#39;s mutes and blocks and includes &#x60;viewer_context&#x60;. * @param {LookupCastConversationSortTypeEnum} [sortType] Sort type for the ordering of descendants. Default is &#x60;chron&#x60; * @param {LookupCastConversationFoldEnum} [fold] 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} [limit] Number of results to fetch (Default: 20, Maximum: 50) * @param {string} [cursor] Pagination cursor. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<Conversation>} A promise that resolves to a `Conversation` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-cast-conversation) * */ async lookupCastConversation(identifier, type, xNeynarExperimental, replyDepth, includeChronologicalParentCasts, viewerFid, sortType, fold, limit, cursor, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.lookupCastConversation(identifier, type, xNeynarExperimental, replyDepth, includeChronologicalParentCasts, viewerFid, sortType, fold, limit, cursor, 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['CastApi.lookupCastConversation']) === 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); }, /** * 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 {PostCastReqBody} postCastReqBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<PostCastResponse>} A promise that resolves to a `PostCastResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/publish-cast) * */ async publishCast(postCastReqBody, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.publishCast(postCastReqBody, 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['CastApi.publishCast']) === 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); }, /** * Search for casts based on a query string, with optional AND filters * @summary Search for casts * @param {string} q Query string to search for casts. Supported operators: | Operator | Description | | --------- | -------------------------------------------------------------------------------------------------------- | | &#x60;+&#x60; | Acts as the AND operator. This is the default operator between terms and can usually be omitted. | | &#x60;\\|&#x60; | Acts as the OR operator. | | &#x60;*&#x60; | When used at the end of a term, signifies a prefix query. | | &#x60;\&quot;&#x60; | Wraps several terms into a phrase (for example, &#x60;\&quot;star wars\&quot;&#x60;). | | &#x60;(&#x60;, &#x60;)&#x60; | Wrap a clause for precedence (for example, &#x60;star + (wars \\| trek)&#x60;). | | &#x60;~n&#x60; | When used after a term (for example, &#x60;satr~3&#x60;), sets &#x60;fuzziness&#x60;. When used after a phrase, sets &#x60;slop&#x60;. | | &#x60;-&#x60; | Negates the term. | | &#x60;before:&#x60; | Search for casts before a specific date. (e.g. &#x60;before:2025-04-20&#x60; or &#x60;before:2025-04-20T23:59:59&#x60;) | | &#x60;after:&#x60; | Search for casts after a specific date. (e.g. &#x60;after:2025-04-20&#x60; or &#x60;after:2025-04-20T00:00:00&#x60;) | * @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 {SearchCastsModeEnum} [mode] Choices are: - &#x60;literal&#x60; - Searches for the words in the query string (default) - &#x60;semantic&#x60; - Searches for the meaning of the query string - &#x60;hybrid&#x60; - Combines both literal and semantic results * @param {SearchCastsSortTypeEnum} [sortType] Choices are: - &#x60;desc_chron&#x60; - All casts sorted by time in a descending order (default) - &#x60;chron&#x60; - All casts sorted by time in ascending order - &#x60;algorithmic&#x60; - Casts sorted by engagement and time * @param {number} [authorFid] Fid of the user whose casts you want to search * @param {number} [viewerFid] Providing this will return search results that respects this user\&#39;s mutes and blocks and includes &#x60;viewer_context&#x60;. * @param {string} [parentUrl] Parent URL of the casts you want to search * @param {string} [channelId] Channel ID of the casts you want to search * @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<CastsSearchResponse>} A promise that resolves to a `CastsSearchResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/search-casts) * */ async searchCasts(q, xNeynarExperimental, mode, sortType, authorFid, viewerFid, parentUrl, channelId, limit, cursor, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.searchCasts(q, xNeynarExperimental, mode, sortType, authorFid, viewerFid, parentUrl, channelId, limit, cursor, 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['CastApi.searchCasts']) === 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); }, }; }; exports.CastApiFp = CastApiFp; /** * CastApi - factory interface * @export */ const CastApiFactory = function (configuration, basePath, axios) { const localVarFp = (0, exports.CastApiFp)(configuration); return { /** * Delete an existing cast. (In order to delete a cast `signer_uuid` must be approved) * @summary Delete a cast * @param {CastApiDeleteCastRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<OperationResponse>} A promise that resolves to a `OperationResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/delete-cast) * */ deleteCast(requestParameters, options) { return localVarFp.deleteCast(requestParameters.deleteCastReqBody, options).then((request) => request(axios, basePath)); }, /** * Fetch multiple casts using their respective hashes. * @summary Bulk fetch casts * @param {CastApiFetchBulkCastsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<CastsResponse>} A promise that resolves to a `CastsResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-bulk-casts) * */ fetchBulkCasts(requestParameters, options) { return localVarFp.fetchBulkCasts(requestParameters.casts, requestParameters.xNeynarExperimental, requestParameters.viewerFid, requestParameters.sortType, options).then((request) => request(axios, basePath)); }, /**