@standard-crypto/farcaster-js-hub-rest
Version:
A tool for interacting with the REST API of any Farcaster hub.
255 lines • 13.4 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';
/**
* OnChainEventsApi - axios parameter creator
* @export
*/
export const OnChainEventsApiAxiosParamCreator = function (configuration) {
return {
/**
*
* @summary Get 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}
*/
getOnChainIdRegistrationByAddress: async (address, options = {}) => {
// verify required parameter 'address' is not null or undefined
assertParamExists('getOnChainIdRegistrationByAddress', 'address', address);
const localVarPath = `/v1/onChainIdRegistryEventByAddress`;
// 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 (address !== undefined) {
localVarQueryParameter['address'] = address;
}
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 list of on-chain events provided by an FID
* @param {number} fid The FID being requested
* @param {OnChainEventType} eventType The numeric of string value of the event type being requested.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listOnChainEventsByFid: async (fid, eventType, options = {}) => {
// verify required parameter 'fid' is not null or undefined
assertParamExists('listOnChainEventsByFid', 'fid', fid);
// verify required parameter 'eventType' is not null or undefined
assertParamExists('listOnChainEventsByFid', 'eventType', eventType);
const localVarPath = `/v1/onChainEventsByFid`;
// 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 (fid !== undefined) {
localVarQueryParameter['fid'] = fid;
}
if (eventType !== undefined) {
localVarQueryParameter['event_type'] = eventType;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
return {
url: 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 Get 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}
*/
listOnChainSignersByFid: async (fid, signer, options = {}) => {
// verify required parameter 'fid' is not null or undefined
assertParamExists('listOnChainSignersByFid', 'fid', fid);
const localVarPath = `/v1/onChainSignersByFid`;
// 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 (fid !== undefined) {
localVarQueryParameter['fid'] = fid;
}
if (signer !== undefined) {
localVarQueryParameter['signer'] = signer;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
};
};
/**
* OnChainEventsApi - functional programming interface
* @export
*/
export const OnChainEventsApiFp = function (configuration) {
const localVarAxiosParamCreator = OnChainEventsApiAxiosParamCreator(configuration);
return {
/**
*
* @summary Get 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}
*/
async getOnChainIdRegistrationByAddress(address, options) {
const localVarAxiosArgs = await localVarAxiosParamCreator.getOnChainIdRegistrationByAddress(address, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @summary Get a list of on-chain events provided by an FID
* @param {number} fid The FID being requested
* @param {OnChainEventType} eventType The numeric of string value of the event type being requested.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async listOnChainEventsByFid(fid, eventType, options) {
const localVarAxiosArgs = await localVarAxiosParamCreator.listOnChainEventsByFid(fid, eventType, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
* **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 Get 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}
*/
async listOnChainSignersByFid(fid, signer, options) {
const localVarAxiosArgs = await localVarAxiosParamCreator.listOnChainSignersByFid(fid, signer, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
};
};
/**
* OnChainEventsApi - factory interface
* @export
*/
export const OnChainEventsApiFactory = function (configuration, basePath, axios) {
const localVarFp = OnChainEventsApiFp(configuration);
return {
/**
*
* @summary Get an on chain ID Registry Event for a given Address
* @param {OnChainEventsApiGetOnChainIdRegistrationByAddressRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getOnChainIdRegistrationByAddress(requestParameters, options) {
return localVarFp.getOnChainIdRegistrationByAddress(requestParameters.address, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Get a list of on-chain events provided by an FID
* @param {OnChainEventsApiListOnChainEventsByFidRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listOnChainEventsByFid(requestParameters, options) {
return localVarFp.listOnChainEventsByFid(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 Get a list of signers provided by an FID
* @param {OnChainEventsApiListOnChainSignersByFidRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listOnChainSignersByFid(requestParameters, options) {
return localVarFp.listOnChainSignersByFid(requestParameters.fid, requestParameters.signer, options).then((request) => request(axios, basePath));
},
};
};
/**
* OnChainEventsApi - object-oriented interface
* @export
* @class OnChainEventsApi
* @extends {BaseAPI}
*/
export class OnChainEventsApi extends BaseAPI {
/**
*
* @summary Get an on chain ID Registry Event for a given Address
* @param {OnChainEventsApiGetOnChainIdRegistrationByAddressRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof OnChainEventsApi
*/
getOnChainIdRegistrationByAddress(requestParameters, options) {
return OnChainEventsApiFp(this.configuration).getOnChainIdRegistrationByAddress(requestParameters.address, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Get a list of on-chain events provided by an FID
* @param {OnChainEventsApiListOnChainEventsByFidRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof OnChainEventsApi
*/
listOnChainEventsByFid(requestParameters, options) {
return OnChainEventsApiFp(this.configuration).listOnChainEventsByFid(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 Get a list of signers provided by an FID
* @param {OnChainEventsApiListOnChainSignersByFidRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof OnChainEventsApi
*/
listOnChainSignersByFid(requestParameters, options) {
return OnChainEventsApiFp(this.configuration).listOnChainSignersByFid(requestParameters.fid, requestParameters.signer, options).then((request) => request(this.axios, this.basePath));
}
}
//# sourceMappingURL=on-chain-events-api.js.map