feat: Chat request implementation #14

Manually merged
awiteb merged 55 commits from awiteb/chat-request-and-response into master 2024-07-18 14:21:39 +02:00 AGit
Showing only changes of commit d0d048c135 - Show all commits

View file

@ -26,7 +26,9 @@ use salvo::{
extract::Metadata as ExtractMetadata, extract::Metadata as ExtractMetadata,
oapi::{ oapi::{
Components as OapiComponents, Components as OapiComponents,
EndpointArgRegister,
Object, Object,
Operation as OapiOperation,
Parameter, Parameter,
ParameterIn, ParameterIn,
Parameters, Parameters,
@ -86,6 +88,14 @@ impl ToParameters<'_> for Pagination {
} }
} }
impl EndpointArgRegister for Pagination {
fn register(components: &mut OapiComponents, operation: &mut OapiOperation, _arg: &str) {
for parameter in Self::to_parameters(components) {
operation.parameters.insert(parameter);
}
}
}
/// Extract a query parameter from the request /// Extract a query parameter from the request
fn extract_query<T: FromStr>(req: &Request, name: &str, default_value: T) -> ApiResult<T> fn extract_query<T: FromStr>(req: &Request, name: &str, default_value: T) -> ApiResult<T>
where where