@standard-crypto/farcaster-js-neynar
Version:
A tool for interacting with Farcaster via Neynar APIs.
352 lines • 17.9 kB
JavaScript
/* tslint:disable */
/* eslint-disable */
/**
* v1 Farcaster
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* 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, setApiKeyToObject, setSearchParams, toPathString, createRequestFunction } from '../common.js';
// @ts-ignore
import { BASE_PATH, BaseAPI } from '../base.js';
/**
* CastApi - axios parameter creator
* @export
*/
export const CastApiAxiosParamCreator = function (configuration) {
return {
/**
* Gets the most recent casts for a user in reverse-chronological order
* @summary Retrieve all casts in a given thread hash
* @param {string} threadHash The hash of the thread to retrieve casts from.
* @param {number} [viewerFid] fid of the user viewing this information, needed for contextual information.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
allCastsInThread: async (threadHash, viewerFid, options = {}) => {
// verify required parameter 'threadHash' is not null or undefined
assertParamExists('allCastsInThread', 'threadHash', threadHash);
const localVarPath = `/farcaster/all-casts-in-thread`;
// 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 = {};
// authentication ApiKeyAuth required
await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration);
if (threadHash !== undefined) {
localVarQueryParameter['threadHash'] = threadHash;
}
if (viewerFid !== undefined) {
localVarQueryParameter['viewerFid'] = viewerFid;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Gets information about an individual cast
* @summary Retrieve cast for a given hash
* @param {string} hash Cast hash
* @param {number} [viewerFid] fid of the user viewing this information, needed for contextual information.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
cast: async (hash, viewerFid, options = {}) => {
// verify required parameter 'hash' is not null or undefined
assertParamExists('cast', 'hash', hash);
const localVarPath = `/farcaster/cast`;
// 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 = {};
// authentication ApiKeyAuth required
await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration);
if (hash !== undefined) {
localVarQueryParameter['hash'] = hash;
}
if (viewerFid !== undefined) {
localVarQueryParameter['viewerFid'] = viewerFid;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Gets the most recent casts for a user
* @summary Retrieve casts for a given user
* @param {number} fid fid of a user
* @param {number} [viewerFid] fid of the user viewing this information, needed for contextual information.
* @param {string} [parentUrl] A cast can be part of a certain channel. The channel is identified by `parent_url`. All casts in the channel ladder up to the same parent_url.
* @param {string} [cursor] Pagination cursor.
* @param {number} [limit] Number of results to retrieve (default 25, max 150)
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
casts: async (fid, viewerFid, parentUrl, cursor, limit, options = {}) => {
// verify required parameter 'fid' is not null or undefined
assertParamExists('casts', 'fid', fid);
const localVarPath = `/farcaster/casts`;
// 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 = {};
// authentication ApiKeyAuth required
await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration);
if (fid !== undefined) {
localVarQueryParameter['fid'] = fid;
}
if (viewerFid !== undefined) {
localVarQueryParameter['viewerFid'] = viewerFid;
}
if (parentUrl !== undefined) {
localVarQueryParameter['parent_url'] = parentUrl;
}
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Get a list of casts from the protocol in reverse chronological order based on timestamp
* @summary Get Recent Casts
* @param {number} [viewerFid] fid of the user viewing this information, needed for contextual information.
* @param {string} [cursor] Pagination cursor.
* @param {number} [limit] Number of results to retrieve (default 25, max 100)
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
recentCasts: async (viewerFid, cursor, limit, options = {}) => {
const localVarPath = `/farcaster/recent-casts`;
// 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 = {};
// authentication ApiKeyAuth required
await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration);
if (viewerFid !== undefined) {
localVarQueryParameter['viewerFid'] = viewerFid;
}
if (cursor !== undefined) {
localVarQueryParameter['cursor'] = cursor;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
};
};
/**
* CastApi - functional programming interface
* @export
*/
export const CastApiFp = function (configuration) {
const localVarAxiosParamCreator = CastApiAxiosParamCreator(configuration);
return {
/**
* Gets the most recent casts for a user in reverse-chronological order
* @summary Retrieve all casts in a given thread hash
* @param {string} threadHash The hash of the thread to retrieve casts from.
* @param {number} [viewerFid] fid of the user viewing this information, needed for contextual information.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async allCastsInThread(threadHash, viewerFid, options) {
const localVarAxiosArgs = await localVarAxiosParamCreator.allCastsInThread(threadHash, viewerFid, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
* Gets information about an individual cast
* @summary Retrieve cast for a given hash
* @param {string} hash Cast hash
* @param {number} [viewerFid] fid of the user viewing this information, needed for contextual information.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async cast(hash, viewerFid, options) {
const localVarAxiosArgs = await localVarAxiosParamCreator.cast(hash, viewerFid, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
* Gets the most recent casts for a user
* @summary Retrieve casts for a given user
* @param {number} fid fid of a user
* @param {number} [viewerFid] fid of the user viewing this information, needed for contextual information.
* @param {string} [parentUrl] A cast can be part of a certain channel. The channel is identified by `parent_url`. All casts in the channel ladder up to the same parent_url.
* @param {string} [cursor] Pagination cursor.
* @param {number} [limit] Number of results to retrieve (default 25, max 150)
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async casts(fid, viewerFid, parentUrl, cursor, limit, options) {
const localVarAxiosArgs = await localVarAxiosParamCreator.casts(fid, viewerFid, parentUrl, cursor, limit, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
* Get a list of casts from the protocol in reverse chronological order based on timestamp
* @summary Get Recent Casts
* @param {number} [viewerFid] fid of the user viewing this information, needed for contextual information.
* @param {string} [cursor] Pagination cursor.
* @param {number} [limit] Number of results to retrieve (default 25, max 100)
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async recentCasts(viewerFid, cursor, limit, options) {
const localVarAxiosArgs = await localVarAxiosParamCreator.recentCasts(viewerFid, cursor, limit, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
};
};
/**
* CastApi - factory interface
* @export
*/
export const CastApiFactory = function (configuration, basePath, axios) {
const localVarFp = CastApiFp(configuration);
return {
/**
* Gets the most recent casts for a user in reverse-chronological order
* @summary Retrieve all casts in a given thread hash
* @param {CastApiAllCastsInThreadRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
allCastsInThread(requestParameters, options) {
return localVarFp.allCastsInThread(requestParameters.threadHash, requestParameters.viewerFid, options).then((request) => request(axios, basePath));
},
/**
* Gets information about an individual cast
* @summary Retrieve cast for a given hash
* @param {CastApiCastRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
cast(requestParameters, options) {
return localVarFp.cast(requestParameters.hash, requestParameters.viewerFid, options).then((request) => request(axios, basePath));
},
/**
* Gets the most recent casts for a user
* @summary Retrieve casts for a given user
* @param {CastApiCastsRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
casts(requestParameters, options) {
return localVarFp.casts(requestParameters.fid, requestParameters.viewerFid, requestParameters.parentUrl, requestParameters.cursor, requestParameters.limit, options).then((request) => request(axios, basePath));
},
/**
* Get a list of casts from the protocol in reverse chronological order based on timestamp
* @summary Get Recent Casts
* @param {CastApiRecentCastsRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
recentCasts(requestParameters = {}, options) {
return localVarFp.recentCasts(requestParameters.viewerFid, requestParameters.cursor, requestParameters.limit, options).then((request) => request(axios, basePath));
},
};
};
/**
* CastApi - object-oriented interface
* @export
* @class CastApi
* @extends {BaseAPI}
*/
export class CastApi extends BaseAPI {
/**
* Gets the most recent casts for a user in reverse-chronological order
* @summary Retrieve all casts in a given thread hash
* @param {CastApiAllCastsInThreadRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CastApi
*/
allCastsInThread(requestParameters, options) {
return CastApiFp(this.configuration).allCastsInThread(requestParameters.threadHash, requestParameters.viewerFid, options).then((request) => request(this.axios, this.basePath));
}
/**
* Gets information about an individual cast
* @summary Retrieve cast for a given hash
* @param {CastApiCastRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CastApi
*/
cast(requestParameters, options) {
return CastApiFp(this.configuration).cast(requestParameters.hash, requestParameters.viewerFid, options).then((request) => request(this.axios, this.basePath));
}
/**
* Gets the most recent casts for a user
* @summary Retrieve casts for a given user
* @param {CastApiCastsRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CastApi
*/
casts(requestParameters, options) {
return CastApiFp(this.configuration).casts(requestParameters.fid, requestParameters.viewerFid, requestParameters.parentUrl, requestParameters.cursor, requestParameters.limit, options).then((request) => request(this.axios, this.basePath));
}
/**
* Get a list of casts from the protocol in reverse chronological order based on timestamp
* @summary Get Recent Casts
* @param {CastApiRecentCastsRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CastApi
*/
recentCasts(requestParameters = {}, options) {
return CastApiFp(this.configuration).recentCasts(requestParameters.viewerFid, requestParameters.cursor, requestParameters.limit, options).then((request) => request(this.axios, this.basePath));
}
}
//# sourceMappingURL=cast-api.js.map