UNPKG

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

Version:

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

190 lines 8.56 kB
"use strict"; /* 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.UsernamesApi = exports.UsernamesApiFactory = exports.UsernamesApiFp = exports.UsernamesApiAxiosParamCreator = 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"); /** * UsernamesApi - axios parameter creator * @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 (0, common_js_1.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, common_js_1.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; } (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 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 (0, common_js_1.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, common_js_1.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; } (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.UsernamesApiAxiosParamCreator = UsernamesApiAxiosParamCreator; /** * UsernamesApi - functional programming interface * @export */ const UsernamesApiFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.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 (0, common_js_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_js_1.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 (0, common_js_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_js_1.BASE_PATH, configuration); }, }; }; exports.UsernamesApiFp = UsernamesApiFp; /** * UsernamesApi - factory interface * @export */ const UsernamesApiFactory = function (configuration, basePath, axios) { const localVarFp = (0, exports.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)); }, }; }; exports.UsernamesApiFactory = UsernamesApiFactory; /** * UsernamesApi - object-oriented interface * @export * @class UsernamesApi * @extends {BaseAPI} */ class UsernamesApi extends base_js_1.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 (0, exports.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 (0, exports.UsernamesApiFp)(this.configuration).listUsernameProofsByFid(requestParameters.fid, options).then((request) => request(this.axios, this.basePath)); } } exports.UsernamesApi = UsernamesApi; //# sourceMappingURL=usernames-api.js.map