docs: document revolt-coalesced

This commit is contained in:
Zomatree
2025-09-15 01:44:21 +01:00
committed by Angelo Kontaxis
parent 5885e067a6
commit db55998546
12 changed files with 154 additions and 75 deletions

View File

@@ -11,6 +11,7 @@ use crate::{tenor, types};
#[derive(Deserialize, IntoParams)]
pub struct CategoriesQueryParams {
/// Users locale
#[param(example = "en_US")]
pub locale: String,
}

View File

@@ -19,4 +19,4 @@ pub async fn root() -> Json<types::RootResponse<'static>> {
message: "Gifbox lives on!",
version: CRATE_VERSION,
})
}
}

View File

@@ -11,12 +11,17 @@ use crate::{tenor, types};
#[derive(Deserialize, IntoParams)]
pub struct SearchQueryParams {
/// Search query
#[param(example = "Wave")]
pub query: String,
/// Users locale
#[param(example = "en_US")]
pub locale: String,
/// Amount of results to respond with
pub limit: Option<u32>,
/// Flag for if searching in a gif category
pub is_category: Option<bool>,
/// Value of `next` for getting the next page of results with the current search query
pub position: Option<String>,
}

View File

@@ -4,20 +4,20 @@ use axum::{
};
use revolt_database::User;
use revolt_result::{create_error, Result};
use serde::{Deserialize};
use utoipa::{IntoParams};
use serde::Deserialize;
use utoipa::IntoParams;
use crate::{
tenor,
types,
};
use crate::{tenor, types};
#[derive(Deserialize, IntoParams)]
pub struct TrendingQueryParams {
#[param(example = "en_US")]
/// Users locale
pub locale: String,
/// Amount of results to respond with
pub limit: Option<u32>,
pub position: Option<String>
/// Value of `next` for getting the next page of results of featured gifs
pub position: Option<String>,
}
/// Trending GIFs
@@ -37,7 +37,11 @@ pub async fn trending(
State(tenor): State<tenor::Tenor>,
) -> Result<Json<types::PaginatedMediaResponse>> {
tenor
.featured(&params.locale, params.limit.unwrap_or(50), params.position.as_deref().unwrap_or_default())
.featured(
&params.locale,
params.limit.unwrap_or(50),
params.position.as_deref().unwrap_or_default(),
)
.await
.map_err(|_| create_error!(InternalError))
.map(|results| results.as_ref().clone().into())