anttp 0.26.0

AntTP is an HTTP server for the Autonomi Network
/*use actix_web::{web, HttpRequest, HttpResponse};
use actix_web::web::Data;
use ant_core::data::Wallet;
use log::debug;
use crate::controller::get_store_type;
use crate::error::pointer_error::PointerError;
use crate::model::pnr::{PnrZone, PnrRecord};
use crate::service::pnr_service::PnrService;

#[utoipa::path(
    post,
    path = "/anttp-0/pnr/mutable",
    request_body(
        content = PnrZone
    ),
    responses(
        (status = CREATED, description = "PNR zone created successfully", body = PnrZone),
        (status = BAD_REQUEST, description = "PNR zone body was invalid")
    ),
    params(
        ("x-store-type", Header, description = "Only persist to cache and do not publish (memory|disk|none)",
        example = "memory"),
    ),
)]
pub async fn post_mutable_pnr(
    pnr_service: Data<PnrService>,
    evm_wallet_data: Data<Wallet>,
    pnr_zone: web::Json<PnrZone>,
    request: HttpRequest,
) -> Result<HttpResponse, PointerError> {
    debug!("Creating new mutable PNR zone");
    Ok(HttpResponse::Created().json(
        pnr_service.create_mutable_pnr(pnr_zone.into_inner(), evm_wallet_data.get_ref().clone(), get_store_type(&request)).await?
    ))
}

#[utoipa::path(
    post,
    path = "/anttp-0/pnr/immutable",
    request_body(
        content = PnrZone
    ),
    responses(
        (status = CREATED, description = "Immutable PNR zone created successfully", body = PnrZone),
        (status = BAD_REQUEST, description = "PNR zone body was invalid")
    ),
    params(
        ("x-store-type", Header, description = "Only persist to cache and do not publish (memory|disk|none)",
        example = "memory"),
    ),
)]
pub async fn post_immutable_pnr(
    pnr_service: Data<PnrService>,
    evm_wallet_data: Data<Wallet>,
    pnr_zone: web::Json<PnrZone>,
    request: HttpRequest,
) -> Result<HttpResponse, PointerError> {
    debug!("Creating new immutable PNR zone");
    Ok(HttpResponse::Created().json(
        pnr_service.create_immutable_pnr(pnr_zone.into_inner(), evm_wallet_data.get_ref().clone(), get_store_type(&request)).await?
    ))
}

#[utoipa::path(
    put,
    path = "/anttp-0/pnr/{name}",
    params(
        ("name", description = "PNR name"),
        ("x-store-type", Header, description = "Only persist to cache and do not publish (memory|disk|none)",
        example = "memory"),
    ),
    request_body(
        content = PnrZone
    ),
    responses(
        (status = OK, description = "PNR zone updated successfully", body = PnrZone),
        (status = BAD_REQUEST, description = "PNR zone body was invalid")
    ),
)]
pub async fn put_pnr(
    path: web::Path<String>,
    pnr_service: Data<PnrService>,
    evm_wallet_data: Data<Wallet>,
    pnr_zone: web::Json<PnrZone>,
    request: HttpRequest,
) -> Result<HttpResponse, PointerError> {
    let name = path.into_inner();

    debug!("Updating PNR zone");
    Ok(HttpResponse::Ok().json(
        pnr_service.update_pnr(name, pnr_zone.into_inner(), evm_wallet_data.get_ref().clone(), get_store_type(&request)).await?
    ))
}

#[utoipa::path(
    patch,
    path = "/anttp-0/pnr/{name}",
    params(
        ("name", description = "PNR name"),
        ("x-store-type", Header, description = "Only persist to cache and do not publish (memory|disk|none)",
        example = "memory"),
    ),
    request_body(
        content = PnrZone
    ),
    responses(
        (status = OK, description = "PNR zone records appended/replaced successfully", body = PnrZone),
        (status = BAD_REQUEST, description = "PNR zone body was invalid")
    ),
)]
pub async fn patch_pnr(
    path: web::Path<String>,
    pnr_service: Data<PnrService>,
    evm_wallet_data: Data<Wallet>,
    pnr_zone: web::Json<PnrZone>,
    request: HttpRequest,
) -> Result<HttpResponse, PointerError> {
    let name = path.into_inner();

    debug!("Appending PNR records to zone");
    Ok(HttpResponse::Ok().json(
        pnr_service.append_pnr(name, pnr_zone.into_inner(), evm_wallet_data.get_ref().clone(), get_store_type(&request)).await?
    ))
}

#[utoipa::path(
    get,
    path = "/anttp-0/pnr/{name}",
    params(
        ("name", description = "PNR name"),
    ),
    responses(
        (status = OK, description = "PNR zone retrieved successfully", body = PnrZone),
        (status = NOT_FOUND, description = "PNR zone not found")
    ),
)]
pub async fn get_pnr(
    path: web::Path<String>,
    pnr_service: Data<PnrService>,
) -> Result<HttpResponse, PointerError> {
    let name = path.into_inner();

    debug!("Getting PNR zone");
    Ok(HttpResponse::Ok().json(
        pnr_service.get_pnr(name).await?
    ))
}

#[utoipa::path(
    put,
    path = "/anttp-0/pnr/{name}/{record}",
    params(
        ("name", description = "PNR zone name"),
        ("record", description = "PNR record key"),
        ("x-store-type", Header, description = "Only persist to cache and do not publish (memory|disk|none)",
        example = "memory"),
    ),
    request_body(
        content = PnrRecord
    ),
    responses(
        (status = OK, description = "PNR record added/updated successfully", body = PnrZone),
        (status = BAD_REQUEST, description = "PNR record body was invalid")
    ),
)]
pub async fn put_pnr_record(
    path: web::Path<(String, String)>,
    pnr_service: Data<PnrService>,
    evm_wallet_data: Data<Wallet>,
    pnr_record: web::Json<PnrRecord>,
    request: HttpRequest,
) -> Result<HttpResponse, PointerError> {
    let (name, record_key) = path.into_inner();

    debug!("Updating PNR record {} in zone {}", record_key, name);
    Ok(HttpResponse::Ok().json(
        pnr_service.update_pnr_record(name, record_key, pnr_record.into_inner(), evm_wallet_data.get_ref().clone(), get_store_type(&request)).await?
    ))
}*/