UNPKG

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

Version:

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

137 lines 7.66 kB
/* 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, setSearchParams, toPathString, createRequestFunction } from '../common.js'; // @ts-ignore import { BASE_PATH, BaseAPI } from '../base.js'; /** * UserDataApi - axios parameter creator * @export */ export const UserDataApiAxiosParamCreator = function (configuration) { return { /** * **Note:** one of two different response schemas is returned based on whether the caller provides the `user_data_type` parameter. If included, a single `UserDataAdd` message is returned (or a `not_found` error). If omitted, a paginated list of `UserDataAdd` messages is returned instead * @summary Get UserData for a FID. * @param {number} fid The FID that\'s being requested * @param {UserDataType} [userDataType] The type of user data, either as a numerical value or type string. If this is omitted, all user data for the FID is returned * @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} */ getUserDataByFid: async (fid, userDataType, pageSize, reverse, pageToken, options = {}) => { // verify required parameter 'fid' is not null or undefined assertParamExists('getUserDataByFid', 'fid', fid); const localVarPath = `/v1/userDataByFid`; // 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: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {}; const localVarQueryParameter = {}; if (fid !== undefined) { localVarQueryParameter['fid'] = fid; } if (userDataType !== undefined) { localVarQueryParameter['user_data_type'] = userDataType; } if (pageSize !== undefined) { localVarQueryParameter['pageSize'] = pageSize; } if (reverse !== undefined) { localVarQueryParameter['reverse'] = reverse; } if (pageToken !== undefined) { localVarQueryParameter['pageToken'] = pageToken; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; /** * UserDataApi - functional programming interface * @export */ export const UserDataApiFp = function (configuration) { const localVarAxiosParamCreator = UserDataApiAxiosParamCreator(configuration); return { /** * **Note:** one of two different response schemas is returned based on whether the caller provides the `user_data_type` parameter. If included, a single `UserDataAdd` message is returned (or a `not_found` error). If omitted, a paginated list of `UserDataAdd` messages is returned instead * @summary Get UserData for a FID. * @param {number} fid The FID that\'s being requested * @param {UserDataType} [userDataType] The type of user data, either as a numerical value or type string. If this is omitted, all user data for the FID is returned * @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 getUserDataByFid(fid, userDataType, pageSize, reverse, pageToken, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.getUserDataByFid(fid, userDataType, pageSize, reverse, pageToken, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, }; }; /** * UserDataApi - factory interface * @export */ export const UserDataApiFactory = function (configuration, basePath, axios) { const localVarFp = UserDataApiFp(configuration); return { /** * **Note:** one of two different response schemas is returned based on whether the caller provides the `user_data_type` parameter. If included, a single `UserDataAdd` message is returned (or a `not_found` error). If omitted, a paginated list of `UserDataAdd` messages is returned instead * @summary Get UserData for a FID. * @param {UserDataApiGetUserDataByFidRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getUserDataByFid(requestParameters, options) { return localVarFp.getUserDataByFid(requestParameters.fid, requestParameters.userDataType, requestParameters.pageSize, requestParameters.reverse, requestParameters.pageToken, options).then((request) => request(axios, basePath)); }, }; }; /** * UserDataApi - object-oriented interface * @export * @class UserDataApi * @extends {BaseAPI} */ export class UserDataApi extends BaseAPI { /** * **Note:** one of two different response schemas is returned based on whether the caller provides the `user_data_type` parameter. If included, a single `UserDataAdd` message is returned (or a `not_found` error). If omitted, a paginated list of `UserDataAdd` messages is returned instead * @summary Get UserData for a FID. * @param {UserDataApiGetUserDataByFidRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserDataApi */ getUserDataByFid(requestParameters, options) { return UserDataApiFp(this.configuration).getUserDataByFid(requestParameters.fid, requestParameters.userDataType, requestParameters.pageSize, requestParameters.reverse, requestParameters.pageToken, options).then((request) => request(this.axios, this.basePath)); } } //# sourceMappingURL=user-data-api.js.map