@standard-crypto/farcaster-js-hub-rest
Version:
A tool for interacting with the REST API of any Farcaster hub.
178 lines • 7.82 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.
*/
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setSearchParams, toPathString, createRequestFunction } from '../common.js';
// @ts-ignore
import { BASE_PATH, BaseAPI } from '../base.js';
/**
* HubEventsApi - axios parameter creator
* @export
*/
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
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, 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;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
return {
url: 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, 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;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
};
};
/**
* HubEventsApi - functional programming interface
* @export
*/
export const HubEventsApiFp = function (configuration) {
const localVarAxiosParamCreator = 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 createRequestFunction(localVarAxiosArgs, globalAxios, 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 createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
};
};
/**
* HubEventsApi - factory interface
* @export
*/
export const HubEventsApiFactory = function (configuration, basePath, axios) {
const localVarFp = 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));
},
};
};
/**
* HubEventsApi - object-oriented interface
* @export
* @class HubEventsApi
* @extends {BaseAPI}
*/
export class HubEventsApi extends 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 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 HubEventsApiFp(this.configuration).listEvents(requestParameters.fromEventId, options).then((request) => request(this.axios, this.basePath));
}
}
//# sourceMappingURL=hub-events-api.js.map