@standard-crypto/farcaster-js-hub-rest
Version:
A tool for interacting with the REST API of any Farcaster hub.
119 lines • 5.51 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, setBasicAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common.js';
// @ts-ignore
import { BASE_PATH, BaseAPI } from '../base.js';
/**
* ValidateMessageApi - axios parameter creator
* @export
*/
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
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, 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
setBasicAuthToObject(localVarRequestOptions, configuration);
localVarHeaderParameter['Content-Type'] = 'application/octet-stream';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
};
};
/**
* ValidateMessageApi - functional programming interface
* @export
*/
export const ValidateMessageApiFp = function (configuration) {
const localVarAxiosParamCreator = 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 createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
};
};
/**
* ValidateMessageApi - factory interface
* @export
*/
export const ValidateMessageApiFactory = function (configuration, basePath, axios) {
const localVarFp = 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));
},
};
};
/**
* ValidateMessageApi - object-oriented interface
* @export
* @class ValidateMessageApi
* @extends {BaseAPI}
*/
export class ValidateMessageApi extends 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 ValidateMessageApiFp(this.configuration).validateMessage(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
}
}
//# sourceMappingURL=validate-message-api.js.map