UNPKG

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

Version:

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

129 lines 6.16 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.ValidateMessageApi = exports.ValidateMessageApiFactory = exports.ValidateMessageApiFp = exports.ValidateMessageApiAxiosParamCreator = 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"); /** * ValidateMessageApi - axios parameter creator * @export */ const ValidateMessageApiAxiosParamCreator = function (configuration) { return { /** * * @summary Validate a signed protobuf-serialized message with the Hub * @param {Buffer} body * A Message is a delta operation on the Farcaster network. The message protobuf is an envelope that wraps a MessageData object and contains a hash and signature which can verify its authenticity. * @param {*} [options] Override http request option. * @throws {RequiredError} */ validateMessage: async (body, options = {}) => { // verify required parameter 'body' is not null or undefined (0, common_js_1.assertParamExists)('validateMessage', 'body', body); const localVarPath = `/v1/validateMessage`; // 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: 'POST', ...baseOptions, ...options }; const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication usernamePassword required // http basic authentication required (0, common_js_1.setBasicAuthToObject)(localVarRequestOptions, configuration); localVarHeaderParameter['Content-Type'] = 'application/octet-stream'; (0, common_js_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; localVarRequestOptions.data = (0, common_js_1.serializeDataIfNeeded)(body, localVarRequestOptions, configuration); return { url: (0, common_js_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; exports.ValidateMessageApiAxiosParamCreator = ValidateMessageApiAxiosParamCreator; /** * ValidateMessageApi - functional programming interface * @export */ const ValidateMessageApiFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.ValidateMessageApiAxiosParamCreator)(configuration); return { /** * * @summary Validate a signed protobuf-serialized message with the Hub * @param {Buffer} body * A Message is a delta operation on the Farcaster network. The message protobuf is an envelope that wraps a MessageData object and contains a hash and signature which can verify its authenticity. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async validateMessage(body, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.validateMessage(body, options); return (0, common_js_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_js_1.BASE_PATH, configuration); }, }; }; exports.ValidateMessageApiFp = ValidateMessageApiFp; /** * ValidateMessageApi - factory interface * @export */ const ValidateMessageApiFactory = function (configuration, basePath, axios) { const localVarFp = (0, exports.ValidateMessageApiFp)(configuration); return { /** * * @summary Validate a signed protobuf-serialized message with the Hub * @param {ValidateMessageApiValidateMessageRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ validateMessage(requestParameters, options) { return localVarFp.validateMessage(requestParameters.body, options).then((request) => request(axios, basePath)); }, }; }; exports.ValidateMessageApiFactory = ValidateMessageApiFactory; /** * ValidateMessageApi - object-oriented interface * @export * @class ValidateMessageApi * @extends {BaseAPI} */ class ValidateMessageApi extends base_js_1.BaseAPI { /** * * @summary Validate a signed protobuf-serialized message with the Hub * @param {ValidateMessageApiValidateMessageRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ValidateMessageApi */ validateMessage(requestParameters, options) { return (0, exports.ValidateMessageApiFp)(this.configuration).validateMessage(requestParameters.body, options).then((request) => request(this.axios, this.basePath)); } } exports.ValidateMessageApi = ValidateMessageApi; //# sourceMappingURL=validate-message-api.js.map