UNPKG

@neynar/nodejs-sdk

Version:

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

370 lines (369 loc) 21.1 kB
"use strict"; /* tslint:disable */ /* eslint-disable */ /** * Farcaster Hub API * Perform basic queries of Farcaster state via the REST API of a Farcaster hub. See the [Neynar docs](https://docs.neynar.com/reference) for more details. * * The version of the OpenAPI document: 2.35.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.LinksApi = exports.LinksApiFactory = exports.LinksApiFp = exports.LinksApiAxiosParamCreator = 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"); /** * LinksApi - axios parameter creator * @export */ const LinksApiAxiosParamCreator = function (configuration) { return { /** * Fetch a list of users that are following a user. * @summary To target FID * @param {number} targetFid The FID of the target user for this link * @param {LinkType} [linkType] * @param {number} [pageSize] Maximum number of messages to return in a single response * @param {boolean} [reverse] Reverse the sort order, returning latest messages first * @param {string} [pageToken] The page token returned by the previous query, to fetch the next page. If this parameter is empty, fetch the first page * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<FetchUserFollowing200Response>} A promise that resolves to a `FetchUserFollowing200Response` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-followers) * */ fetchUserFollowers: async (targetFid, linkType, pageSize, reverse, pageToken, options = {}) => { // verify required parameter 'targetFid' is not null or undefined (0, common_1.assertParamExists)('fetchUserFollowers', 'targetFid', targetFid); const localVarPath = `/v1/linksByTargetFid`; // 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 (targetFid !== undefined) { localVarQueryParameter['target_fid'] = targetFid; } if (linkType !== undefined) { localVarQueryParameter['link_type'] = linkType; } if (pageSize !== undefined) { localVarQueryParameter['pageSize'] = pageSize; } if (reverse !== undefined) { localVarQueryParameter['reverse'] = reverse; } if (pageToken !== undefined) { localVarQueryParameter['pageToken'] = pageToken; } (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 list of users that a user is following. * @summary From source FID * @param {number} fid The FID of the link\&#39;s originator * @param {LinkType} [linkType] * @param {number} [pageSize] Maximum number of messages to return in a single response * @param {boolean} [reverse] Reverse the sort order, returning latest messages first * @param {string} [pageToken] The page token returned by the previous query, to fetch the next page. If this parameter is empty, fetch the first page * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<FetchUserFollowing200Response>} A promise that resolves to a `FetchUserFollowing200Response` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-following) * */ fetchUserFollowing: async (fid, linkType, pageSize, reverse, pageToken, options = {}) => { // verify required parameter 'fid' is not null or undefined (0, common_1.assertParamExists)('fetchUserFollowing', 'fid', fid); const localVarPath = `/v1/linksByFid`; // 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 (linkType !== undefined) { localVarQueryParameter['link_type'] = linkType; } if (pageSize !== undefined) { localVarQueryParameter['pageSize'] = pageSize; } if (reverse !== undefined) { localVarQueryParameter['reverse'] = reverse; } if (pageToken !== undefined) { localVarQueryParameter['pageToken'] = pageToken; } (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, }; }, /** * Lookup a link by its FID and target FID. * @summary By its FID and target FID * @param {number} fid The FID of the link\&#39;s originator * @param {number} targetFid The FID of the target user for this link * @param {LinkType} linkType * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<LinkAdd>} A promise that resolves to a `LinkAdd` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-user-relation) * */ lookupUserRelation: async (fid, targetFid, linkType, options = {}) => { // verify required parameter 'fid' is not null or undefined (0, common_1.assertParamExists)('lookupUserRelation', 'fid', fid); // verify required parameter 'targetFid' is not null or undefined (0, common_1.assertParamExists)('lookupUserRelation', 'targetFid', targetFid); // verify required parameter 'linkType' is not null or undefined (0, common_1.assertParamExists)('lookupUserRelation', 'linkType', linkType); const localVarPath = `/v1/linkById`; // 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 (targetFid !== undefined) { localVarQueryParameter['target_fid'] = targetFid; } if (linkType !== undefined) { localVarQueryParameter['link_type'] = linkType; } (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.LinksApiAxiosParamCreator = LinksApiAxiosParamCreator; /** * LinksApi - functional programming interface * @export */ const LinksApiFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.LinksApiAxiosParamCreator)(configuration); return { /** * Fetch a list of users that are following a user. * @summary To target FID * @param {number} targetFid The FID of the target user for this link * @param {LinkType} [linkType] * @param {number} [pageSize] Maximum number of messages to return in a single response * @param {boolean} [reverse] Reverse the sort order, returning latest messages first * @param {string} [pageToken] The page token returned by the previous query, to fetch the next page. If this parameter is empty, fetch the first page * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<FetchUserFollowing200Response>} A promise that resolves to a `FetchUserFollowing200Response` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-followers) * */ async fetchUserFollowers(targetFid, linkType, pageSize, reverse, pageToken, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.fetchUserFollowers(targetFid, linkType, pageSize, reverse, pageToken, 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['LinksApi.fetchUserFollowers']) === 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 a list of users that a user is following. * @summary From source FID * @param {number} fid The FID of the link\&#39;s originator * @param {LinkType} [linkType] * @param {number} [pageSize] Maximum number of messages to return in a single response * @param {boolean} [reverse] Reverse the sort order, returning latest messages first * @param {string} [pageToken] The page token returned by the previous query, to fetch the next page. If this parameter is empty, fetch the first page * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<FetchUserFollowing200Response>} A promise that resolves to a `FetchUserFollowing200Response` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-following) * */ async fetchUserFollowing(fid, linkType, pageSize, reverse, pageToken, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.fetchUserFollowing(fid, linkType, pageSize, reverse, pageToken, 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['LinksApi.fetchUserFollowing']) === 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); }, /** * Lookup a link by its FID and target FID. * @summary By its FID and target FID * @param {number} fid The FID of the link\&#39;s originator * @param {number} targetFid The FID of the target user for this link * @param {LinkType} linkType * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<LinkAdd>} A promise that resolves to a `LinkAdd` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-user-relation) * */ async lookupUserRelation(fid, targetFid, linkType, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.lookupUserRelation(fid, targetFid, linkType, 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['LinksApi.lookupUserRelation']) === 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.LinksApiFp = LinksApiFp; /** * LinksApi - factory interface * @export */ const LinksApiFactory = function (configuration, basePath, axios) { const localVarFp = (0, exports.LinksApiFp)(configuration); return { /** * Fetch a list of users that are following a user. * @summary To target FID * @param {LinksApiFetchUserFollowersRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<FetchUserFollowing200Response>} A promise that resolves to a `FetchUserFollowing200Response` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-followers) * */ fetchUserFollowers(requestParameters, options) { return localVarFp.fetchUserFollowers(requestParameters.targetFid, requestParameters.linkType, requestParameters.pageSize, requestParameters.reverse, requestParameters.pageToken, options).then((request) => request(axios, basePath)); }, /** * Fetch a list of users that a user is following. * @summary From source FID * @param {LinksApiFetchUserFollowingRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<FetchUserFollowing200Response>} A promise that resolves to a `FetchUserFollowing200Response` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-following) * */ fetchUserFollowing(requestParameters, options) { return localVarFp.fetchUserFollowing(requestParameters.fid, requestParameters.linkType, requestParameters.pageSize, requestParameters.reverse, requestParameters.pageToken, options).then((request) => request(axios, basePath)); }, /** * Lookup a link by its FID and target FID. * @summary By its FID and target FID * @param {LinksApiLookupUserRelationRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<LinkAdd>} A promise that resolves to a `LinkAdd` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-user-relation) * */ lookupUserRelation(requestParameters, options) { return localVarFp.lookupUserRelation(requestParameters.fid, requestParameters.targetFid, requestParameters.linkType, options).then((request) => request(axios, basePath)); }, }; }; exports.LinksApiFactory = LinksApiFactory; /** * LinksApi - object-oriented interface * @export * @class LinksApi * @extends {BaseAPI} */ class LinksApi extends base_1.BaseAPI { /** * Fetch a list of users that are following a user. * @summary To target FID * @param {LinksApiFetchUserFollowersRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof LinksApi * @returns {Promise<FetchUserFollowing200Response>} A promise that resolves to a `FetchUserFollowing200Response` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-followers) * */ fetchUserFollowers(requestParameters, options) { return (0, exports.LinksApiFp)(this.configuration).fetchUserFollowers(requestParameters.targetFid, requestParameters.linkType, requestParameters.pageSize, requestParameters.reverse, requestParameters.pageToken, options).then((request) => request(this.axios, this.basePath)); } /** * Fetch a list of users that a user is following. * @summary From source FID * @param {LinksApiFetchUserFollowingRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof LinksApi * @returns {Promise<FetchUserFollowing200Response>} A promise that resolves to a `FetchUserFollowing200Response` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-following) * */ fetchUserFollowing(requestParameters, options) { return (0, exports.LinksApiFp)(this.configuration).fetchUserFollowing(requestParameters.fid, requestParameters.linkType, requestParameters.pageSize, requestParameters.reverse, requestParameters.pageToken, options).then((request) => request(this.axios, this.basePath)); } /** * Lookup a link by its FID and target FID. * @summary By its FID and target FID * @param {LinksApiLookupUserRelationRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof LinksApi * @returns {Promise<LinkAdd>} A promise that resolves to a `LinkAdd` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-user-relation) * */ lookupUserRelation(requestParameters, options) { return (0, exports.LinksApiFp)(this.configuration).lookupUserRelation(requestParameters.fid, requestParameters.targetFid, requestParameters.linkType, options).then((request) => request(this.axios, this.basePath)); } } exports.LinksApi = LinksApi;