use crate::{
configuration::*,
request::{HttpRequestBuilder, ResponseMiddleware},
};
use flowy_error::FlowyError;
use flowy_sync::entities::text_block_info::{CreateTextBlockParams, ResetTextBlockParams, TextBlockId, TextBlockInfo};
use flowy_text_block::BlockCloudService;
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: CreateTextBlockParams) -> 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: TextBlockId) -> FutureResult