UNPKG

@neynar/nodejs-sdk

Version:

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

840 lines 102 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.34.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.LookupChannelTypeEnum = exports.FetchTrendingChannelsTimeWindowEnum = exports.FetchBulkChannelsTypeEnum = exports.ChannelApi = exports.ChannelApiFactory = exports.ChannelApiFp = exports.ChannelApiAxiosParamCreator = 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"); /** * ChannelApi - axios parameter creator * @export */ const ChannelApiAxiosParamCreator = function (configuration) { return { /** * Returns a list of all channels with their details * @summary Fetch all channels with their details * @param {number} [limit] Number of results to fetch (Default: 20, Maximum: 200) * @param {string} [cursor] Pagination cursor. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<ChannelListResponse>} A promise that resolves to a `ChannelListResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-all-channels) * */ fetchAllChannels: async (limit, cursor, options = {}) => { const localVarPath = `/v2/farcaster/channel/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 (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, }; }, /** * Returns details of multiple channels * @summary Bulk fetch * @param {string} ids Comma separated list of channel IDs or parent_urls, up to 100 at a time * @param {FetchBulkChannelsTypeEnum} [type] Type of identifier being used to query the channels. Defaults to ID. * @param {number} [viewerFid] FID of the user viewing the channels. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<ChannelResponseBulk>} A promise that resolves to a `ChannelResponseBulk` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-bulk-channels) * */ fetchBulkChannels: async (ids, type, viewerFid, options = {}) => { // verify required parameter 'ids' is not null or undefined (0, common_1.assertParamExists)('fetchBulkChannels', 'ids', ids); const localVarPath = `/v2/farcaster/channel/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 (ids !== undefined) { localVarQueryParameter['ids'] = ids; } if (type !== undefined) { localVarQueryParameter['type'] = type; } if (viewerFid !== undefined) { localVarQueryParameter['viewer_fid'] = viewerFid; } (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 invites, either in a channel or for a user. If both are provided, open channel invite for that user is returned. * @summary Open invites * @param {string} [channelId] Channel ID for the channel being queried * @param {number} [invitedFid] FID of the user being invited * @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<ChannelMemberInviteListResponse>} A promise that resolves to a `ChannelMemberInviteListResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-channel-invites) * */ fetchChannelInvites: async (channelId, invitedFid, limit, cursor, options = {}) => { const localVarPath = `/v2/farcaster/channel/member/invite/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 (channelId !== undefined) { localVarQueryParameter['channel_id'] = channelId; } if (invitedFid !== undefined) { localVarQueryParameter['invited_fid'] = invitedFid; } 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, }; }, /** * Fetch a list of members in a channel * @summary Fetch members * @param {string} channelId Channel ID for the channel being queried * @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} [fid] FID of the user being queried. Specify this to check if a user is a member of the channel without paginating through all members. * @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<ChannelMemberListResponse>} A promise that resolves to a `ChannelMemberListResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-channel-members) * */ fetchChannelMembers: async (channelId, xNeynarExperimental, fid, limit, cursor, options = {}) => { // verify required parameter 'channelId' is not null or undefined (0, common_1.assertParamExists)('fetchChannelMembers', 'channelId', channelId); const localVarPath = `/v2/farcaster/channel/member/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 (channelId !== undefined) { localVarQueryParameter['channel_id'] = channelId; } 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, }; }, /** * Returns a list of followers for a specific channel. Max limit is 1000. Use cursor for pagination. * @summary For channel * @param {string} id Channel ID for the channel being queried * @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 a list of followers that respects this user\&#39;s mutes and blocks and includes &#x60;viewer_context&#x60;. * @param {string} [cursor] Pagination cursor. * @param {number} [limit] Number of followers to fetch (Default: 25, Maximum: 1000) * @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-followers-for-a-channel) * */ fetchFollowersForAChannel: async (id, xNeynarExperimental, viewerFid, cursor, limit, options = {}) => { // verify required parameter 'id' is not null or undefined (0, common_1.assertParamExists)('fetchFollowersForAChannel', 'id', id); const localVarPath = `/v2/farcaster/channel/followers/`; // 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 (id !== undefined) { localVarQueryParameter['id'] = id; } if (viewerFid !== undefined) { localVarQueryParameter['viewer_fid'] = viewerFid; } if (cursor !== undefined) { localVarQueryParameter['cursor'] = cursor; } if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } 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, }; }, /** * Returns a list of relevant channel followers for a specific FID. This usually shows on a channel as \"X, Y, Z follow this channel\". * @summary Relevant followers * @param {string} id Channel ID being queried * @param {number} viewerFid The FID of the user to customize this response for. Providing this will also return a list of followers that respects this user\&#39;s mutes and blocks and includes &#x60;viewer_context&#x60;. * @param {boolean} [xNeynarExperimental] Enables experimental features including filtering based on the Neynar score. See [docs](https://neynar.notion.site/Experimental-Features-1d2655195a8b80eb98b4d4ae7b76ae4a) for more details. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<RelevantFollowersResponse>} A promise that resolves to a `RelevantFollowersResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-relevant-followers-for-a-channel) * */ fetchRelevantFollowersForAChannel: async (id, viewerFid, xNeynarExperimental, options = {}) => { // verify required parameter 'id' is not null or undefined (0, common_1.assertParamExists)('fetchRelevantFollowersForAChannel', 'id', id); // verify required parameter 'viewerFid' is not null or undefined (0, common_1.assertParamExists)('fetchRelevantFollowersForAChannel', 'viewerFid', viewerFid); const localVarPath = `/v2/farcaster/channel/followers/relevant/`; // 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 (id !== undefined) { localVarQueryParameter['id'] = id; } 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, }; }, /** * Returns a list of trending channels based on activity * @summary Channels by activity * @param {FetchTrendingChannelsTimeWindowEnum} [timeWindow] * @param {number} [limit] Number of results to fetch (Default: 10, Maximum: 25) * @param {string} [cursor] Pagination cursor. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<TrendingChannelResponse>} A promise that resolves to a `TrendingChannelResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-trending-channels) * */ fetchTrendingChannels: async (timeWindow, limit, cursor, options = {}) => { const localVarPath = `/v2/farcaster/channel/trending/`; // 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 (timeWindow !== undefined) { localVarQueryParameter['time_window'] = timeWindow; } 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, }; }, /** * Returns a list of all channels with their details that an FID is a member of. Data may have a delay of up to 1 hour. * @summary Member of * @param {number} fid The FID of the user. * @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<ChannelMemberListResponse>} A promise that resolves to a `ChannelMemberListResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-channel-memberships) * */ fetchUserChannelMemberships: async (fid, limit, cursor, options = {}) => { // verify required parameter 'fid' is not null or undefined (0, common_1.assertParamExists)('fetchUserChannelMemberships', 'fid', fid); const localVarPath = `/v2/farcaster/user/memberships/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; } (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 a list of all channels with their details that a FID follows. * @summary Following * @param {number} fid The FID of the user. * @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<ChannelListResponse>} A promise that resolves to a `ChannelListResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-channels) * */ fetchUserChannels: async (fid, limit, cursor, options = {}) => { // verify required parameter 'fid' is not null or undefined (0, common_1.assertParamExists)('fetchUserChannels', 'fid', fid); const localVarPath = `/v2/farcaster/user/channels/`; // 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, }; }, /** * Fetches all channels that a user has casted in, in reverse chronological order. * @summary Fetch channels that user is active in * @param {number} fid The user\&#39;s FID (identifier) * @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<UsersActiveChannelsResponse>} A promise that resolves to a `UsersActiveChannelsResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-users-active-channels) * */ fetchUsersActiveChannels: async (fid, limit, cursor, options = {}) => { // verify required parameter 'fid' is not null or undefined (0, common_1.assertParamExists)('fetchUsersActiveChannels', 'fid', fid); const localVarPath = `/v2/farcaster/channel/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: '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, }; }, /** * Follow a channel * @summary Follow a channel * @param {ChannelFollowReqBody} channelFollowReqBody * @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/follow-channel) * */ followChannel: async (channelFollowReqBody, options = {}) => { // verify required parameter 'channelFollowReqBody' is not null or undefined (0, common_1.assertParamExists)('followChannel', 'channelFollowReqBody', channelFollowReqBody); const localVarPath = `/v2/farcaster/channel/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)(channelFollowReqBody, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Invite a user to a channel * @summary Invite * @param {InviteChannelMemberReqBody} inviteChannelMemberReqBody * @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/invite-channel-member) * */ inviteChannelMember: async (inviteChannelMemberReqBody, options = {}) => { // verify required parameter 'inviteChannelMemberReqBody' is not null or undefined (0, common_1.assertParamExists)('inviteChannelMember', 'inviteChannelMemberReqBody', inviteChannelMemberReqBody); const localVarPath = `/v2/farcaster/channel/member/invite/`; // 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)(inviteChannelMemberReqBody, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Returns details of a channel * @summary By ID or parent_url * @param {string} id Channel ID for the channel being queried * @param {LookupChannelTypeEnum} [type] Type of identifier being used to query the channel. Defaults to ID. * @param {number} [viewerFid] FID of the user viewing the channel. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<ChannelResponse>} A promise that resolves to a `ChannelResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-channel) * */ lookupChannel: async (id, type, viewerFid, options = {}) => { // verify required parameter 'id' is not null or undefined (0, common_1.assertParamExists)('lookupChannel', 'id', id); const localVarPath = `/v2/farcaster/channel/`; // 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 (id !== undefined) { localVarQueryParameter['id'] = id; } if (type !== undefined) { localVarQueryParameter['type'] = type; } if (viewerFid !== undefined) { localVarQueryParameter['viewer_fid'] = viewerFid; } (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, }; }, /** * Remove a user from a channel or a user\'s invite to a channel role * @summary Remove user * @param {RemoveChannelMemberReqBody} removeChannelMemberReqBody * @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/remove-channel-member) * */ removeChannelMember: async (removeChannelMemberReqBody, options = {}) => { // verify required parameter 'removeChannelMemberReqBody' is not null or undefined (0, common_1.assertParamExists)('removeChannelMember', 'removeChannelMemberReqBody', removeChannelMemberReqBody); const localVarPath = `/v2/farcaster/channel/member/`; // 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)(removeChannelMemberReqBody, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Accept or reject a channel invite * @summary Accept or reject an invite * @param {RespondChannelInviteReqBody} respondChannelInviteReqBody * @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/respond-channel-invite) * */ respondChannelInvite: async (respondChannelInviteReqBody, options = {}) => { // verify required parameter 'respondChannelInviteReqBody' is not null or undefined (0, common_1.assertParamExists)('respondChannelInvite', 'respondChannelInviteReqBody', respondChannelInviteReqBody); const localVarPath = `/v2/farcaster/channel/member/invite/`; // 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: 'PUT' }, 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)(respondChannelInviteReqBody, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Returns a list of channels based on ID or name * @summary Search by ID or name * @param {string} q Channel ID or name for the channel being queried * @param {number} [limit] Number of results to fetch (Default: 20, Maximum: 200) * @param {string} [cursor] Pagination cursor. * @param {number} [viewerFid] FID of the user viewing the channels. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<ChannelSearchResponse>} A promise that resolves to a `ChannelSearchResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/search-channels) * */ searchChannels: async (q, limit, cursor, viewerFid, options = {}) => { // verify required parameter 'q' is not null or undefined (0, common_1.assertParamExists)('searchChannels', 'q', q); const localVarPath = `/v2/farcaster/channel/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 (limit !== undefined) { localVarQueryParameter['limit'] = limit; } if (cursor !== undefined) { localVarQueryParameter['cursor'] = cursor; } if (viewerFid !== undefined) { localVarQueryParameter['viewer_fid'] = viewerFid; } (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 channel * @summary Unfollow a channel * @param {ChannelFollowReqBody} channelFollowReqBody * @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/unfollow-channel) * */ unfollowChannel: async (channelFollowReqBody, options = {}) => { // verify required parameter 'channelFollowReqBody' is not null or undefined (0, common_1.assertParamExists)('unfollowChannel', 'channelFollowReqBody', channelFollowReqBody); const localVarPath = `/v2/farcaster/channel/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)(channelFollowReqBody, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; exports.ChannelApiAxiosParamCreator = ChannelApiAxiosParamCreator; /** * ChannelApi - functional programming interface * @export */ const ChannelApiFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.ChannelApiAxiosParamCreator)(configuration); return { /** * Returns a list of all channels with their details * @summary Fetch all channels with their details * @param {number} [limit] Number of results to fetch (Default: 20, Maximum: 200) * @param {string} [cursor] Pagination cursor. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<ChannelListResponse>} A promise that resolves to a `ChannelListResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-all-channels) * */ async fetchAllChannels(limit, cursor, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.fetchAllChannels(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['ChannelApi.fetchAllChannels']) === 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 details of multiple channels * @summary Bulk fetch * @param {string} ids Comma separated list of channel IDs or parent_urls, up to 100 at a time * @param {FetchBulkChannelsTypeEnum} [type] Type of identifier being used to query the channels. Defaults to ID. * @param {number} [viewerFid] FID of the user viewing the channels. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<ChannelResponseBulk>} A promise that resolves to a `ChannelResponseBulk` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-bulk-channels) * */ async fetchBulkChannels(ids, type, viewerFid, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.fetchBulkChannels(ids, type, 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['ChannelApi.fetchBulkChannels']) === 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 invites, either in a channel or for a user. If both are provided, open channel invite for that user is returned. * @summary Open invites * @param {string} [channelId] Channel ID for the channel being queried * @param {number} [invitedFid] FID of the user being invited * @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<ChannelMemberInviteListResponse>} A promise that resolves to a `ChannelMemberInviteListResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-channel-invites) * */ async fetchChannelInvites(channelId, invitedFid, limit, cursor, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.fetchChannelInvites(channelId, invitedFid, limit, cursor, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a :