UNPKG

@neynar/nodejs-sdk

Version:

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

331 lines (330 loc) 18.3 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.MuteApi = exports.MuteApiFactory = exports.MuteApiFp = exports.MuteApiAxiosParamCreator = 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"); /** * MuteApi - axios parameter creator * @export */ const MuteApiAxiosParamCreator = function (configuration) { return { /** * Deletes a mute for a given FID. This is an allowlisted API, reach out if you want access. * @summary Unmute FID * @param {MuteReqBody} muteReqBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<MuteResponse>} A promise that resolves to a `MuteResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/delete-mute) * */ deleteMute: async (muteReqBody, options = {}) => { // verify required parameter 'muteReqBody' is not null or undefined (0, common_1.assertParamExists)('deleteMute', 'muteReqBody', muteReqBody); const localVarPath = `/v2/farcaster/mute/`; // 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)(muteReqBody, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Fetches all FIDs that a user has muted. * @summary Muted FIDs of user * @param {number} fid The user\&#39;s FID (identifier) * @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: 20, Maximum: 100) * @param {string} [cursor] Pagination cursor. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<MuteListResponse>} A promise that resolves to a `MuteListResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-mute-list) * */ fetchMuteList: async (fid, xNeynarExperimental, limit, cursor, options = {}) => { // verify required parameter 'fid' is not null or undefined (0, common_1.assertParamExists)('fetchMuteList', 'fid', fid); const localVarPath = `/v2/farcaster/mute/list/`; // 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 (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, }; }, /** * Adds a mute for a given FID. This is an allowlisted API, reach out if you want access. * @summary Mute FID * @param {MuteReqBody} muteReqBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<MuteResponse>} A promise that resolves to a `MuteResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/publish-mute) * */ publishMute: async (muteReqBody, options = {}) => { // verify required parameter 'muteReqBody' is not null or undefined (0, common_1.assertParamExists)('publishMute', 'muteReqBody', muteReqBody); const localVarPath = `/v2/farcaster/mute/`; // 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)(muteReqBody, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; exports.MuteApiAxiosParamCreator = MuteApiAxiosParamCreator; /** * MuteApi - functional programming interface * @export */ const MuteApiFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.MuteApiAxiosParamCreator)(configuration); return { /** * Deletes a mute for a given FID. This is an allowlisted API, reach out if you want access. * @summary Unmute FID * @param {MuteReqBody} muteReqBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<MuteResponse>} A promise that resolves to a `MuteResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/delete-mute) * */ async deleteMute(muteReqBody, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.deleteMute(muteReqBody, 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['MuteApi.deleteMute']) === 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); }, /** * Fetches all FIDs that a user has muted. * @summary Muted FIDs of user * @param {number} fid The user\&#39;s FID (identifier) * @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: 20, Maximum: 100) * @param {string} [cursor] Pagination cursor. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<MuteListResponse>} A promise that resolves to a `MuteListResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-mute-list) * */ async fetchMuteList(fid, xNeynarExperimental, limit, cursor, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.fetchMuteList(fid, xNeynarExperimental, 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['MuteApi.fetchMuteList']) === 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); }, /** * Adds a mute for a given FID. This is an allowlisted API, reach out if you want access. * @summary Mute FID * @param {MuteReqBody} muteReqBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<MuteResponse>} A promise that resolves to a `MuteResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/publish-mute) * */ async publishMute(muteReqBody, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.publishMute(muteReqBody, 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['MuteApi.publishMute']) === 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.MuteApiFp = MuteApiFp; /** * MuteApi - factory interface * @export */ const MuteApiFactory = function (configuration, basePath, axios) { const localVarFp = (0, exports.MuteApiFp)(configuration); return { /** * Deletes a mute for a given FID. This is an allowlisted API, reach out if you want access. * @summary Unmute FID * @param {MuteApiDeleteMuteRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<MuteResponse>} A promise that resolves to a `MuteResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/delete-mute) * */ deleteMute(requestParameters, options) { return localVarFp.deleteMute(requestParameters.muteReqBody, options).then((request) => request(axios, basePath)); }, /** * Fetches all FIDs that a user has muted. * @summary Muted FIDs of user * @param {MuteApiFetchMuteListRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<MuteListResponse>} A promise that resolves to a `MuteListResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-mute-list) * */ fetchMuteList(requestParameters, options) { return localVarFp.fetchMuteList(requestParameters.fid, requestParameters.xNeynarExperimental, requestParameters.limit, requestParameters.cursor, options).then((request) => request(axios, basePath)); }, /** * Adds a mute for a given FID. This is an allowlisted API, reach out if you want access. * @summary Mute FID * @param {MuteApiPublishMuteRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<MuteResponse>} A promise that resolves to a `MuteResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/publish-mute) * */ publishMute(requestParameters, options) { return localVarFp.publishMute(requestParameters.muteReqBody, options).then((request) => request(axios, basePath)); }, }; }; exports.MuteApiFactory = MuteApiFactory; /** * MuteApi - object-oriented interface * @export * @class MuteApi * @extends {BaseAPI} */ class MuteApi extends base_1.BaseAPI { /** * Deletes a mute for a given FID. This is an allowlisted API, reach out if you want access. * @summary Unmute FID * @param {MuteApiDeleteMuteRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof MuteApi * @returns {Promise<MuteResponse>} A promise that resolves to a `MuteResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/delete-mute) * */ deleteMute(requestParameters, options) { return (0, exports.MuteApiFp)(this.configuration).deleteMute(requestParameters.muteReqBody, options).then((request) => request(this.axios, this.basePath)); } /** * Fetches all FIDs that a user has muted. * @summary Muted FIDs of user * @param {MuteApiFetchMuteListRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof MuteApi * @returns {Promise<MuteListResponse>} A promise that resolves to a `MuteListResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-mute-list) * */ fetchMuteList(requestParameters, options) { return (0, exports.MuteApiFp)(this.configuration).fetchMuteList(requestParameters.fid, requestParameters.xNeynarExperimental, requestParameters.limit, requestParameters.cursor, options).then((request) => request(this.axios, this.basePath)); } /** * Adds a mute for a given FID. This is an allowlisted API, reach out if you want access. * @summary Mute FID * @param {MuteApiPublishMuteRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof MuteApi * @returns {Promise<MuteResponse>} A promise that resolves to a `MuteResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/publish-mute) * */ publishMute(requestParameters, options) { return (0, exports.MuteApiFp)(this.configuration).publishMute(requestParameters.muteReqBody, options).then((request) => request(this.axios, this.basePath)); } } exports.MuteApi = MuteApi;