Merge branch '2.0.0-ts' of https://github.com/MillenniumEarl/F95API into 2.0.0-ts
commit
8563be901f
|
@ -137,7 +137,7 @@ export async function searchHandiwork<T extends IBasic>(query: HandiworkSearchQu
|
||||||
// Check if the user is logged
|
// Check if the user is logged
|
||||||
if (!shared.isLogged) throw new UserNotLogged(USER_NOT_LOGGED);
|
if (!shared.isLogged) throw new UserNotLogged(USER_NOT_LOGGED);
|
||||||
|
|
||||||
return await search<T>(query, limit);
|
return search<T>(query, limit);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -155,7 +155,7 @@ export async function getHandiworkFromURL<T extends IBasic>(url: string): Promis
|
||||||
if (!isF95URL(url)) throw new Error(`${url} is not a valid F95Zone URL`);
|
if (!isF95URL(url)) throw new Error(`${url} is not a valid F95Zone URL`);
|
||||||
|
|
||||||
// Get game data
|
// Get game data
|
||||||
return await getHandiworkInformation<T>(url);
|
return getHandiworkInformation<T>(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -196,7 +196,7 @@ export async function getLatestUpdates<T extends IBasic>(query: LatestSearchQuer
|
||||||
|
|
||||||
// Get the data from urls
|
// Get the data from urls
|
||||||
const promiseList = urls.map((u: string) => getHandiworkInformation<T>(u));
|
const promiseList = urls.map((u: string) => getHandiworkInformation<T>(u));
|
||||||
return await Promise.all(promiseList);
|
return Promise.all(promiseList);
|
||||||
};
|
};
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
|
@ -149,7 +149,7 @@ export default class UserProfile extends PlatformUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for the promises to resolve
|
// Wait for the promises to resolve
|
||||||
return await Promise.all(responsePromiseList);
|
return Promise.all(responsePromiseList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -74,7 +74,7 @@ export default class LatestSearchQuery implements IQuery {
|
||||||
const decoded = decodeURIComponent(url.toString());
|
const decoded = decodeURIComponent(url.toString());
|
||||||
|
|
||||||
// Fetch the result
|
// Fetch the result
|
||||||
return await fetchGETResponse(decoded);
|
return fetchGETResponse(decoded);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -82,7 +82,7 @@ export default class ThreadSearchQuery implements IQuery {
|
||||||
const params = this.preparePOSTParameters();
|
const params = this.preparePOSTParameters();
|
||||||
|
|
||||||
// Return the POST response
|
// Return the POST response
|
||||||
return await fetchPOSTResponse(urls.F95_SEARCH_URL, params);
|
return fetchPOSTResponse(urls.F95_SEARCH_URL, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
//#endregion Public methods
|
//#endregion Public methods
|
||||||
|
|
|
@ -36,6 +36,6 @@ export default async function executeQuery(query: any, limit: number = 30): Prom
|
||||||
"handiwork");
|
"handiwork");
|
||||||
|
|
||||||
// Fetch and return the urls
|
// Fetch and return the urls
|
||||||
return await searchMap[key](query, limit);
|
return searchMap[key](query, limit);
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
|
@ -26,7 +26,7 @@ export default async function fetchThreadHandiworkURLs(query: ThreadSearchQuery,
|
||||||
const response = await query.execute();
|
const response = await query.execute();
|
||||||
|
|
||||||
// Fetch the results from F95 and return the handiwork urls
|
// Fetch the results from F95 and return the handiwork urls
|
||||||
if (response.isSuccess()) return await fetchResultURLs(response.value.data as string, limit);
|
if (response.isSuccess()) return fetchResultURLs(response.value.data as string, limit);
|
||||||
else throw response.value
|
else throw response.value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue