amagi 0.1.2

Rust SDK, CLI, and Web API service skeleton for multi-platform social web adapters.
Documentation
use axum::{
    Json,
    extract::{Path, Query, State},
    http::HeaderMap,
};

use super::super::support::{FetchResult, douyin_fetcher, fetch_error_response};
use super::types::DouyinLiveRoomQuery;
use crate::platforms::douyin::DouyinLiveRoomInfo;
use crate::server::state::AppState;

/// Fetch Douyin live room information through the web API.
pub async fn douyin_live_room_info(
    Path(room_id): Path<String>,
    Query(query): Query<DouyinLiveRoomQuery>,
    headers: HeaderMap,
    State(state): State<AppState>,
) -> FetchResult<DouyinLiveRoomInfo> {
    douyin_fetcher(&state, &headers)
        .fetch_live_room_info(&room_id, &query.web_rid)
        .await
        .map(Json)
        .map_err(fetch_error_response)
}