opencloudmesh 0.2.1

Implementation of the OpenCloudMesh protocol
Documentation
// SPDX-FileCopyrightText: 2026 Matthias Kraus <info@opengeomesh.org>
//
// SPDX-License-Identifier: LGPL-3.0-or-later

use http::Uri;
use serde_json::Value;

/// Generic HTTP Client Trait
///
/// For [discovery](crate::discovery), sending [shares](crate::share) and 
/// [notifications](crate::notifications) a HTTP Client is necessary.
/// By implementing this trait you can use a HTTP Client of your choice for that.
/// Make sure to implement timeouts and caching as appropriate to your application.
///
/// >⚠️  **Note:** Currently when implementing this trait you also need to implement http signatures!
/// > This might be replaced by some hyper based client or service trait in future releases.
pub trait HttpClient {
    fn get(
        &self,
        url: &Uri,
    ) -> impl std::future::Future<Output = Result<String, String>> + std::marker::Send + std::marker::Sized;
    fn post(
        &self,
        url: &Uri,
        body: Value,
    ) -> impl std::future::Future<Output = Result<String, String>> + std::marker::Send + std::marker::Sized;

    fn allow_http(&self) -> bool;
}