UNPKG

@standard-crypto/farcaster-js-hub-rest

Version:

A tool for interacting with the REST API of any Farcaster hub.

180 lines 7.87 kB
/* 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'; /** * UsernamesApi - axios parameter creator * @export */ export const UsernamesApiAxiosParamCreator = function (configuration) { return { /** * * @summary Get an proof for a username by the Farcaster username * @param {string} name The Farcaster username or ENS address * @param {*} [options] Override http request option. * @throws {RequiredError} */ getUsernameProof: async (name, options = {}) => { // verify required parameter 'name' is not null or undefined assertParamExists('getUsernameProof', 'name', name); const localVarPath = `/v1/userNameProofByName`; // 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 (name !== undefined) { localVarQueryParameter['name'] = name; } 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 proofs provided by an FID * @param {number} fid The FID being requested * @param {*} [options] Override http request option. * @throws {RequiredError} */ listUsernameProofsByFid: async (fid, options = {}) => { // verify required parameter 'fid' is not null or undefined assertParamExists('listUsernameProofsByFid', 'fid', fid); const localVarPath = `/v1/userNameProofsByFid`; // 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; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; /** * UsernamesApi - functional programming interface * @export */ export const UsernamesApiFp = function (configuration) { const localVarAxiosParamCreator = UsernamesApiAxiosParamCreator(configuration); return { /** * * @summary Get an proof for a username by the Farcaster username * @param {string} name The Farcaster username or ENS address * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getUsernameProof(name, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.getUsernameProof(name, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * * @summary Get a list of proofs provided by an FID * @param {number} fid The FID being requested * @param {*} [options] Override http request option. * @throws {RequiredError} */ async listUsernameProofsByFid(fid, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.listUsernameProofsByFid(fid, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, }; }; /** * UsernamesApi - factory interface * @export */ export const UsernamesApiFactory = function (configuration, basePath, axios) { const localVarFp = UsernamesApiFp(configuration); return { /** * * @summary Get an proof for a username by the Farcaster username * @param {UsernamesApiGetUsernameProofRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getUsernameProof(requestParameters, options) { return localVarFp.getUsernameProof(requestParameters.name, options).then((request) => request(axios, basePath)); }, /** * * @summary Get a list of proofs provided by an FID * @param {UsernamesApiListUsernameProofsByFidRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ listUsernameProofsByFid(requestParameters, options) { return localVarFp.listUsernameProofsByFid(requestParameters.fid, options).then((request) => request(axios, basePath)); }, }; }; /** * UsernamesApi - object-oriented interface * @export * @class UsernamesApi * @extends {BaseAPI} */ export class UsernamesApi extends BaseAPI { /** * * @summary Get an proof for a username by the Farcaster username * @param {UsernamesApiGetUsernameProofRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UsernamesApi */ getUsernameProof(requestParameters, options) { return UsernamesApiFp(this.configuration).getUsernameProof(requestParameters.name, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get a list of proofs provided by an FID * @param {UsernamesApiListUsernameProofsByFidRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UsernamesApi */ listUsernameProofsByFid(requestParameters, options) { return UsernamesApiFp(this.configuration).listUsernameProofsByFid(requestParameters.fid, options).then((request) => request(this.axios, this.basePath)); } } //# sourceMappingURL=usernames-api.js.map