@neynar/nodejs-sdk
Version:
SDK to interact with Neynar APIs (https://docs.neynar.com/reference/quickstart)
328 lines (327 loc) • 20.2 kB
JavaScript
;
/* 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.OnChainEventsApi = exports.OnChainEventsApiFactory = exports.OnChainEventsApiFp = exports.OnChainEventsApiAxiosParamCreator = 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");
/**
* OnChainEventsApi - axios parameter creator
* @export
*/
const OnChainEventsApiAxiosParamCreator = function (configuration) {
return {
/**
* Fetch on-chain events provided by a user.
* @summary Fetch a list of on-chain events provided by an FID
* @param {number} fid The FID being requested
* @param {OnChainEventType} eventType The numeric or string value of the event type being requested
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FetchUserOnChainEvents200Response>} A promise that resolves to a `FetchUserOnChainEvents200Response` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-on-chain-events)
*
*/
fetchUserOnChainEvents: async (fid, eventType, options = {}) => {
// verify required parameter 'fid' is not null or undefined
(0, common_1.assertParamExists)('fetchUserOnChainEvents', 'fid', fid);
// verify required parameter 'eventType' is not null or undefined
(0, common_1.assertParamExists)('fetchUserOnChainEvents', 'eventType', eventType);
const localVarPath = `/v1/onChainEventsByFid`;
// 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 (eventType !== undefined) {
localVarQueryParameter['event_type'] = eventType;
}
(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,
};
},
/**
* **Note:** one of two different response schemas is returned based on whether the caller provides the `signer` parameter. If included, a single `OnChainEventSigner` message is returned (or a `not_found` error). If omitted, a non-paginated list of `OnChainEventSigner` messages is returned instead.
* @summary Fetch a list of signers provided by an FID
* @param {number} fid The FID being requested
* @param {string} [signer] The optional key of signer
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FetchUserOnChainSignersEvents200Response>} A promise that resolves to a `FetchUserOnChainSignersEvents200Response` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-on-chain-signers)
*
*/
fetchUserOnChainSignersEvents: async (fid, signer, options = {}) => {
// verify required parameter 'fid' is not null or undefined
(0, common_1.assertParamExists)('fetchUserOnChainSignersEvents', 'fid', fid);
const localVarPath = `/v1/onChainSignersByFid`;
// 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 (signer !== undefined) {
localVarQueryParameter['signer'] = signer;
}
(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 an on-chain ID Registry Event for a given Address.
* @summary Fetch an on-chain ID Registry Event for a given Address
* @param {string} address The ETH address being requested
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<OnChainEventIdRegister>} A promise that resolves to a `OnChainEventIdRegister` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-on-chain-id-registry-event-by-address)
*
*/
lookupOnChainIdRegistryEventByAddress: async (address, options = {}) => {
// verify required parameter 'address' is not null or undefined
(0, common_1.assertParamExists)('lookupOnChainIdRegistryEventByAddress', 'address', address);
const localVarPath = `/v1/onChainIdRegistryEventByAddress`;
// 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 (address !== undefined) {
localVarQueryParameter['address'] = address;
}
(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.OnChainEventsApiAxiosParamCreator = OnChainEventsApiAxiosParamCreator;
/**
* OnChainEventsApi - functional programming interface
* @export
*/
const OnChainEventsApiFp = function (configuration) {
const localVarAxiosParamCreator = (0, exports.OnChainEventsApiAxiosParamCreator)(configuration);
return {
/**
* Fetch on-chain events provided by a user.
* @summary Fetch a list of on-chain events provided by an FID
* @param {number} fid The FID being requested
* @param {OnChainEventType} eventType The numeric or string value of the event type being requested
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FetchUserOnChainEvents200Response>} A promise that resolves to a `FetchUserOnChainEvents200Response` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-on-chain-events)
*
*/
async fetchUserOnChainEvents(fid, eventType, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.fetchUserOnChainEvents(fid, eventType, 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['OnChainEventsApi.fetchUserOnChainEvents']) === 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);
},
/**
* **Note:** one of two different response schemas is returned based on whether the caller provides the `signer` parameter. If included, a single `OnChainEventSigner` message is returned (or a `not_found` error). If omitted, a non-paginated list of `OnChainEventSigner` messages is returned instead.
* @summary Fetch a list of signers provided by an FID
* @param {number} fid The FID being requested
* @param {string} [signer] The optional key of signer
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FetchUserOnChainSignersEvents200Response>} A promise that resolves to a `FetchUserOnChainSignersEvents200Response` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-on-chain-signers)
*
*/
async fetchUserOnChainSignersEvents(fid, signer, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.fetchUserOnChainSignersEvents(fid, signer, 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['OnChainEventsApi.fetchUserOnChainSignersEvents']) === 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 an on-chain ID Registry Event for a given Address.
* @summary Fetch an on-chain ID Registry Event for a given Address
* @param {string} address The ETH address being requested
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<OnChainEventIdRegister>} A promise that resolves to a `OnChainEventIdRegister` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-on-chain-id-registry-event-by-address)
*
*/
async lookupOnChainIdRegistryEventByAddress(address, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.lookupOnChainIdRegistryEventByAddress(address, 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['OnChainEventsApi.lookupOnChainIdRegistryEventByAddress']) === 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.OnChainEventsApiFp = OnChainEventsApiFp;
/**
* OnChainEventsApi - factory interface
* @export
*/
const OnChainEventsApiFactory = function (configuration, basePath, axios) {
const localVarFp = (0, exports.OnChainEventsApiFp)(configuration);
return {
/**
* Fetch on-chain events provided by a user.
* @summary Fetch a list of on-chain events provided by an FID
* @param {OnChainEventsApiFetchUserOnChainEventsRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FetchUserOnChainEvents200Response>} A promise that resolves to a `FetchUserOnChainEvents200Response` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-on-chain-events)
*
*/
fetchUserOnChainEvents(requestParameters, options) {
return localVarFp.fetchUserOnChainEvents(requestParameters.fid, requestParameters.eventType, options).then((request) => request(axios, basePath));
},
/**
* **Note:** one of two different response schemas is returned based on whether the caller provides the `signer` parameter. If included, a single `OnChainEventSigner` message is returned (or a `not_found` error). If omitted, a non-paginated list of `OnChainEventSigner` messages is returned instead.
* @summary Fetch a list of signers provided by an FID
* @param {OnChainEventsApiFetchUserOnChainSignersEventsRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FetchUserOnChainSignersEvents200Response>} A promise that resolves to a `FetchUserOnChainSignersEvents200Response` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-on-chain-signers)
*
*/
fetchUserOnChainSignersEvents(requestParameters, options) {
return localVarFp.fetchUserOnChainSignersEvents(requestParameters.fid, requestParameters.signer, options).then((request) => request(axios, basePath));
},
/**
* Fetch an on-chain ID Registry Event for a given Address.
* @summary Fetch an on-chain ID Registry Event for a given Address
* @param {OnChainEventsApiLookupOnChainIdRegistryEventByAddressRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<OnChainEventIdRegister>} A promise that resolves to a `OnChainEventIdRegister` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-on-chain-id-registry-event-by-address)
*
*/
lookupOnChainIdRegistryEventByAddress(requestParameters, options) {
return localVarFp.lookupOnChainIdRegistryEventByAddress(requestParameters.address, options).then((request) => request(axios, basePath));
},
};
};
exports.OnChainEventsApiFactory = OnChainEventsApiFactory;
/**
* OnChainEventsApi - object-oriented interface
* @export
* @class OnChainEventsApi
* @extends {BaseAPI}
*/
class OnChainEventsApi extends base_1.BaseAPI {
/**
* Fetch on-chain events provided by a user.
* @summary Fetch a list of on-chain events provided by an FID
* @param {OnChainEventsApiFetchUserOnChainEventsRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof OnChainEventsApi
* @returns {Promise<FetchUserOnChainEvents200Response>} A promise that resolves to a `FetchUserOnChainEvents200Response` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-on-chain-events)
*
*/
fetchUserOnChainEvents(requestParameters, options) {
return (0, exports.OnChainEventsApiFp)(this.configuration).fetchUserOnChainEvents(requestParameters.fid, requestParameters.eventType, options).then((request) => request(this.axios, this.basePath));
}
/**
* **Note:** one of two different response schemas is returned based on whether the caller provides the `signer` parameter. If included, a single `OnChainEventSigner` message is returned (or a `not_found` error). If omitted, a non-paginated list of `OnChainEventSigner` messages is returned instead.
* @summary Fetch a list of signers provided by an FID
* @param {OnChainEventsApiFetchUserOnChainSignersEventsRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof OnChainEventsApi
* @returns {Promise<FetchUserOnChainSignersEvents200Response>} A promise that resolves to a `FetchUserOnChainSignersEvents200Response` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-on-chain-signers)
*
*/
fetchUserOnChainSignersEvents(requestParameters, options) {
return (0, exports.OnChainEventsApiFp)(this.configuration).fetchUserOnChainSignersEvents(requestParameters.fid, requestParameters.signer, options).then((request) => request(this.axios, this.basePath));
}
/**
* Fetch an on-chain ID Registry Event for a given Address.
* @summary Fetch an on-chain ID Registry Event for a given Address
* @param {OnChainEventsApiLookupOnChainIdRegistryEventByAddressRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof OnChainEventsApi
* @returns {Promise<OnChainEventIdRegister>} A promise that resolves to a `OnChainEventIdRegister` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/lookup-on-chain-id-registry-event-by-address)
*
*/
lookupOnChainIdRegistryEventByAddress(requestParameters, options) {
return (0, exports.OnChainEventsApiFp)(this.configuration).lookupOnChainIdRegistryEventByAddress(requestParameters.address, options).then((request) => request(this.axios, this.basePath));
}
}
exports.OnChainEventsApi = OnChainEventsApi;