mirror of
https://github.com/ragestudio/comty.js.git
synced 2025-06-08 18:14:18 +00:00
merge from local
This commit is contained in:
parent
4f15559a09
commit
e833038542
@ -307,6 +307,11 @@ export default class Post {
|
||||
return data
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the trending hashtags and their counts.
|
||||
*
|
||||
* @return {Promise<Object[]>} An array of objects with two properties: "hashtag" and "count".
|
||||
*/
|
||||
static async getTrendings() {
|
||||
const { data } = await request({
|
||||
method: "GET",
|
||||
@ -315,4 +320,26 @@ export default class Post {
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the trending posts for a specific hashtag with optional trimming and limiting.
|
||||
*
|
||||
* @param {Object} options - The options for retrieving trending posts.
|
||||
* @param {string} options.trending - The hashtag to retrieve trending posts for.
|
||||
* @param {number} [options.trim=0] - The number of characters to trim the post content.
|
||||
* @param {number} [options.limit=Settings.get("feed_max_fetch")] - The maximum number of posts to fetch.
|
||||
* @return {Promise<Object[]>} An array of posts that are trending for the given hashtag.
|
||||
*/
|
||||
static async getTrending({ trending, trim, limit } = {}) {
|
||||
const { data } = await request({
|
||||
method: "GET",
|
||||
url: `/posts/trending/${trending}`,
|
||||
params: {
|
||||
trim: trim ?? 0,
|
||||
limit: limit ?? Settings.get("feed_max_fetch"),
|
||||
}
|
||||
})
|
||||
|
||||
return data
|
||||
}
|
||||
}
|
@ -21,6 +21,26 @@ export default class Search {
|
||||
return data
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches for users with the given keywords and optional parameters.
|
||||
*
|
||||
* @param {string} keywords - The keywords to search for.
|
||||
* @param {Object} [params={}] - Optional parameters for the search.
|
||||
* @return {Promise<Object>} A promise that resolves with the search results.
|
||||
*/
|
||||
static async userSearch(keywords, {limit = 50} = {}) {
|
||||
const { data } = await request({
|
||||
method: "GET",
|
||||
url: `/users/search`,
|
||||
params: {
|
||||
keywords: keywords,
|
||||
limit: limit,
|
||||
}
|
||||
})
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a quick search using the provided parameters.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user