"use strict"; // Modules from file import { IBasic } from "./interfaces.js"; import HandiworkSearchQuery from "./classes/query/handiwork-search-query.js"; import LatestSearchQuery from "./classes/query/latest-search-query.js"; import ThreadSearchQuery from "./classes/query/thread-search-query.js"; import { getHandiworkInformation } from "./scrape-data/scrape-thread.js"; import executeQuery from "./fetch-data/fetch-query.js"; export async function search(query: LatestSearchQuery, limit: number): Promise export async function search(query: HandiworkSearchQuery, limit: number): Promise export async function search(query: ThreadSearchQuery, limit: number): Promise /** * Gets the handiworks that match the passed parameters. * You *must* be logged. * @param {Number} limit * Maximum number of items to get. Default: 30 */ export default async function search(query: any, limit: number = 30): Promise { // Fetch the URLs const urls: string[] = await executeQuery(query, limit); // Fetch the data const results = urls.map((url, idx) => { return getHandiworkInformation(url); }); return Promise.all(results); }