athena_rs 3.22.1

Hyper performant polyglot Database driver
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Request parsing for gateway fetch POST: sort options and cache key material.

use actix_web::HttpResponse;
use serde_json::{Value, json};

use super::conditions::RequestCondition;
pub(super) use athena_gateway::build_fetch_hashed_cache_key_legacy8;
pub use athena_gateway::{build_fetch_hashed_cache_key, parse_sort_options_from_body};

/// Parses `conditions` from a gateway fetch JSON body; returns HTTP 400 on invalid `room_id` filters.
pub fn parse_gateway_fetch_conditions(
    json_body: &Value,
    force_camel_case_to_snake_case: bool,
) -> Result<Vec<RequestCondition>, HttpResponse> {
    athena_gateway::parse_gateway_fetch_conditions(json_body, force_camel_case_to_snake_case)
        .map_err(|err| HttpResponse::BadRequest().json(json!({ "error": err.message() })))
}