UNPKG

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

Version:

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

129 lines 6.07 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.SubmitMessageApi = exports.SubmitMessageApiFactory = exports.SubmitMessageApiFp = exports.SubmitMessageApiAxiosParamCreator = 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"); /** * SubmitMessageApi - axios parameter creator * @export */ const SubmitMessageApiAxiosParamCreator = function (configuration) { return { /** * * @summary Submit a signed protobuf-serialized message to 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} */ submitMessage: async (body, options = {}) => { // verify required parameter 'body' is not null or undefined (0, common_js_1.assertParamExists)('submitMessage', 'body', body); const localVarPath = `/v1/submitMessage`; // 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.SubmitMessageApiAxiosParamCreator = SubmitMessageApiAxiosParamCreator; /** * SubmitMessageApi - functional programming interface * @export */ const SubmitMessageApiFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.SubmitMessageApiAxiosParamCreator)(configuration); return { /** * * @summary Submit a signed protobuf-serialized message to 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 submitMessage(body, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.submitMessage(body, options); return (0, common_js_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_js_1.BASE_PATH, configuration); }, }; }; exports.SubmitMessageApiFp = SubmitMessageApiFp; /** * SubmitMessageApi - factory interface * @export */ const SubmitMessageApiFactory = function (configuration, basePath, axios) { const localVarFp = (0, exports.SubmitMessageApiFp)(configuration); return { /** * * @summary Submit a signed protobuf-serialized message to the Hub * @param {SubmitMessageApiSubmitMessageRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ submitMessage(requestParameters, options) { return localVarFp.submitMessage(requestParameters.body, options).then((request) => request(axios, basePath)); }, }; }; exports.SubmitMessageApiFactory = SubmitMessageApiFactory; /** * SubmitMessageApi - object-oriented interface * @export * @class SubmitMessageApi * @extends {BaseAPI} */ class SubmitMessageApi extends base_js_1.BaseAPI { /** * * @summary Submit a signed protobuf-serialized message to the Hub * @param {SubmitMessageApiSubmitMessageRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SubmitMessageApi */ submitMessage(requestParameters, options) { return (0, exports.SubmitMessageApiFp)(this.configuration).submitMessage(requestParameters.body, options).then((request) => request(this.axios, this.basePath)); } } exports.SubmitMessageApi = SubmitMessageApi; //# sourceMappingURL=submit-message-api.js.map