@standard-crypto/farcaster-js-hub-rest
Version:
A tool for interacting with the REST API of any Farcaster hub.
366 lines • 18.4 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, setSearchParams, toPathString, createRequestFunction } from '../common.js';
// @ts-ignore
import { BASE_PATH, BaseAPI } from '../base.js';
/**
* CastsApi - axios parameter creator
* @export
*/
export const CastsApiAxiosParamCreator = function (configuration) {
return {
/**
*
* @summary Get a cast by its FID and Hash.
* @param {number} fid The FID of the cast\'s creator
* @param {string} hash The cast\'s hash
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCastById: async (fid, hash, options = {}) => {
// verify required parameter 'fid' is not null or undefined
assertParamExists('getCastById', 'fid', fid);
// verify required parameter 'hash' is not null or undefined
assertParamExists('getCastById', 'hash', hash);
const localVarPath = `/v1/castById`;
// 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 (hash !== undefined) {
localVarQueryParameter['hash'] = hash;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Fetch all casts authored by an FID.
* @param {number} fid The FID of the casts\' creator
* @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}
*/
listCastsByFid: async (fid, pageSize, reverse, pageToken, options = {}) => {
// verify required parameter 'fid' is not null or undefined
assertParamExists('listCastsByFid', 'fid', fid);
const localVarPath = `/v1/castsByFid`;
// 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 (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,
};
},
/**
*
* @summary Fetch all casts that mention an FID
* @param {number} fid The FID that is mentioned in a cast
* @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}
*/
listCastsByMention: async (fid, pageSize, reverse, pageToken, options = {}) => {
// verify required parameter 'fid' is not null or undefined
assertParamExists('listCastsByMention', 'fid', fid);
const localVarPath = `/v1/castsByMention`;
// 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 (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,
};
},
/**
*
* @summary Fetch all casts by parent cast\'s FID and Hash OR by the parent\'s URL
* @param {number} [fid] The FID of the parent cast
* @param {string} [hash] The parent cast\'s hash
* @param {string} [url]
* @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}
*/
listCastsByParent: async (fid, hash, url, pageSize, reverse, pageToken, options = {}) => {
const localVarPath = `/v1/castsByParent`;
// 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 (hash !== undefined) {
localVarQueryParameter['hash'] = hash;
}
if (url !== undefined) {
localVarQueryParameter['url'] = url;
}
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,
};
},
};
};
/**
* CastsApi - functional programming interface
* @export
*/
export const CastsApiFp = function (configuration) {
const localVarAxiosParamCreator = CastsApiAxiosParamCreator(configuration);
return {
/**
*
* @summary Get a cast by its FID and Hash.
* @param {number} fid The FID of the cast\'s creator
* @param {string} hash The cast\'s hash
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getCastById(fid, hash, options) {
const localVarAxiosArgs = await localVarAxiosParamCreator.getCastById(fid, hash, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @summary Fetch all casts authored by an FID.
* @param {number} fid The FID of the casts\' creator
* @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 listCastsByFid(fid, pageSize, reverse, pageToken, options) {
const localVarAxiosArgs = await localVarAxiosParamCreator.listCastsByFid(fid, pageSize, reverse, pageToken, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @summary Fetch all casts that mention an FID
* @param {number} fid The FID that is mentioned in a cast
* @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 listCastsByMention(fid, pageSize, reverse, pageToken, options) {
const localVarAxiosArgs = await localVarAxiosParamCreator.listCastsByMention(fid, pageSize, reverse, pageToken, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @summary Fetch all casts by parent cast\'s FID and Hash OR by the parent\'s URL
* @param {number} [fid] The FID of the parent cast
* @param {string} [hash] The parent cast\'s hash
* @param {string} [url]
* @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 listCastsByParent(fid, hash, url, pageSize, reverse, pageToken, options) {
const localVarAxiosArgs = await localVarAxiosParamCreator.listCastsByParent(fid, hash, url, pageSize, reverse, pageToken, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
};
};
/**
* CastsApi - factory interface
* @export
*/
export const CastsApiFactory = function (configuration, basePath, axios) {
const localVarFp = CastsApiFp(configuration);
return {
/**
*
* @summary Get a cast by its FID and Hash.
* @param {CastsApiGetCastByIdRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCastById(requestParameters, options) {
return localVarFp.getCastById(requestParameters.fid, requestParameters.hash, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Fetch all casts authored by an FID.
* @param {CastsApiListCastsByFidRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listCastsByFid(requestParameters, options) {
return localVarFp.listCastsByFid(requestParameters.fid, requestParameters.pageSize, requestParameters.reverse, requestParameters.pageToken, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Fetch all casts that mention an FID
* @param {CastsApiListCastsByMentionRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listCastsByMention(requestParameters, options) {
return localVarFp.listCastsByMention(requestParameters.fid, requestParameters.pageSize, requestParameters.reverse, requestParameters.pageToken, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Fetch all casts by parent cast\'s FID and Hash OR by the parent\'s URL
* @param {CastsApiListCastsByParentRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listCastsByParent(requestParameters = {}, options) {
return localVarFp.listCastsByParent(requestParameters.fid, requestParameters.hash, requestParameters.url, requestParameters.pageSize, requestParameters.reverse, requestParameters.pageToken, options).then((request) => request(axios, basePath));
},
};
};
/**
* CastsApi - object-oriented interface
* @export
* @class CastsApi
* @extends {BaseAPI}
*/
export class CastsApi extends BaseAPI {
/**
*
* @summary Get a cast by its FID and Hash.
* @param {CastsApiGetCastByIdRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CastsApi
*/
getCastById(requestParameters, options) {
return CastsApiFp(this.configuration).getCastById(requestParameters.fid, requestParameters.hash, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Fetch all casts authored by an FID.
* @param {CastsApiListCastsByFidRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CastsApi
*/
listCastsByFid(requestParameters, options) {
return CastsApiFp(this.configuration).listCastsByFid(requestParameters.fid, requestParameters.pageSize, requestParameters.reverse, requestParameters.pageToken, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Fetch all casts that mention an FID
* @param {CastsApiListCastsByMentionRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CastsApi
*/
listCastsByMention(requestParameters, options) {
return CastsApiFp(this.configuration).listCastsByMention(requestParameters.fid, requestParameters.pageSize, requestParameters.reverse, requestParameters.pageToken, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Fetch all casts by parent cast\'s FID and Hash OR by the parent\'s URL
* @param {CastsApiListCastsByParentRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CastsApi
*/
listCastsByParent(requestParameters = {}, options) {
return CastsApiFp(this.configuration).listCastsByParent(requestParameters.fid, requestParameters.hash, requestParameters.url, requestParameters.pageSize, requestParameters.reverse, requestParameters.pageToken, options).then((request) => request(this.axios, this.basePath));
}
}
//# sourceMappingURL=casts-api.js.map