use crate::{
configuration::*,
request::{HttpRequestBuilder, ResponseMiddleware},
};
use flowy_block::BlockCloudService;
use flowy_collaboration::entities::document_info::{BlockId, BlockInfo, CreateBlockParams, ResetDocumentParams};
use flowy_error::FlowyError;
use http_flowy::response::FlowyResponse;
use lazy_static::lazy_static;
use lib_infra::future::FutureResult;
use std::sync::Arc;
pub struct BlockHttpCloudService {
config: ClientServerConfiguration,
}
impl BlockHttpCloudService {
pub fn new(config: ClientServerConfiguration) -> Self {
Self { config }
}
}
impl BlockCloudService for BlockHttpCloudService {
fn create_block(&self, token: &str, params: CreateBlockParams) -> FutureResult<(), FlowyError> {
let token = token.to_owned();
let url = self.config.doc_url();
FutureResult::new(async move { create_document_request(&token, params, &url).await })
}
fn read_block(&self, token: &str, params: BlockId) -> FutureResult