UNPKG

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

Version:

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

410 lines 23 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.ReactionsApi = exports.ReactionsApiFactory = exports.ReactionsApiFp = exports.ReactionsApiAxiosParamCreator = 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"); /** * ReactionsApi - axios parameter creator * @export */ const ReactionsApiAxiosParamCreator = function (configuration) { return { /** * * @summary Get a reaction by its created FID and target Cast. * @param {number} fid The FID of the reaction\'s creator * @param {number} targetFid The FID of the cast\'s creator * @param {string} targetHash The cast\'s hash * @param {ReactionType} reactionType The type of reaction, either as a numerical enum value or string representation * @param {*} [options] Override http request option. * @throws {RequiredError} */ getReactionById: async (fid, targetFid, targetHash, reactionType, options = {}) => { // verify required parameter 'fid' is not null or undefined (0, common_js_1.assertParamExists)('getReactionById', 'fid', fid); // verify required parameter 'targetFid' is not null or undefined (0, common_js_1.assertParamExists)('getReactionById', 'targetFid', targetFid); // verify required parameter 'targetHash' is not null or undefined (0, common_js_1.assertParamExists)('getReactionById', 'targetHash', targetHash); // verify required parameter 'reactionType' is not null or undefined (0, common_js_1.assertParamExists)('getReactionById', 'reactionType', reactionType); const localVarPath = `/v1/reactionById`; // 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; } if (targetFid !== undefined) { localVarQueryParameter['target_fid'] = targetFid; } if (targetHash !== undefined) { localVarQueryParameter['target_hash'] = targetHash; } if (reactionType !== undefined) { localVarQueryParameter['reaction_type'] = reactionType; } (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 all reactions to a cast * @param {number} targetFid The FID of the cast\'s creator * @param {string} targetHash The hash of the cast * @param {ReactionType} reactionType The type of reaction, either as a numerical enum value or string representation * @param {number} [pageSize] Maximum number of messages to return in a single response * @param {boolean} [reverse] Reverse the sort order, returning latest messages first * @param {string} [pageToken] The page token returned by the previous query, to fetch the next page. If this parameter is empty, fetch the first page * @param {*} [options] Override http request option. * @throws {RequiredError} */ listReactionsByCast: async (targetFid, targetHash, reactionType, pageSize, reverse, pageToken, options = {}) => { // verify required parameter 'targetFid' is not null or undefined (0, common_js_1.assertParamExists)('listReactionsByCast', 'targetFid', targetFid); // verify required parameter 'targetHash' is not null or undefined (0, common_js_1.assertParamExists)('listReactionsByCast', 'targetHash', targetHash); // verify required parameter 'reactionType' is not null or undefined (0, common_js_1.assertParamExists)('listReactionsByCast', 'reactionType', reactionType); const localVarPath = `/v1/reactionsByCast`; // 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 (targetFid !== undefined) { localVarQueryParameter['target_fid'] = targetFid; } if (targetHash !== undefined) { localVarQueryParameter['target_hash'] = targetHash; } if (reactionType !== undefined) { localVarQueryParameter['reaction_type'] = reactionType; } if (pageSize !== undefined) { localVarQueryParameter['pageSize'] = pageSize; } if (reverse !== undefined) { localVarQueryParameter['reverse'] = reverse; } if (pageToken !== undefined) { localVarQueryParameter['pageToken'] = pageToken; } (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 all reactions by an FID * @param {number} fid The FID of the reaction\'s creator * @param {ReactionType} reactionType The type of reaction, either as a numerical enum value or string representation * @param {number} [pageSize] Maximum number of messages to return in a single response * @param {boolean} [reverse] Reverse the sort order, returning latest messages first * @param {string} [pageToken] The page token returned by the previous query, to fetch the next page. If this parameter is empty, fetch the first page * @param {*} [options] Override http request option. * @throws {RequiredError} */ listReactionsByFid: async (fid, reactionType, pageSize, reverse, pageToken, options = {}) => { // verify required parameter 'fid' is not null or undefined (0, common_js_1.assertParamExists)('listReactionsByFid', 'fid', fid); // verify required parameter 'reactionType' is not null or undefined (0, common_js_1.assertParamExists)('listReactionsByFid', 'reactionType', reactionType); const localVarPath = `/v1/reactionsByFid`; // 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; } if (reactionType !== undefined) { localVarQueryParameter['reaction_type'] = reactionType; } if (pageSize !== undefined) { localVarQueryParameter['pageSize'] = pageSize; } if (reverse !== undefined) { localVarQueryParameter['reverse'] = reverse; } if (pageToken !== undefined) { localVarQueryParameter['pageToken'] = pageToken; } (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 all reactions to a target URL * @param {string} url The URL of the parent cast * @param {ReactionType} reactionType The type of reaction, either as a numerical enum value or string representation * @param {number} [pageSize] Maximum number of messages to return in a single response * @param {boolean} [reverse] Reverse the sort order, returning latest messages first * @param {string} [pageToken] The page token returned by the previous query, to fetch the next page. If this parameter is empty, fetch the first page * @param {*} [options] Override http request option. * @throws {RequiredError} */ listReactionsByTarget: async (url, reactionType, pageSize, reverse, pageToken, options = {}) => { // verify required parameter 'url' is not null or undefined (0, common_js_1.assertParamExists)('listReactionsByTarget', 'url', url); // verify required parameter 'reactionType' is not null or undefined (0, common_js_1.assertParamExists)('listReactionsByTarget', 'reactionType', reactionType); const localVarPath = `/v1/reactionsByTarget`; // 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 (url !== undefined) { localVarQueryParameter['url'] = url; } if (reactionType !== undefined) { localVarQueryParameter['reaction_type'] = reactionType; } if (pageSize !== undefined) { localVarQueryParameter['pageSize'] = pageSize; } if (reverse !== undefined) { localVarQueryParameter['reverse'] = reverse; } if (pageToken !== undefined) { localVarQueryParameter['pageToken'] = pageToken; } (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.ReactionsApiAxiosParamCreator = ReactionsApiAxiosParamCreator; /** * ReactionsApi - functional programming interface * @export */ const ReactionsApiFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.ReactionsApiAxiosParamCreator)(configuration); return { /** * * @summary Get a reaction by its created FID and target Cast. * @param {number} fid The FID of the reaction\'s creator * @param {number} targetFid The FID of the cast\'s creator * @param {string} targetHash The cast\'s hash * @param {ReactionType} reactionType The type of reaction, either as a numerical enum value or string representation * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getReactionById(fid, targetFid, targetHash, reactionType, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.getReactionById(fid, targetFid, targetHash, reactionType, options); return (0, common_js_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_js_1.BASE_PATH, configuration); }, /** * * @summary Get all reactions to a cast * @param {number} targetFid The FID of the cast\'s creator * @param {string} targetHash The hash of the cast * @param {ReactionType} reactionType The type of reaction, either as a numerical enum value or string representation * @param {number} [pageSize] Maximum number of messages to return in a single response * @param {boolean} [reverse] Reverse the sort order, returning latest messages first * @param {string} [pageToken] The page token returned by the previous query, to fetch the next page. If this parameter is empty, fetch the first page * @param {*} [options] Override http request option. * @throws {RequiredError} */ async listReactionsByCast(targetFid, targetHash, reactionType, pageSize, reverse, pageToken, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.listReactionsByCast(targetFid, targetHash, reactionType, pageSize, reverse, pageToken, options); return (0, common_js_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_js_1.BASE_PATH, configuration); }, /** * * @summary Get all reactions by an FID * @param {number} fid The FID of the reaction\'s creator * @param {ReactionType} reactionType The type of reaction, either as a numerical enum value or string representation * @param {number} [pageSize] Maximum number of messages to return in a single response * @param {boolean} [reverse] Reverse the sort order, returning latest messages first * @param {string} [pageToken] The page token returned by the previous query, to fetch the next page. If this parameter is empty, fetch the first page * @param {*} [options] Override http request option. * @throws {RequiredError} */ async listReactionsByFid(fid, reactionType, pageSize, reverse, pageToken, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.listReactionsByFid(fid, reactionType, pageSize, reverse, pageToken, options); return (0, common_js_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_js_1.BASE_PATH, configuration); }, /** * * @summary Get all reactions to a target URL * @param {string} url The URL of the parent cast * @param {ReactionType} reactionType The type of reaction, either as a numerical enum value or string representation * @param {number} [pageSize] Maximum number of messages to return in a single response * @param {boolean} [reverse] Reverse the sort order, returning latest messages first * @param {string} [pageToken] The page token returned by the previous query, to fetch the next page. If this parameter is empty, fetch the first page * @param {*} [options] Override http request option. * @throws {RequiredError} */ async listReactionsByTarget(url, reactionType, pageSize, reverse, pageToken, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.listReactionsByTarget(url, reactionType, pageSize, reverse, pageToken, options); return (0, common_js_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_js_1.BASE_PATH, configuration); }, }; }; exports.ReactionsApiFp = ReactionsApiFp; /** * ReactionsApi - factory interface * @export */ const ReactionsApiFactory = function (configuration, basePath, axios) { const localVarFp = (0, exports.ReactionsApiFp)(configuration); return { /** * * @summary Get a reaction by its created FID and target Cast. * @param {ReactionsApiGetReactionByIdRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getReactionById(requestParameters, options) { return localVarFp.getReactionById(requestParameters.fid, requestParameters.targetFid, requestParameters.targetHash, requestParameters.reactionType, options).then((request) => request(axios, basePath)); }, /** * * @summary Get all reactions to a cast * @param {ReactionsApiListReactionsByCastRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ listReactionsByCast(requestParameters, options) { return localVarFp.listReactionsByCast(requestParameters.targetFid, requestParameters.targetHash, requestParameters.reactionType, requestParameters.pageSize, requestParameters.reverse, requestParameters.pageToken, options).then((request) => request(axios, basePath)); }, /** * * @summary Get all reactions by an FID * @param {ReactionsApiListReactionsByFidRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ listReactionsByFid(requestParameters, options) { return localVarFp.listReactionsByFid(requestParameters.fid, requestParameters.reactionType, requestParameters.pageSize, requestParameters.reverse, requestParameters.pageToken, options).then((request) => request(axios, basePath)); }, /** * * @summary Get all reactions to a target URL * @param {ReactionsApiListReactionsByTargetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ listReactionsByTarget(requestParameters, options) { return localVarFp.listReactionsByTarget(requestParameters.url, requestParameters.reactionType, requestParameters.pageSize, requestParameters.reverse, requestParameters.pageToken, options).then((request) => request(axios, basePath)); }, }; }; exports.ReactionsApiFactory = ReactionsApiFactory; /** * ReactionsApi - object-oriented interface * @export * @class ReactionsApi * @extends {BaseAPI} */ class ReactionsApi extends base_js_1.BaseAPI { /** * * @summary Get a reaction by its created FID and target Cast. * @param {ReactionsApiGetReactionByIdRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ReactionsApi */ getReactionById(requestParameters, options) { return (0, exports.ReactionsApiFp)(this.configuration).getReactionById(requestParameters.fid, requestParameters.targetFid, requestParameters.targetHash, requestParameters.reactionType, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get all reactions to a cast * @param {ReactionsApiListReactionsByCastRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ReactionsApi */ listReactionsByCast(requestParameters, options) { return (0, exports.ReactionsApiFp)(this.configuration).listReactionsByCast(requestParameters.targetFid, requestParameters.targetHash, requestParameters.reactionType, requestParameters.pageSize, requestParameters.reverse, requestParameters.pageToken, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get all reactions by an FID * @param {ReactionsApiListReactionsByFidRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ReactionsApi */ listReactionsByFid(requestParameters, options) { return (0, exports.ReactionsApiFp)(this.configuration).listReactionsByFid(requestParameters.fid, requestParameters.reactionType, requestParameters.pageSize, requestParameters.reverse, requestParameters.pageToken, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get all reactions to a target URL * @param {ReactionsApiListReactionsByTargetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ReactionsApi */ listReactionsByTarget(requestParameters, options) { return (0, exports.ReactionsApiFp)(this.configuration).listReactionsByTarget(requestParameters.url, requestParameters.reactionType, requestParameters.pageSize, requestParameters.reverse, requestParameters.pageToken, options).then((request) => request(this.axios, this.basePath)); } } exports.ReactionsApi = ReactionsApi; //# sourceMappingURL=reactions-api.js.map