merge from local

This commit is contained in:
SrGooglo 2024-11-17 20:35:35 +00:00
parent 4f15559a09
commit e833038542
2 changed files with 47 additions and 0 deletions

View File

@ -307,6 +307,11 @@ export default class Post {
return data 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() { static async getTrendings() {
const { data } = await request({ const { data } = await request({
method: "GET", method: "GET",
@ -315,4 +320,26 @@ export default class Post {
return data 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
}
} }

View File

@ -21,6 +21,26 @@ export default class Search {
return data 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. * Performs a quick search using the provided parameters.
* *