@neynar/nodejs-sdk
Version:
SDK to interact with Neynar APIs (https://docs.neynar.com/reference/quickstart)
783 lines • 101 kB
JavaScript
"use strict";
/* tslint:disable */
/* eslint-disable */
/**
* Neynar API
* The Neynar API allows you to interact with the Farcaster protocol among other things. See the [Neynar docs](https://docs.neynar.com/reference) for more details.
*
* The version of the OpenAPI document: 3.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.FetchBulkUsersByEthOrSolAddressAddressTypesEnum = exports.UserApi = exports.UserApiFactory = exports.UserApiFp = exports.UserApiAxiosParamCreator = 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");
/**
* UserApi - axios parameter creator
* @export
*/
const UserApiAxiosParamCreator = function (configuration) {
return {
/**
* Removes verification for an eth address for the user (In order to delete verification `signer_uuid` must be approved)
* @summary Delete verification
* @param {RemoveVerificationReqBody} removeVerificationReqBody
* @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-verification)
*
*/
deleteVerification: async (removeVerificationReqBody, options = {}) => {
// verify required parameter 'removeVerificationReqBody' is not null or undefined
(0, common_1.assertParamExists)('deleteVerification', 'removeVerificationReqBody', removeVerificationReqBody);
const localVarPath = `/v2/farcaster/user/verification/`;
// 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)(removeVerificationReqBody, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Fetches information about multiple users based on FIDs
* @summary By FIDs
* @param {string} fids Comma separated list of FIDs, up to 100 at a time
* @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 {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<BulkUsersResponse>} A promise that resolves to a `BulkUsersResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-bulk-users)
*
*/
fetchBulkUsers: async (fids, xNeynarExperimental, viewerFid, options = {}) => {
// verify required parameter 'fids' is not null or undefined
(0, common_1.assertParamExists)('fetchBulkUsers', 'fids', fids);
const localVarPath = `/v2/farcaster/user/bulk/`;
// 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 (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,
};
},
/**
* Fetches all users based on multiple Ethereum or Solana addresses. Each farcaster user has a custody Ethereum address and optionally verified Ethereum or Solana addresses. This endpoint returns all users that have any of the given addresses as their custody or verified Ethereum or Solana addresses. A custody address can be associated with only 1 farcaster user at a time but a verified address can be associated with multiple users. You can pass in Ethereum and Solana addresses, comma separated, in the same request. The response will contain users associated with the given addresses.
* @summary By Eth or Sol addresses
* @param {string} addresses Comma separated list of Ethereum addresses, up to 350 at a time
* @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 {Array<FetchBulkUsersByEthOrSolAddressAddressTypesEnum>} [addressTypes] Customize which address types the request should search for. This is a comma-separated string that can include the following values: \'custody_address\' and \'verified_address\'. By default api returns both. To select multiple types, use a comma-separated list of these values.
* @param {number} [viewerFid]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<BulkUsersByAddressResponse>} A promise that resolves to a `BulkUsersByAddressResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-bulk-users-by-eth-or-sol-address)
*
*/
fetchBulkUsersByEthOrSolAddress: async (addresses, xNeynarExperimental, addressTypes, viewerFid, options = {}) => {
// verify required parameter 'addresses' is not null or undefined
(0, common_1.assertParamExists)('fetchBulkUsersByEthOrSolAddress', 'addresses', addresses);
const localVarPath = `/v2/farcaster/user/bulk-by-address/`;
// 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 (addresses !== undefined) {
localVarQueryParameter['addresses'] = addresses;
}
if (addressTypes) {
localVarQueryParameter['address_types'] = addressTypes;
}
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,
};
},
/**
* Fetches a list of users given a location
* @summary By location
* @param {number | null} latitude Latitude of the location
* @param {number | null} longitude Longitude of the location
* @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] FID of the user viewing the feed. Providing this will return a list of users that respects this user\'s mutes and blocks and includes `viewer_context`.
* @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<UsersResponse>} A promise that resolves to a `UsersResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-users-by-location)
*
*/
fetchUsersByLocation: async (latitude, longitude, xNeynarExperimental, viewerFid, limit, cursor, options = {}) => {
// verify required parameter 'latitude' is not null or undefined
(0, common_1.assertParamExists)('fetchUsersByLocation', 'latitude', latitude);
// verify required parameter 'longitude' is not null or undefined
(0, common_1.assertParamExists)('fetchUsersByLocation', 'longitude', longitude);
const localVarPath = `/v2/farcaster/user/by_location/`;
// 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 (latitude !== undefined) {
localVarQueryParameter['latitude'] = latitude;
}
if (longitude !== undefined) {
localVarQueryParameter['longitude'] = longitude;
}
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,
};
},
/**
* Fetch all Ethereum and Solana verified addresses for a Farcaster user. Use this endpoint to identify which wallets are associated with which Farcaster applications for the specified user.
* @summary Fetch verifications
* @param {number | null} fid FID of the user whose verifications to fetch
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FetchVerifications200Response>} A promise that resolves to a `FetchVerifications200Response` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-verifications)
*
*/
fetchVerifications: async (fid, options = {}) => {
// verify required parameter 'fid' is not null or undefined
(0, common_1.assertParamExists)('fetchVerifications', 'fid', fid);
const localVarPath = `/v2/farcaster/user/verifications/`;
// 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;
}
(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,
};
},
/**
* Follow a user (In order to follow a user `signer_uuid` must be approved)
* @summary Follow user
* @param {FollowReqBody} followReqBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<BulkFollowResponse>} A promise that resolves to a `BulkFollowResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/follow-user)
*
*/
followUser: async (followReqBody, options = {}) => {
// verify required parameter 'followReqBody' is not null or undefined
(0, common_1.assertParamExists)('followUser', 'followReqBody', followReqBody);
const localVarPath = `/v2/farcaster/user/follow/`;
// 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)(followReqBody, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Fetches FID to [assign it to new user](https://docs.neynar.com/reference/register-account).
* @summary Fetch fresh FID
* @param {string} xWalletId Wallet ID to use for transactions
* @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 {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<UserFIDResponse>} A promise that resolves to a `UserFIDResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/get-fresh-account-fid)
*
*/
getFreshAccountFID: async (xWalletId, xNeynarExperimental, options = {}) => {
// verify required parameter 'xWalletId' is not null or undefined
(0, common_1.assertParamExists)('getFreshAccountFID', 'xWalletId', xWalletId);
const localVarPath = `/v2/farcaster/user/fid/`;
// 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 (xNeynarExperimental != null) {
localVarHeaderParameter['x-neynar-experimental'] = typeof xNeynarExperimental === 'string'
? xNeynarExperimental
: JSON.stringify(xNeynarExperimental);
}
if (xWalletId != null) {
localVarHeaderParameter['x-wallet-id'] = String(xWalletId);
}
(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,
};
},
/**
* Returns the best friends of a user ranked by mutual affinity score based on interactions with each other.
* @summary Best friends
* @param {number} fid The FID of the user
* @param {number} [limit] Number of results to fetch (Default: 3, Maximum: 100)
* @param {string} [cursor] Pagination cursor
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<BestFriendsResponse>} A promise that resolves to a `BestFriendsResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/get-user-best-friends)
*
*/
getUserBestFriends: async (fid, limit, cursor, options = {}) => {
// verify required parameter 'fid' is not null or undefined
(0, common_1.assertParamExists)('getUserBestFriends', 'fid', fid);
const localVarPath = `/v2/farcaster/user/best_friends/`;
// 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;
}
(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 user by custody-address
* @summary By custody-address
* @param {string} custodyAddress Custody Address associated with mnemonic
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<UserResponse>} A promise that resolves to a `UserResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-user-by-custody-address)
*
*/
lookupUserByCustodyAddress: async (custodyAddress, options = {}) => {
// verify required parameter 'custodyAddress' is not null or undefined
(0, common_1.assertParamExists)('lookupUserByCustodyAddress', 'custodyAddress', custodyAddress);
const localVarPath = `/v2/farcaster/user/custody-address/`;
// 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 (custodyAddress !== undefined) {
localVarQueryParameter['custody_address'] = custodyAddress;
}
(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,
};
},
/**
* Fetches a single hydrated user object given a username
* @summary By username
* @param {string} username Username of the user to fetch
* @param {boolean} [xNeynarExperimental] Enables experimental features including filtering based on the Neynar score. See [docs](https://neynar.notion.site/Experimental-Features-1d2655195a8b80eb98b4d4ae7b76ae4a) for more details.
* @param {number} [viewerFid]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<UserResponse>} A promise that resolves to a `UserResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-user-by-username)
*
*/
lookupUserByUsername: async (username, xNeynarExperimental, viewerFid, options = {}) => {
// verify required parameter 'username' is not null or undefined
(0, common_1.assertParamExists)('lookupUserByUsername', 'username', username);
const localVarPath = `/v2/farcaster/user/by_username/`;
// 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 (username !== undefined) {
localVarQueryParameter['username'] = username;
}
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,
};
},
/**
* Fetches the users who have verified the specified X (Twitter) username
* @summary By X username
* @param {string} xUsername X (Twitter) username to search for, without the @ symbol
* @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] FID of the viewer for contextual information like follows and blocks
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<BulkUsersResponse>} A promise that resolves to a `BulkUsersResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-users-by-x-username)
*
*/
lookupUsersByXUsername: async (xUsername, xNeynarExperimental, viewerFid, options = {}) => {
// verify required parameter 'xUsername' is not null or undefined
(0, common_1.assertParamExists)('lookupUsersByXUsername', 'xUsername', xUsername);
const localVarPath = `/v2/farcaster/user/by_x_username/`;
// 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 (xUsername !== undefined) {
localVarQueryParameter['x_username'] = xUsername;
}
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,
};
},
/**
* Adds verification for an eth address or contract for the user (In order to add verification `signer_uuid` must be approved)
* @summary Add verification
* @param {AddVerificationReqBody} addVerificationReqBody
* @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/publish-verification)
*
*/
publishVerification: async (addVerificationReqBody, options = {}) => {
// verify required parameter 'addVerificationReqBody' is not null or undefined
(0, common_1.assertParamExists)('publishVerification', 'addVerificationReqBody', addVerificationReqBody);
const localVarPath = `/v2/farcaster/user/verification/`;
// 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)(addVerificationReqBody, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Register account on farcaster. Optionally provide x-wallet-id header to use your own wallet. **Note:** This API must be called within 10 minutes of the fetch FID API call (i.e., /v2/farcaster/user/fid). Otherwise, Neynar will assign this FID to another available user.
* @summary Register new account
* @param {string} xWalletId Wallet ID to use for transactions
* @param {RegisterUserReqBody} registerUserReqBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<RegisterUserResponse>} A promise that resolves to a `RegisterUserResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/register-account)
*
*/
registerAccount: async (xWalletId, registerUserReqBody, options = {}) => {
// verify required parameter 'xWalletId' is not null or undefined
(0, common_1.assertParamExists)('registerAccount', 'xWalletId', xWalletId);
// verify required parameter 'registerUserReqBody' is not null or undefined
(0, common_1.assertParamExists)('registerAccount', 'registerUserReqBody', registerUserReqBody);
const localVarPath = `/v2/farcaster/user/`;
// 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);
if (xWalletId != null) {
localVarHeaderParameter['x-wallet-id'] = String(xWalletId);
}
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)(registerUserReqBody, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Search for Usernames
* @summary Search for Usernames
* @param {string} q
* @param {boolean} [xNeynarExperimental] Enables experimental features including filtering based on the Neynar score. See [docs](https://neynar.notion.site/Experimental-Features-1d2655195a8b80eb98b4d4ae7b76ae4a) for more details.
* @param {number} [viewerFid] Providing this will return search results that respects this user\'s mutes and blocks and includes `viewer_context`.
* @param {number} [limit] Number of users to fetch (Default: 5, Maximum: 10)
* @param {string} [cursor] Pagination cursor.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<UserSearchResponse>} A promise that resolves to a `UserSearchResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/search-user)
*
*/
searchUser: async (q, xNeynarExperimental, viewerFid, limit, cursor, options = {}) => {
// verify required parameter 'q' is not null or undefined
(0, common_1.assertParamExists)('searchUser', 'q', q);
const localVarPath = `/v2/farcaster/user/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 (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,
};
},
/**
* Unfollow a user (In order to unfollow a user `signer_uuid` must be approved)
* @summary Unfollow user
* @param {FollowReqBody} followReqBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<BulkFollowResponse>} A promise that resolves to a `BulkFollowResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/unfollow-user)
*
*/
unfollowUser: async (followReqBody, options = {}) => {
// verify required parameter 'followReqBody' is not null or undefined
(0, common_1.assertParamExists)('unfollowUser', 'followReqBody', followReqBody);
const localVarPath = `/v2/farcaster/user/follow/`;
// 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)(followReqBody, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Update user profile (In order to update user\'s profile `signer_uuid` must be approved)
* @summary Update user profile
* @param {UpdateUserReqBody} updateUserReqBody
* @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/update-user)
*
*/
updateUser: async (updateUserReqBody, options = {}) => {
// verify required parameter 'updateUserReqBody' is not null or undefined
(0, common_1.assertParamExists)('updateUser', 'updateUserReqBody', updateUserReqBody);
const localVarPath = `/v2/farcaster/user/`;
// 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: 'PATCH' }, 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)(updateUserReqBody, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
},
};
};
exports.UserApiAxiosParamCreator = UserApiAxiosParamCreator;
/**
* UserApi - functional programming interface
* @export
*/
const UserApiFp = function (configuration) {
const localVarAxiosParamCreator = (0, exports.UserApiAxiosParamCreator)(configuration);
return {
/**
* Removes verification for an eth address for the user (In order to delete verification `signer_uuid` must be approved)
* @summary Delete verification
* @param {RemoveVerificationReqBody} removeVerificationReqBody
* @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-verification)
*
*/
async deleteVerification(removeVerificationReqBody, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteVerification(removeVerificationReqBody, 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['UserApi.deleteVerification']) === 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 information about multiple users based on FIDs
* @summary By FIDs
* @param {string} fids Comma separated list of FIDs, up to 100 at a time
* @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 {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<BulkUsersResponse>} A promise that resolves to a `BulkUsersResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-bulk-users)
*
*/
async fetchBulkUsers(fids, xNeynarExperimental, viewerFid, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.fetchBulkUsers(fids, 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['UserApi.fetchBulkUsers']) === 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 users based on multiple Ethereum or Solana addresses. Each farcaster user has a custody Ethereum address and optionally verified Ethereum or Solana addresses. This endpoint returns all users that have any of the given addresses as their custody or verified Ethereum or Solana addresses. A custody address can be associated with only 1 farcaster user at a time but a verified address can be associated with multiple users. You can pass in Ethereum and Solana addresses, comma separated, in the same request. The response will contain users associated with the given addresses.
* @summary By Eth or Sol addresses
* @param {string} addresses Comma separated list of Ethereum addresses, up to 350 at a time
* @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 {Array<FetchBulkUsersByEthOrSolAddressAddressTypesEnum>} [addressTypes] Customize which address types the request should search for. This is a comma-separated string that can include the following values: \'custody_address\' and \'verified_address\'. By default api returns both. To select multiple types, use a comma-separated list of these values.
* @param {number} [viewerFid]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<BulkUsersByAddressResponse>} A promise that resolves to a `BulkUsersByAddressResponse` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-bulk-users-by-et