@standard-crypto/farcaster-js-hub-rest
Version:
A tool for interacting with the REST API of any Farcaster hub.
188 lines • 8.5 kB
JavaScript
;
/* tslint:disable */
/* eslint-disable */
/**
* Farcaster Hub REST API
* Perform basic queries of Farcaster state via the REST API of a Farcaster hub. See the [Farcaster docs](https://www.thehubble.xyz/docs/httpapi/httpapi.html) for more details. Some client libraries: - [TypeScript](https://www.npmjs.com/package/@standard-crypto/farcaster-js-hub-rest)
*
* The version of the OpenAPI document: 1.0
*
*
* 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.HubEventsApi = exports.HubEventsApiFactory = exports.HubEventsApiFp = exports.HubEventsApiAxiosParamCreator = void 0;
const axios_1 = __importDefault(require("axios"));
// Some imports not used depending on template conditions
// @ts-ignore
const common_js_1 = require("../common.js");
// @ts-ignore
const base_js_1 = require("../base.js");
/**
* HubEventsApi - axios parameter creator
* @export
*/
const HubEventsApiAxiosParamCreator = function (configuration) {
return {
/**
*
* @summary Get an event by its ID
* @param {number} eventId The Hub Id of the event
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getEventById: async (eventId, options = {}) => {
// verify required parameter 'eventId' is not null or undefined
(0, common_js_1.assertParamExists)('getEventById', 'eventId', eventId);
const localVarPath = `/v1/eventById`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, common_js_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (eventId !== undefined) {
localVarQueryParameter['event_id'] = eventId;
}
(0, common_js_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
return {
url: (0, common_js_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Get a page of Hub events
* @param {number} [fromEventId] An optional Hub Id to start getting events from. This is also returned from the API as nextPageEventId, which can be used to page through all the Hub events. Set it to 0 to start from the first event
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listEvents: async (fromEventId, options = {}) => {
const localVarPath = `/v1/events`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, common_js_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (fromEventId !== undefined) {
localVarQueryParameter['from_event_id'] = fromEventId;
}
(0, common_js_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
return {
url: (0, common_js_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
},
};
};
exports.HubEventsApiAxiosParamCreator = HubEventsApiAxiosParamCreator;
/**
* HubEventsApi - functional programming interface
* @export
*/
const HubEventsApiFp = function (configuration) {
const localVarAxiosParamCreator = (0, exports.HubEventsApiAxiosParamCreator)(configuration);
return {
/**
*
* @summary Get an event by its ID
* @param {number} eventId The Hub Id of the event
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getEventById(eventId, options) {
const localVarAxiosArgs = await localVarAxiosParamCreator.getEventById(eventId, options);
return (0, common_js_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_js_1.BASE_PATH, configuration);
},
/**
*
* @summary Get a page of Hub events
* @param {number} [fromEventId] An optional Hub Id to start getting events from. This is also returned from the API as nextPageEventId, which can be used to page through all the Hub events. Set it to 0 to start from the first event
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async listEvents(fromEventId, options) {
const localVarAxiosArgs = await localVarAxiosParamCreator.listEvents(fromEventId, options);
return (0, common_js_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_js_1.BASE_PATH, configuration);
},
};
};
exports.HubEventsApiFp = HubEventsApiFp;
/**
* HubEventsApi - factory interface
* @export
*/
const HubEventsApiFactory = function (configuration, basePath, axios) {
const localVarFp = (0, exports.HubEventsApiFp)(configuration);
return {
/**
*
* @summary Get an event by its ID
* @param {HubEventsApiGetEventByIdRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getEventById(requestParameters, options) {
return localVarFp.getEventById(requestParameters.eventId, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Get a page of Hub events
* @param {HubEventsApiListEventsRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listEvents(requestParameters = {}, options) {
return localVarFp.listEvents(requestParameters.fromEventId, options).then((request) => request(axios, basePath));
},
};
};
exports.HubEventsApiFactory = HubEventsApiFactory;
/**
* HubEventsApi - object-oriented interface
* @export
* @class HubEventsApi
* @extends {BaseAPI}
*/
class HubEventsApi extends base_js_1.BaseAPI {
/**
*
* @summary Get an event by its ID
* @param {HubEventsApiGetEventByIdRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof HubEventsApi
*/
getEventById(requestParameters, options) {
return (0, exports.HubEventsApiFp)(this.configuration).getEventById(requestParameters.eventId, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Get a page of Hub events
* @param {HubEventsApiListEventsRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof HubEventsApi
*/
listEvents(requestParameters = {}, options) {
return (0, exports.HubEventsApiFp)(this.configuration).listEvents(requestParameters.fromEventId, options).then((request) => request(this.axios, this.basePath));
}
}
exports.HubEventsApi = HubEventsApi;
//# sourceMappingURL=hub-events-api.js.map