UNPKG

@neynar/nodejs-sdk

Version:

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

341 lines (340 loc) 20.1 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.FetchUserInteractionsTypeEnum = exports.AgentsApi = exports.AgentsApiFactory = exports.AgentsApiFp = exports.AgentsApiAxiosParamCreator = 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"); /** * AgentsApi - axios parameter creator * @export */ const AgentsApiAxiosParamCreator = function (configuration) { return { /** * 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 {FramePayTransactionReqBody} framePayTransactionReqBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<TransactionFrameResponse>} A promise that resolves to a `TransactionFrameResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/create-transaction-pay-frame) * */ createTransactionPayFrame: async (framePayTransactionReqBody, options = {}) => { // verify required parameter 'framePayTransactionReqBody' is not null or undefined (0, common_1.assertParamExists)('createTransactionPayFrame', 'framePayTransactionReqBody', framePayTransactionReqBody); const localVarPath = `/v2/farcaster/frame/transaction/pay/`; // 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)(framePayTransactionReqBody, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Returns a list of interactions between two users * @summary User interactions * @param {string} fids Comma separated list of two FIDs * @param {Array<FetchUserInteractionsTypeEnum>} [type] Comma seperated list of Interaction type to fetch * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<FetchUserInteractions200Response>} A promise that resolves to a `FetchUserInteractions200Response` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-interactions) * */ fetchUserInteractions: async (fids, type, options = {}) => { // verify required parameter 'fids' is not null or undefined (0, common_1.assertParamExists)('fetchUserInteractions', 'fids', fids); const localVarPath = `/v2/farcaster/user/interactions/`; // 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 (fids !== undefined) { localVarQueryParameter['fids'] = fids; } if (type) { localVarQueryParameter['type'] = type; } (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, }; }, /** * 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 {string} identifier Cast identifier (It\&#39;s either a URL or a hash)) * @param {number} [limit] Number of casts to consider in a summary up to a point of target cast (Default: 20, Maximum: 50) * @param {string} [prompt] Additional prompt used to generate a summary * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<ConversationSummary>} A promise that resolves to a `ConversationSummary` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-cast-conversation-summary) * */ lookupCastConversationSummary: async (identifier, limit, prompt, options = {}) => { // verify required parameter 'identifier' is not null or undefined (0, common_1.assertParamExists)('lookupCastConversationSummary', 'identifier', identifier); const localVarPath = `/v2/farcaster/cast/conversation/summary/`; // 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 (limit !== undefined) { localVarQueryParameter['limit'] = limit; } if (prompt !== undefined) { localVarQueryParameter['prompt'] = prompt; } (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.AgentsApiAxiosParamCreator = AgentsApiAxiosParamCreator; /** * AgentsApi - functional programming interface * @export */ const AgentsApiFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.AgentsApiAxiosParamCreator)(configuration); return { /** * 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 {FramePayTransactionReqBody} framePayTransactionReqBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<TransactionFrameResponse>} A promise that resolves to a `TransactionFrameResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/create-transaction-pay-frame) * */ async createTransactionPayFrame(framePayTransactionReqBody, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.createTransactionPayFrame(framePayTransactionReqBody, 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['AgentsApi.createTransactionPayFrame']) === 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); }, /** * Returns a list of interactions between two users * @summary User interactions * @param {string} fids Comma separated list of two FIDs * @param {Array<FetchUserInteractionsTypeEnum>} [type] Comma seperated list of Interaction type to fetch * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<FetchUserInteractions200Response>} A promise that resolves to a `FetchUserInteractions200Response` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-interactions) * */ async fetchUserInteractions(fids, type, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.fetchUserInteractions(fids, type, 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['AgentsApi.fetchUserInteractions']) === 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); }, /** * 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 {string} identifier Cast identifier (It\&#39;s either a URL or a hash)) * @param {number} [limit] Number of casts to consider in a summary up to a point of target cast (Default: 20, Maximum: 50) * @param {string} [prompt] Additional prompt used to generate a summary * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<ConversationSummary>} A promise that resolves to a `ConversationSummary` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-cast-conversation-summary) * */ async lookupCastConversationSummary(identifier, limit, prompt, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.lookupCastConversationSummary(identifier, limit, prompt, 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['AgentsApi.lookupCastConversationSummary']) === 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.AgentsApiFp = AgentsApiFp; /** * AgentsApi - factory interface * @export */ const AgentsApiFactory = function (configuration, basePath, axios) { const localVarFp = (0, exports.AgentsApiFp)(configuration); return { /** * 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 {AgentsApiCreateTransactionPayFrameRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<TransactionFrameResponse>} A promise that resolves to a `TransactionFrameResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/create-transaction-pay-frame) * */ createTransactionPayFrame(requestParameters, options) { return localVarFp.createTransactionPayFrame(requestParameters.framePayTransactionReqBody, options).then((request) => request(axios, basePath)); }, /** * Returns a list of interactions between two users * @summary User interactions * @param {AgentsApiFetchUserInteractionsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<FetchUserInteractions200Response>} A promise that resolves to a `FetchUserInteractions200Response` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-interactions) * */ fetchUserInteractions(requestParameters, options) { return localVarFp.fetchUserInteractions(requestParameters.fids, requestParameters.type, options).then((request) => request(axios, basePath)); }, /** * 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 {AgentsApiLookupCastConversationSummaryRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<ConversationSummary>} A promise that resolves to a `ConversationSummary` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-cast-conversation-summary) * */ lookupCastConversationSummary(requestParameters, options) { return localVarFp.lookupCastConversationSummary(requestParameters.identifier, requestParameters.limit, requestParameters.prompt, options).then((request) => request(axios, basePath)); }, }; }; exports.AgentsApiFactory = AgentsApiFactory; /** * AgentsApi - object-oriented interface * @export * @class AgentsApi * @extends {BaseAPI} */ class AgentsApi extends base_1.BaseAPI { /** * 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 {AgentsApiCreateTransactionPayFrameRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AgentsApi * @returns {Promise<TransactionFrameResponse>} A promise that resolves to a `TransactionFrameResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/create-transaction-pay-frame) * */ createTransactionPayFrame(requestParameters, options) { return (0, exports.AgentsApiFp)(this.configuration).createTransactionPayFrame(requestParameters.framePayTransactionReqBody, options).then((request) => request(this.axios, this.basePath)); } /** * Returns a list of interactions between two users * @summary User interactions * @param {AgentsApiFetchUserInteractionsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AgentsApi * @returns {Promise<FetchUserInteractions200Response>} A promise that resolves to a `FetchUserInteractions200Response` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-interactions) * */ fetchUserInteractions(requestParameters, options) { return (0, exports.AgentsApiFp)(this.configuration).fetchUserInteractions(requestParameters.fids, requestParameters.type, options).then((request) => request(this.axios, this.basePath)); } /** * 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 {AgentsApiLookupCastConversationSummaryRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AgentsApi * @returns {Promise<ConversationSummary>} A promise that resolves to a `ConversationSummary` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-cast-conversation-summary) * */ lookupCastConversationSummary(requestParameters, options) { return (0, exports.AgentsApiFp)(this.configuration).lookupCastConversationSummary(requestParameters.identifier, requestParameters.limit, requestParameters.prompt, options).then((request) => request(this.axios, this.basePath)); } } exports.AgentsApi = AgentsApi; /** * @export */ exports.FetchUserInteractionsTypeEnum = { Follows: 'follows', Recasts: 'recasts', Likes: 'likes', Mentions: 'mentions', Replies: 'replies', Quotes: 'quotes' };