rename some structs

This commit is contained in:
appflowy 2021-12-31 10:32:25 +08:00
parent 282ed9067a
commit 45821f00a2
80 changed files with 772 additions and 783 deletions

View File

@ -10,7 +10,7 @@ use chrono::Utc;
use flowy_core_data_model::{
parser::{
app::{AppDesc, AppName},
workspace::WorkspaceId,
workspace::WorkspaceIdentify,
},
protobuf::{App, CreateAppParams, RepeatedView},
};
@ -23,7 +23,7 @@ pub(crate) async fn create_app(
logged_user: LoggedUser,
) -> Result<App, ServerError> {
let name = AppName::parse(params.take_name()).map_err(invalid_params)?;
let workspace_id = WorkspaceId::parse(params.take_workspace_id()).map_err(invalid_params)?;
let workspace_id = WorkspaceIdentify::parse(params.take_workspace_id()).map_err(invalid_params)?;
let user_id = logged_user.as_uuid()?.to_string();
let desc = AppDesc::parse(params.take_desc()).map_err(invalid_params)?;

View File

@ -2,7 +2,7 @@ use crate::util::sqlx_ext::SqlBuilder;
use backend_service::errors::{invalid_params, ServerError};
use chrono::{DateTime, NaiveDateTime, Utc};
use flowy_core_data_model::{
parser::app::AppId,
parser::app::AppIdentify,
protobuf::{App, ColorStyle, RepeatedView},
};
use protobuf::Message;
@ -106,7 +106,7 @@ fn default_color_style() -> Vec<u8> {
}
pub(crate) fn check_app_id(id: String) -> Result<Uuid, ServerError> {
let app_id = AppId::parse(id).map_err(invalid_params)?;
let app_id = AppIdentify::parse(id).map_err(invalid_params)?;
let app_id = Uuid::parse_str(app_id.as_ref())?;
Ok(app_id)
}

View File

@ -17,7 +17,7 @@ use backend_service::{
};
use flowy_core_data_model::{
parser::app::{AppDesc, AppName},
protobuf::{AppIdentifier, CreateAppParams, UpdateAppParams},
protobuf::{AppId, CreateAppParams, UpdateAppParams},
};
use protobuf::Message;
use sqlx::PgPool;
@ -44,7 +44,7 @@ pub async fn create_handler(
}
pub async fn read_handler(payload: Payload, pool: Data<PgPool>, user: LoggedUser) -> Result<HttpResponse, ServerError> {
let params: AppIdentifier = parse_from_payload(payload).await?;
let params: AppId = parse_from_payload(payload).await?;
let app_id = check_app_id(params.app_id)?;
let mut transaction = pool
@ -96,7 +96,7 @@ pub async fn update_handler(payload: Payload, pool: Data<PgPool>) -> Result<Http
}
pub async fn delete_handler(payload: Payload, pool: Data<PgPool>) -> Result<HttpResponse, ServerError> {
let params: AppIdentifier = parse_from_payload(payload).await?;
let params: AppId = parse_from_payload(payload).await?;
let app_id = check_app_id(params.app_id.to_owned())?;
let mut transaction = pool
.begin()

View File

@ -14,7 +14,7 @@ use backend_service::{
errors::{invalid_params, ServerError},
response::FlowyResponse,
};
use flowy_core_data_model::{parser::trash::TrashId, protobuf::TrashIdentifiers};
use flowy_core_data_model::{parser::trash::TrashIdentify, protobuf::RepeatedTrashId};
use sqlx::PgPool;
use std::sync::Arc;
use uuid::Uuid;
@ -25,7 +25,7 @@ pub async fn create_handler(
pool: Data<PgPool>,
logged_user: LoggedUser,
) -> Result<HttpResponse, ServerError> {
let params: TrashIdentifiers = parse_from_payload(payload).await?;
let params: RepeatedTrashId = parse_from_payload(payload).await?;
let mut transaction = pool
.begin()
.await
@ -49,7 +49,7 @@ pub async fn delete_handler(
) -> Result<HttpResponse, ServerError> {
let pool = persistence.pg_pool();
let kv_store = persistence.kv_store();
let params: TrashIdentifiers = parse_from_payload(payload).await?;
let params: RepeatedTrashId = parse_from_payload(payload).await?;
let mut transaction = pool
.begin()
.await
@ -88,12 +88,12 @@ pub async fn read_handler(pool: Data<PgPool>, logged_user: LoggedUser) -> Result
}
fn check_trash_id(id: String) -> Result<Uuid, ServerError> {
let trash_id = TrashId::parse(id).map_err(invalid_params)?;
let trash_id = TrashIdentify::parse(id).map_err(invalid_params)?;
let trash_id = Uuid::parse_str(trash_id.as_ref())?;
Ok(trash_id)
}
fn make_records(identifiers: TrashIdentifiers) -> Result<Vec<(Uuid, i32)>, ServerError> {
fn make_records(identifiers: RepeatedTrashId) -> Result<Vec<(Uuid, i32)>, ServerError> {
let mut records = vec![];
for identifier in identifiers.items {
// match TrashType::from_i32(identifier.ty.value()) {

View File

@ -15,7 +15,7 @@ use flowy_collaboration::{
};
use flowy_core_data_model::{
parser::{
app::AppId,
app::AppIdentify,
view::{ViewDesc, ViewName, ViewThumbnail},
},
protobuf::{CreateViewParams, RepeatedView, View},
@ -74,7 +74,7 @@ pub(crate) async fn create_view(
) -> Result<View, ServerError> {
let view_id = check_view_id(params.view_id.clone())?;
let name = ViewName::parse(params.name).map_err(invalid_params)?;
let belong_to_id = AppId::parse(params.belong_to_id).map_err(invalid_params)?;
let belong_to_id = AppIdentify::parse(params.belong_to_id).map_err(invalid_params)?;
let thumbnail = ViewThumbnail::parse(params.thumbnail).map_err(invalid_params)?;
let desc = ViewDesc::parse(params.desc).map_err(invalid_params)?;

View File

@ -2,7 +2,7 @@ use crate::util::sqlx_ext::SqlBuilder;
use backend_service::errors::{invalid_params, ServerError};
use chrono::{DateTime, NaiveDateTime, Utc};
use flowy_core_data_model::{
parser::view::ViewId,
parser::view::ViewIdentify,
protobuf::{RepeatedView, View, ViewType},
};
use protobuf::ProtobufEnum;
@ -34,7 +34,7 @@ impl NewViewSqlBuilder {
}
pub fn from_view(view: View) -> Result<Self, ServerError> {
let view_id = ViewId::parse(view.id).map_err(invalid_params)?;
let view_id = ViewIdentify::parse(view.id).map_err(invalid_params)?;
let view_id = Uuid::parse_str(view_id.as_ref())?;
let create_time = DateTime::<Utc>::from_utc(NaiveDateTime::from_timestamp(view.create_time, 0), Utc);
let modified_time = DateTime::<Utc>::from_utc(NaiveDateTime::from_timestamp(view.modified_time, 0), Utc);
@ -99,7 +99,7 @@ pub(crate) fn check_view_ids(ids: Vec<String>) -> Result<Vec<Uuid>, ServerError>
}
pub(crate) fn check_view_id(id: String) -> Result<Uuid, ServerError> {
let view_id = ViewId::parse(id).map_err(invalid_params)?;
let view_id = ViewIdentify::parse(id).map_err(invalid_params)?;
let view_id = Uuid::parse_str(view_id.as_ref())?;
Ok(view_id)
}

View File

@ -21,7 +21,7 @@ use backend_service::{
};
use flowy_core_data_model::{
parser::view::{ViewDesc, ViewName, ViewThumbnail},
protobuf::{CreateViewParams, QueryViewRequest, UpdateViewParams, ViewIdentifier},
protobuf::{CreateViewParams, QueryViewRequest, UpdateViewParams, ViewId},
};
use sqlx::PgPool;
use std::sync::Arc;
@ -50,7 +50,7 @@ pub async fn create_handler(
}
pub async fn read_handler(payload: Payload, pool: Data<PgPool>, user: LoggedUser) -> Result<HttpResponse, ServerError> {
let params: ViewIdentifier = parse_from_payload(payload).await?;
let params: ViewId = parse_from_payload(payload).await?;
let view_id = check_view_ids(vec![params.view_id])?.pop().unwrap();
let mut transaction = pool
.begin()

View File

@ -10,7 +10,7 @@ use crate::{
use anyhow::Context;
use backend_service::errors::{invalid_params, ServerError};
use flowy_core_data_model::{
parser::workspace::WorkspaceId,
parser::workspace::WorkspaceIdentify,
protobuf::{RepeatedApp, RepeatedWorkspace, Workspace},
};
use sqlx::{postgres::PgArguments, Postgres};
@ -120,7 +120,7 @@ async fn read_workspace_apps<'c>(
transaction: &mut DBTransaction<'_>,
workspace_id: &str,
) -> Result<RepeatedApp, ServerError> {
let workspace_id = WorkspaceId::parse(workspace_id.to_owned()).map_err(invalid_params)?;
let workspace_id = WorkspaceIdentify::parse(workspace_id.to_owned()).map_err(invalid_params)?;
let (sql, args) = SqlBuilder::select("app_table")
.add_field("*")
.and_where_eq("workspace_id", workspace_id.0)

View File

@ -1,7 +1,7 @@
use crate::util::sqlx_ext::SqlBuilder;
use backend_service::errors::{invalid_params, ServerError};
use chrono::{DateTime, NaiveDateTime, Utc};
use flowy_core_data_model::{parser::workspace::WorkspaceId, protobuf::Workspace};
use flowy_core_data_model::{parser::workspace::WorkspaceIdentify, protobuf::Workspace};
use sqlx::postgres::PgArguments;
use uuid::Uuid;
@ -69,7 +69,7 @@ impl NewWorkspaceBuilder {
}
pub(crate) fn check_workspace_id(id: String) -> Result<Uuid, ServerError> {
let workspace_id = WorkspaceId::parse(id).map_err(invalid_params)?;
let workspace_id = WorkspaceIdentify::parse(id).map_err(invalid_params)?;
let workspace_id = Uuid::parse_str(workspace_id.as_ref())?;
Ok(workspace_id)
}

View File

@ -20,7 +20,7 @@ use backend_service::{
};
use flowy_core_data_model::{
parser::workspace::{WorkspaceDesc, WorkspaceName},
protobuf::{CreateWorkspaceParams, UpdateWorkspaceParams, WorkspaceIdentifier},
protobuf::{CreateWorkspaceParams, UpdateWorkspaceParams, WorkspaceId},
};
use sqlx::PgPool;
@ -50,7 +50,7 @@ pub async fn read_handler(
pool: Data<PgPool>,
logged_user: LoggedUser,
) -> Result<HttpResponse, ServerError> {
let params: WorkspaceIdentifier = parse_from_payload(payload).await?;
let params: WorkspaceId = parse_from_payload(payload).await?;
let mut transaction = pool
.begin()
.await
@ -76,7 +76,7 @@ pub async fn delete_handler(
pool: Data<PgPool>,
_logged_user: LoggedUser,
) -> Result<HttpResponse, ServerError> {
let params: WorkspaceIdentifier = parse_from_payload(payload).await?;
let params: WorkspaceId = parse_from_payload(payload).await?;
let workspace_id = check_workspace_id(params.get_workspace_id().to_owned())?;
let mut transaction = pool
.begin()

View File

@ -7,7 +7,7 @@ use backend_service::errors::{internal_error, ServerError};
use bytes::Bytes;
use flowy_collaboration::protobuf::{
CreateDocParams,
DocIdentifier,
DocumentId,
DocumentInfo,
RepeatedRevision,
ResetDocumentParams,
@ -32,7 +32,7 @@ pub(crate) async fn create_document(
#[tracing::instrument(level = "debug", skip(kv_store), err)]
pub async fn read_document(
kv_store: &Arc<DocumentKVPersistence>,
params: DocIdentifier,
params: DocumentId,
) -> Result<DocumentInfo, ServerError> {
let _ = Uuid::parse_str(&params.doc_id).context("Parse document id to uuid failed")?;
let revisions = kv_store.batch_get_revisions(&params.doc_id, None).await?;

View File

@ -8,7 +8,7 @@ use actix_web::{
HttpResponse,
};
use backend_service::{errors::ServerError, response::FlowyResponse};
use flowy_collaboration::protobuf::{CreateDocParams, DocIdentifier, ResetDocumentParams};
use flowy_collaboration::protobuf::{CreateDocParams, DocumentId, ResetDocumentParams};
use std::sync::Arc;
@ -27,7 +27,7 @@ pub async fn read_document_handler(
payload: Payload,
persistence: Data<Arc<FlowyPersistence>>,
) -> Result<HttpResponse, ServerError> {
let params: DocIdentifier = parse_from_payload(payload).await?;
let params: DocumentId = parse_from_payload(payload).await?;
let kv_store = persistence.kv_store();
let doc = read_document(&kv_store, params).await?;
let response = FlowyResponse::success().pb(doc)?;

View File

@ -14,7 +14,7 @@ use flowy_collaboration::{
revision::{RepeatedRevision, Revision},
},
errors::CollaborateError,
protobuf::DocIdentifier,
protobuf::DocumentId,
sync::{DocumentPersistence, ServerDocumentManager},
};
use lib_infra::future::BoxResultFuture;
@ -79,7 +79,7 @@ impl Debug for DocumentPersistenceImpl {
impl DocumentPersistence for DocumentPersistenceImpl {
fn read_doc(&self, doc_id: &str) -> BoxResultFuture<DocumentInfo, CollaborateError> {
let params = DocIdentifier {
let params = DocumentId {
doc_id: doc_id.to_string(),
..Default::default()
};

View File

@ -4,15 +4,15 @@ use crate::util::helper::{ViewTest, *};
use flowy_collaboration::{
document::{Document, PlainDoc},
entities::{
doc::{CreateDocParams, DocIdentifier},
doc::{CreateDocParams, DocumentId},
revision::{md5, RepeatedRevision, RevType, Revision},
},
};
use flowy_core_data_model::entities::{
app::{AppIdentifier, UpdateAppParams},
trash::{TrashIdentifier, TrashIdentifiers, TrashType},
view::{UpdateViewParams, ViewIdentifier, ViewIdentifiers},
workspace::{CreateWorkspaceParams, UpdateWorkspaceParams, WorkspaceIdentifier},
app::{AppId, UpdateAppParams},
trash::{RepeatedTrashId, TrashId, TrashType},
view::{RepeatedViewId, UpdateViewParams, ViewId},
workspace::{CreateWorkspaceParams, UpdateWorkspaceParams, WorkspaceId},
};
#[actix_rt::test]
@ -24,7 +24,7 @@ async fn workspace_create() {
#[actix_rt::test]
async fn workspace_read() {
let test = WorkspaceTest::new().await;
let read_params = WorkspaceIdentifier::new(Some(test.workspace.id.clone()));
let read_params = WorkspaceId::new(Some(test.workspace.id.clone()));
let repeated_workspace = test.server.read_workspaces(read_params).await;
tracing::info!("{:?}", repeated_workspace);
}
@ -37,7 +37,7 @@ async fn workspace_read_with_belongs() {
let _ = test.create_app().await;
let _ = test.create_app().await;
let read_params = WorkspaceIdentifier::new(Some(test.workspace.id.clone()));
let read_params = WorkspaceId::new(Some(test.workspace.id.clone()));
let workspaces = test.server.read_workspaces(read_params).await;
let workspace = workspaces.items.first().unwrap();
assert_eq!(workspace.apps.len(), 3);
@ -55,7 +55,7 @@ async fn workspace_update() {
desc: Some(new_desc.to_string()),
};
test.server.update_workspace(update_params).await;
let read_params = WorkspaceIdentifier::new(Some(test.workspace.id.clone()));
let read_params = WorkspaceId::new(Some(test.workspace.id.clone()));
let repeated_workspace = test.server.read_workspaces(read_params).await;
let workspace = repeated_workspace.first().unwrap();
@ -66,12 +66,12 @@ async fn workspace_update() {
#[actix_rt::test]
async fn workspace_delete() {
let test = WorkspaceTest::new().await;
let delete_params = WorkspaceIdentifier {
let delete_params = WorkspaceId {
workspace_id: Some(test.workspace.id.clone()),
};
let _ = test.server.delete_workspace(delete_params).await;
let read_params = WorkspaceIdentifier::new(Some(test.workspace.id.clone()));
let read_params = WorkspaceId::new(Some(test.workspace.id.clone()));
let repeated_workspace = test.server.read_workspaces(read_params).await;
assert_eq!(repeated_workspace.len(), 0);
}
@ -85,7 +85,7 @@ async fn app_create() {
#[actix_rt::test]
async fn app_read() {
let test = AppTest::new().await;
let read_params = AppIdentifier::new(&test.app.id);
let read_params = AppId::new(&test.app.id);
assert_eq!(test.server.read_app(read_params).await.is_some(), true);
}
@ -96,7 +96,7 @@ async fn app_read_with_belongs() {
let _ = create_test_view(&test.server, &test.app.id).await;
let _ = create_test_view(&test.server, &test.app.id).await;
let read_params = AppIdentifier::new(&test.app.id);
let read_params = AppId::new(&test.app.id);
let app = test.server.read_app(read_params).await.unwrap();
assert_eq!(app.belongings.len(), 2);
}
@ -110,7 +110,7 @@ async fn app_read_with_belongs_in_trash() {
test.server.create_view_trash(&view.id).await;
let read_params = AppIdentifier::new(&test.app.id);
let read_params = AppId::new(&test.app.id);
let app = test.server.read_app(read_params).await.unwrap();
assert_eq!(app.belongings.len(), 1);
}
@ -124,7 +124,7 @@ async fn app_update() {
let update_params = UpdateAppParams::new(&test.app.id).name(new_name);
test.server.update_app(update_params).await;
let read_params = AppIdentifier::new(&test.app.id);
let read_params = AppId::new(&test.app.id);
let app = test.server.read_app(read_params).await.unwrap();
assert_eq!(&app.name, new_name);
}
@ -133,11 +133,11 @@ async fn app_update() {
async fn app_delete() {
let test = AppTest::new().await;
let delete_params = AppIdentifier {
let delete_params = AppId {
app_id: test.app.id.clone(),
};
test.server.delete_app(delete_params).await;
let read_params = AppIdentifier::new(&test.app.id);
let read_params = AppId::new(&test.app.id);
assert_eq!(test.server.read_app(read_params).await.is_none(), true);
}
@ -157,7 +157,7 @@ async fn view_update() {
test.server.update_view(update_params).await;
// read
let read_params: ViewIdentifier = test.view.id.clone().into();
let read_params: ViewId = test.view.id.clone().into();
let view = test.server.read_view(read_params).await.unwrap();
assert_eq!(&view.name, new_name);
}
@ -176,7 +176,7 @@ async fn view_delete() {
.map(|item| item.id)
.collect::<Vec<String>>();
// read
let read_params: ViewIdentifier = test.view.id.clone().into();
let read_params: ViewId = test.view.id.clone().into();
// the view can't read from the server. it should be in the trash
assert_eq!(test.server.read_view(read_params).await.is_none(), true);
@ -188,7 +188,7 @@ async fn trash_delete() {
let test = ViewTest::new().await;
test.server.create_view_trash(&test.view.id).await;
let identifier = TrashIdentifier {
let identifier = TrashId {
id: test.view.id.clone(),
ty: TrashType::View,
};
@ -202,7 +202,7 @@ async fn trash_delete_all() {
let test = ViewTest::new().await;
test.server.create_view_trash(&test.view.id).await;
test.server.delete_view_trash(TrashIdentifiers::all()).await;
test.server.delete_view_trash(RepeatedTrashId::all()).await;
assert_eq!(test.server.read_trash().await.is_empty(), true);
}
@ -219,7 +219,7 @@ async fn workspace_list_read() {
let _ = server.create_workspace(params).await;
}
let read_params = WorkspaceIdentifier::new(None);
let read_params = WorkspaceId::new(None);
let workspaces = server.read_workspaces(read_params).await;
assert_eq!(workspaces.len(), 3);
}
@ -227,7 +227,7 @@ async fn workspace_list_read() {
#[actix_rt::test]
async fn doc_read() {
let test = ViewTest::new().await;
let params = DocIdentifier {
let params = DocumentId {
doc_id: test.view.id.clone(),
};
let doc = test.server.read_doc(params).await;
@ -262,19 +262,19 @@ async fn doc_create() {
};
server.create_doc(params).await;
let doc = server.read_doc(DocIdentifier { doc_id }).await;
let doc = server.read_doc(DocumentId { doc_id }).await;
assert_eq!(doc.unwrap().text, document.to_json());
}
#[actix_rt::test]
async fn doc_delete() {
let test = ViewTest::new().await;
let delete_params = ViewIdentifiers {
view_ids: vec![test.view.id.clone()],
let delete_params = RepeatedViewId {
items: vec![test.view.id.clone()],
};
test.server.delete_view(delete_params).await;
let params = DocIdentifier {
let params = DocumentId {
doc_id: test.view.id.clone(),
};
let doc = test.server.read_doc(params).await;

View File

@ -11,7 +11,7 @@ use backend_service::{
};
use flowy_collaboration::{
document::default::initial_delta_string,
entities::doc::{CreateDocParams, DocIdentifier, DocumentInfo},
entities::doc::{CreateDocParams, DocumentId, DocumentInfo},
};
use flowy_core_data_model::entities::prelude::*;
use flowy_document::services::server::{create_doc_request, read_doc_request};
@ -68,7 +68,7 @@ impl TestUserServer {
workspace
}
pub async fn read_workspaces(&self, params: WorkspaceIdentifier) -> RepeatedWorkspace {
pub async fn read_workspaces(&self, params: WorkspaceId) -> RepeatedWorkspace {
let url = format!("{}/api/workspace", self.http_addr());
let workspaces = read_workspaces_request(self.user_token(), params, &url).await.unwrap();
workspaces
@ -79,7 +79,7 @@ impl TestUserServer {
update_workspace_request(self.user_token(), params, &url).await.unwrap();
}
pub async fn delete_workspace(&self, params: WorkspaceIdentifier) {
pub async fn delete_workspace(&self, params: WorkspaceId) {
let url = format!("{}/api/workspace", self.http_addr());
delete_workspace_request(self.user_token(), params, &url).await.unwrap();
}
@ -90,7 +90,7 @@ impl TestUserServer {
app
}
pub async fn read_app(&self, params: AppIdentifier) -> Option<App> {
pub async fn read_app(&self, params: AppId) -> Option<App> {
let url = format!("{}/api/app", self.http_addr());
let app = read_app_request(self.user_token(), params, &url).await.unwrap();
app
@ -101,7 +101,7 @@ impl TestUserServer {
update_app_request(self.user_token(), params, &url).await.unwrap();
}
pub async fn delete_app(&self, params: AppIdentifier) {
pub async fn delete_app(&self, params: AppId) {
let url = format!("{}/api/app", self.http_addr());
delete_app_request(self.user_token(), params, &url).await.unwrap();
}
@ -112,7 +112,7 @@ impl TestUserServer {
view
}
pub async fn read_view(&self, params: ViewIdentifier) -> Option<View> {
pub async fn read_view(&self, params: ViewId) -> Option<View> {
let url = format!("{}/api/view", self.http_addr());
let view = read_view_request(self.user_token(), params, &url).await.unwrap();
view
@ -123,13 +123,13 @@ impl TestUserServer {
update_view_request(self.user_token(), params, &url).await.unwrap();
}
pub async fn delete_view(&self, params: ViewIdentifiers) {
pub async fn delete_view(&self, params: RepeatedViewId) {
let url = format!("{}/api/view", self.http_addr());
delete_view_request(self.user_token(), params, &url).await.unwrap();
}
pub async fn create_view_trash(&self, view_id: &str) {
let identifier = TrashIdentifier {
let identifier = TrashId {
id: view_id.to_string(),
ty: TrashType::View,
};
@ -139,7 +139,7 @@ impl TestUserServer {
.unwrap();
}
pub async fn delete_view_trash(&self, trash_identifiers: TrashIdentifiers) {
pub async fn delete_view_trash(&self, trash_identifiers: RepeatedTrashId) {
let url = format!("{}/api/trash", self.http_addr());
delete_trash_request(self.user_token(), trash_identifiers, &url)
@ -152,7 +152,7 @@ impl TestUserServer {
read_trash_request(self.user_token(), &url).await.unwrap()
}
pub async fn read_doc(&self, params: DocIdentifier) -> Option<DocumentInfo> {
pub async fn read_doc(&self, params: DocumentId) -> Option<DocumentInfo> {
let url = format!("{}/api/doc", self.http_addr());
let doc = read_doc_request(self.user_token(), params, &url).await.unwrap();
doc

View File

@ -18,7 +18,7 @@ class DocRepository {
Future<Either<DocumentDelta, FlowyError>> composeDelta({required String data}) {
final request = DocumentDelta.create()
..docId = docId
..text = data;
..deltaJson = data;
return WorkspaceEventApplyDocDelta(request).send();
}

View File

@ -16,20 +16,20 @@ class TrashRepo {
}
Future<Either<Unit, FlowyError>> putback(String trashId) {
final id = TrashIdentifier.create()..id = trashId;
final id = TrashId.create()..id = trashId;
return WorkspaceEventPutbackTrash(id).send();
}
Future<Either<Unit, FlowyError>> deleteViews(List<Tuple2<String, TrashType>> trashList) {
final items = trashList.map((trash) {
return TrashIdentifier.create()
return TrashId.create()
..id = trash.value1
..ty = trash.value2;
});
final trashIdentifiers = TrashIdentifiers(items: items);
return WorkspaceEventDeleteTrash(trashIdentifiers).send();
final ids = RepeatedTrashId(items: items);
return WorkspaceEventDeleteTrash(ids).send();
}
Future<Either<Unit, FlowyError>> restoreAll() {

View File

@ -317,7 +317,7 @@ class WorkspaceEventReadTrash {
}
class WorkspaceEventPutbackTrash {
TrashIdentifier request;
TrashId request;
WorkspaceEventPutbackTrash(this.request);
Future<Either<Unit, FlowyError>> send() {
@ -334,7 +334,7 @@ class WorkspaceEventPutbackTrash {
}
class WorkspaceEventDeleteTrash {
TrashIdentifiers request;
RepeatedTrashId request;
WorkspaceEventDeleteTrash(this.request);
Future<Either<Unit, FlowyError>> send() {

View File

@ -230,21 +230,21 @@ class ResetDocumentParams extends $pb.GeneratedMessage {
class DocumentDelta extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'DocumentDelta', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'docId')
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'text')
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'deltaJson')
..hasRequiredFields = false
;
DocumentDelta._() : super();
factory DocumentDelta({
$core.String? docId,
$core.String? text,
$core.String? deltaJson,
}) {
final _result = create();
if (docId != null) {
_result.docId = docId;
}
if (text != null) {
_result.text = text;
if (deltaJson != null) {
_result.deltaJson = deltaJson;
}
return _result;
}
@ -279,13 +279,13 @@ class DocumentDelta extends $pb.GeneratedMessage {
void clearDocId() => clearField(1);
@$pb.TagNumber(2)
$core.String get text => $_getSZ(1);
$core.String get deltaJson => $_getSZ(1);
@$pb.TagNumber(2)
set text($core.String v) { $_setString(1, v); }
set deltaJson($core.String v) { $_setString(1, v); }
@$pb.TagNumber(2)
$core.bool hasText() => $_has(1);
$core.bool hasDeltaJson() => $_has(1);
@$pb.TagNumber(2)
void clearText() => clearField(2);
void clearDeltaJson() => clearField(2);
}
class NewDocUser extends $pb.GeneratedMessage {
@ -363,14 +363,14 @@ class NewDocUser extends $pb.GeneratedMessage {
void clearDocId() => clearField(3);
}
class DocIdentifier extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'DocIdentifier', createEmptyInstance: create)
class DocumentId extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'DocumentId', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'docId')
..hasRequiredFields = false
;
DocIdentifier._() : super();
factory DocIdentifier({
DocumentId._() : super();
factory DocumentId({
$core.String? docId,
}) {
final _result = create();
@ -379,26 +379,26 @@ class DocIdentifier extends $pb.GeneratedMessage {
}
return _result;
}
factory DocIdentifier.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory DocIdentifier.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
factory DocumentId.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory DocumentId.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
DocIdentifier clone() => DocIdentifier()..mergeFromMessage(this);
DocumentId clone() => DocumentId()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
DocIdentifier copyWith(void Function(DocIdentifier) updates) => super.copyWith((message) => updates(message as DocIdentifier)) as DocIdentifier; // ignore: deprecated_member_use
DocumentId copyWith(void Function(DocumentId) updates) => super.copyWith((message) => updates(message as DocumentId)) as DocumentId; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static DocIdentifier create() => DocIdentifier._();
DocIdentifier createEmptyInstance() => create();
static $pb.PbList<DocIdentifier> createRepeated() => $pb.PbList<DocIdentifier>();
static DocumentId create() => DocumentId._();
DocumentId createEmptyInstance() => create();
static $pb.PbList<DocumentId> createRepeated() => $pb.PbList<DocumentId>();
@$core.pragma('dart2js:noInline')
static DocIdentifier getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<DocIdentifier>(create);
static DocIdentifier? _defaultInstance;
static DocumentId getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<DocumentId>(create);
static DocumentId? _defaultInstance;
@$pb.TagNumber(1)
$core.String get docId => $_getSZ(0);

View File

@ -48,12 +48,12 @@ const DocumentDelta$json = const {
'1': 'DocumentDelta',
'2': const [
const {'1': 'doc_id', '3': 1, '4': 1, '5': 9, '10': 'docId'},
const {'1': 'text', '3': 2, '4': 1, '5': 9, '10': 'text'},
const {'1': 'delta_json', '3': 2, '4': 1, '5': 9, '10': 'deltaJson'},
],
};
/// Descriptor for `DocumentDelta`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List documentDeltaDescriptor = $convert.base64Decode('Cg1Eb2N1bWVudERlbHRhEhUKBmRvY19pZBgBIAEoCVIFZG9jSWQSEgoEdGV4dBgCIAEoCVIEdGV4dA==');
final $typed_data.Uint8List documentDeltaDescriptor = $convert.base64Decode('Cg1Eb2N1bWVudERlbHRhEhUKBmRvY19pZBgBIAEoCVIFZG9jSWQSHQoKZGVsdGFfanNvbhgCIAEoCVIJZGVsdGFKc29u');
@$core.Deprecated('Use newDocUserDescriptor instead')
const NewDocUser$json = const {
'1': 'NewDocUser',
@ -66,13 +66,13 @@ const NewDocUser$json = const {
/// Descriptor for `NewDocUser`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List newDocUserDescriptor = $convert.base64Decode('CgpOZXdEb2NVc2VyEhcKB3VzZXJfaWQYASABKAlSBnVzZXJJZBIVCgZyZXZfaWQYAiABKANSBXJldklkEhUKBmRvY19pZBgDIAEoCVIFZG9jSWQ=');
@$core.Deprecated('Use docIdentifierDescriptor instead')
const DocIdentifier$json = const {
'1': 'DocIdentifier',
@$core.Deprecated('Use documentIdDescriptor instead')
const DocumentId$json = const {
'1': 'DocumentId',
'2': const [
const {'1': 'doc_id', '3': 1, '4': 1, '5': 9, '10': 'docId'},
],
};
/// Descriptor for `DocIdentifier`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List docIdentifierDescriptor = $convert.base64Decode('Cg1Eb2NJZGVudGlmaWVyEhUKBmRvY19pZBgBIAEoCVIFZG9jSWQ=');
/// Descriptor for `DocumentId`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List documentIdDescriptor = $convert.base64Decode('CgpEb2N1bWVudElkEhUKBmRvY19pZBgBIAEoCVIFZG9jSWQ=');

View File

@ -50,14 +50,14 @@ class QueryAppRequest extends $pb.GeneratedMessage {
$core.List<$core.String> get appIds => $_getList(0);
}
class AppIdentifier extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'AppIdentifier', createEmptyInstance: create)
class AppId extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'AppId', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'appId')
..hasRequiredFields = false
;
AppIdentifier._() : super();
factory AppIdentifier({
AppId._() : super();
factory AppId({
$core.String? appId,
}) {
final _result = create();
@ -66,26 +66,26 @@ class AppIdentifier extends $pb.GeneratedMessage {
}
return _result;
}
factory AppIdentifier.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory AppIdentifier.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
factory AppId.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory AppId.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
AppIdentifier clone() => AppIdentifier()..mergeFromMessage(this);
AppId clone() => AppId()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
AppIdentifier copyWith(void Function(AppIdentifier) updates) => super.copyWith((message) => updates(message as AppIdentifier)) as AppIdentifier; // ignore: deprecated_member_use
AppId copyWith(void Function(AppId) updates) => super.copyWith((message) => updates(message as AppId)) as AppId; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static AppIdentifier create() => AppIdentifier._();
AppIdentifier createEmptyInstance() => create();
static $pb.PbList<AppIdentifier> createRepeated() => $pb.PbList<AppIdentifier>();
static AppId create() => AppId._();
AppId createEmptyInstance() => create();
static $pb.PbList<AppId> createRepeated() => $pb.PbList<AppId>();
@$core.pragma('dart2js:noInline')
static AppIdentifier getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<AppIdentifier>(create);
static AppIdentifier? _defaultInstance;
static AppId getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<AppId>(create);
static AppId? _defaultInstance;
@$pb.TagNumber(1)
$core.String get appId => $_getSZ(0);

View File

@ -18,13 +18,13 @@ const QueryAppRequest$json = const {
/// Descriptor for `QueryAppRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List queryAppRequestDescriptor = $convert.base64Decode('Cg9RdWVyeUFwcFJlcXVlc3QSFwoHYXBwX2lkcxgBIAMoCVIGYXBwSWRz');
@$core.Deprecated('Use appIdentifierDescriptor instead')
const AppIdentifier$json = const {
'1': 'AppIdentifier',
@$core.Deprecated('Use appIdDescriptor instead')
const AppId$json = const {
'1': 'AppId',
'2': const [
const {'1': 'app_id', '3': 1, '4': 1, '5': 9, '10': 'appId'},
],
};
/// Descriptor for `AppIdentifier`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List appIdentifierDescriptor = $convert.base64Decode('Cg1BcHBJZGVudGlmaWVyEhUKBmFwcF9pZBgBIAEoCVIFYXBwSWQ=');
/// Descriptor for `AppId`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List appIdDescriptor = $convert.base64Decode('CgVBcHBJZBIVCgZhcHBfaWQYASABKAlSBWFwcElk');

View File

@ -14,16 +14,16 @@ import 'trash_create.pbenum.dart';
export 'trash_create.pbenum.dart';
class TrashIdentifiers extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'TrashIdentifiers', createEmptyInstance: create)
..pc<TrashIdentifier>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'items', $pb.PbFieldType.PM, subBuilder: TrashIdentifier.create)
class RepeatedTrashId extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RepeatedTrashId', createEmptyInstance: create)
..pc<TrashId>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'items', $pb.PbFieldType.PM, subBuilder: TrashId.create)
..aOB(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'deleteAll')
..hasRequiredFields = false
;
TrashIdentifiers._() : super();
factory TrashIdentifiers({
$core.Iterable<TrashIdentifier>? items,
RepeatedTrashId._() : super();
factory RepeatedTrashId({
$core.Iterable<TrashId>? items,
$core.bool? deleteAll,
}) {
final _result = create();
@ -35,29 +35,29 @@ class TrashIdentifiers extends $pb.GeneratedMessage {
}
return _result;
}
factory TrashIdentifiers.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory TrashIdentifiers.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
factory RepeatedTrashId.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory RepeatedTrashId.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
TrashIdentifiers clone() => TrashIdentifiers()..mergeFromMessage(this);
RepeatedTrashId clone() => RepeatedTrashId()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
TrashIdentifiers copyWith(void Function(TrashIdentifiers) updates) => super.copyWith((message) => updates(message as TrashIdentifiers)) as TrashIdentifiers; // ignore: deprecated_member_use
RepeatedTrashId copyWith(void Function(RepeatedTrashId) updates) => super.copyWith((message) => updates(message as RepeatedTrashId)) as RepeatedTrashId; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static TrashIdentifiers create() => TrashIdentifiers._();
TrashIdentifiers createEmptyInstance() => create();
static $pb.PbList<TrashIdentifiers> createRepeated() => $pb.PbList<TrashIdentifiers>();
static RepeatedTrashId create() => RepeatedTrashId._();
RepeatedTrashId createEmptyInstance() => create();
static $pb.PbList<RepeatedTrashId> createRepeated() => $pb.PbList<RepeatedTrashId>();
@$core.pragma('dart2js:noInline')
static TrashIdentifiers getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<TrashIdentifiers>(create);
static TrashIdentifiers? _defaultInstance;
static RepeatedTrashId getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<RepeatedTrashId>(create);
static RepeatedTrashId? _defaultInstance;
@$pb.TagNumber(1)
$core.List<TrashIdentifier> get items => $_getList(0);
$core.List<TrashId> get items => $_getList(0);
@$pb.TagNumber(2)
$core.bool get deleteAll => $_getBF(1);
@ -69,15 +69,15 @@ class TrashIdentifiers extends $pb.GeneratedMessage {
void clearDeleteAll() => clearField(2);
}
class TrashIdentifier extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'TrashIdentifier', createEmptyInstance: create)
class TrashId extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'TrashId', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id')
..e<TrashType>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'ty', $pb.PbFieldType.OE, defaultOrMaker: TrashType.Unknown, valueOf: TrashType.valueOf, enumValues: TrashType.values)
..hasRequiredFields = false
;
TrashIdentifier._() : super();
factory TrashIdentifier({
TrashId._() : super();
factory TrashId({
$core.String? id,
TrashType? ty,
}) {
@ -90,26 +90,26 @@ class TrashIdentifier extends $pb.GeneratedMessage {
}
return _result;
}
factory TrashIdentifier.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory TrashIdentifier.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
factory TrashId.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory TrashId.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
TrashIdentifier clone() => TrashIdentifier()..mergeFromMessage(this);
TrashId clone() => TrashId()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
TrashIdentifier copyWith(void Function(TrashIdentifier) updates) => super.copyWith((message) => updates(message as TrashIdentifier)) as TrashIdentifier; // ignore: deprecated_member_use
TrashId copyWith(void Function(TrashId) updates) => super.copyWith((message) => updates(message as TrashId)) as TrashId; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static TrashIdentifier create() => TrashIdentifier._();
TrashIdentifier createEmptyInstance() => create();
static $pb.PbList<TrashIdentifier> createRepeated() => $pb.PbList<TrashIdentifier>();
static TrashId create() => TrashId._();
TrashId createEmptyInstance() => create();
static $pb.PbList<TrashId> createRepeated() => $pb.PbList<TrashId>();
@$core.pragma('dart2js:noInline')
static TrashIdentifier getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<TrashIdentifier>(create);
static TrashIdentifier? _defaultInstance;
static TrashId getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<TrashId>(create);
static TrashId? _defaultInstance;
@$pb.TagNumber(1)
$core.String get id => $_getSZ(0);

View File

@ -20,28 +20,28 @@ const TrashType$json = const {
/// Descriptor for `TrashType`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List trashTypeDescriptor = $convert.base64Decode('CglUcmFzaFR5cGUSCwoHVW5rbm93bhAAEggKBFZpZXcQARIHCgNBcHAQAg==');
@$core.Deprecated('Use trashIdentifiersDescriptor instead')
const TrashIdentifiers$json = const {
'1': 'TrashIdentifiers',
@$core.Deprecated('Use repeatedTrashIdDescriptor instead')
const RepeatedTrashId$json = const {
'1': 'RepeatedTrashId',
'2': const [
const {'1': 'items', '3': 1, '4': 3, '5': 11, '6': '.TrashIdentifier', '10': 'items'},
const {'1': 'items', '3': 1, '4': 3, '5': 11, '6': '.TrashId', '10': 'items'},
const {'1': 'delete_all', '3': 2, '4': 1, '5': 8, '10': 'deleteAll'},
],
};
/// Descriptor for `TrashIdentifiers`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List trashIdentifiersDescriptor = $convert.base64Decode('ChBUcmFzaElkZW50aWZpZXJzEiYKBWl0ZW1zGAEgAygLMhAuVHJhc2hJZGVudGlmaWVyUgVpdGVtcxIdCgpkZWxldGVfYWxsGAIgASgIUglkZWxldGVBbGw=');
@$core.Deprecated('Use trashIdentifierDescriptor instead')
const TrashIdentifier$json = const {
'1': 'TrashIdentifier',
/// Descriptor for `RepeatedTrashId`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List repeatedTrashIdDescriptor = $convert.base64Decode('Cg9SZXBlYXRlZFRyYXNoSWQSHgoFaXRlbXMYASADKAsyCC5UcmFzaElkUgVpdGVtcxIdCgpkZWxldGVfYWxsGAIgASgIUglkZWxldGVBbGw=');
@$core.Deprecated('Use trashIdDescriptor instead')
const TrashId$json = const {
'1': 'TrashId',
'2': const [
const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},
const {'1': 'ty', '3': 2, '4': 1, '5': 14, '6': '.TrashType', '10': 'ty'},
],
};
/// Descriptor for `TrashIdentifier`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List trashIdentifierDescriptor = $convert.base64Decode('Cg9UcmFzaElkZW50aWZpZXISDgoCaWQYASABKAlSAmlkEhoKAnR5GAIgASgOMgouVHJhc2hUeXBlUgJ0eQ==');
/// Descriptor for `TrashId`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List trashIdDescriptor = $convert.base64Decode('CgdUcmFzaElkEg4KAmlkGAEgASgJUgJpZBIaCgJ0eRgCIAEoDjIKLlRyYXNoVHlwZVICdHk=');
@$core.Deprecated('Use trashDescriptor instead')
const Trash$json = const {
'1': 'Trash',

View File

@ -50,14 +50,14 @@ class QueryViewRequest extends $pb.GeneratedMessage {
$core.List<$core.String> get viewIds => $_getList(0);
}
class ViewIdentifier extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewIdentifier', createEmptyInstance: create)
class ViewId extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewId', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'viewId')
..hasRequiredFields = false
;
ViewIdentifier._() : super();
factory ViewIdentifier({
ViewId._() : super();
factory ViewId({
$core.String? viewId,
}) {
final _result = create();
@ -66,26 +66,26 @@ class ViewIdentifier extends $pb.GeneratedMessage {
}
return _result;
}
factory ViewIdentifier.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory ViewIdentifier.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
factory ViewId.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory ViewId.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
ViewIdentifier clone() => ViewIdentifier()..mergeFromMessage(this);
ViewId clone() => ViewId()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
ViewIdentifier copyWith(void Function(ViewIdentifier) updates) => super.copyWith((message) => updates(message as ViewIdentifier)) as ViewIdentifier; // ignore: deprecated_member_use
ViewId copyWith(void Function(ViewId) updates) => super.copyWith((message) => updates(message as ViewId)) as ViewId; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static ViewIdentifier create() => ViewIdentifier._();
ViewIdentifier createEmptyInstance() => create();
static $pb.PbList<ViewIdentifier> createRepeated() => $pb.PbList<ViewIdentifier>();
static ViewId create() => ViewId._();
ViewId createEmptyInstance() => create();
static $pb.PbList<ViewId> createRepeated() => $pb.PbList<ViewId>();
@$core.pragma('dart2js:noInline')
static ViewIdentifier getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ViewIdentifier>(create);
static ViewIdentifier? _defaultInstance;
static ViewId getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ViewId>(create);
static ViewId? _defaultInstance;
@$pb.TagNumber(1)
$core.String get viewId => $_getSZ(0);
@ -97,44 +97,44 @@ class ViewIdentifier extends $pb.GeneratedMessage {
void clearViewId() => clearField(1);
}
class ViewIdentifiers extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ViewIdentifiers', createEmptyInstance: create)
..pPS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'viewIds')
class RepeatedViewId extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RepeatedViewId', createEmptyInstance: create)
..pPS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'items')
..hasRequiredFields = false
;
ViewIdentifiers._() : super();
factory ViewIdentifiers({
$core.Iterable<$core.String>? viewIds,
RepeatedViewId._() : super();
factory RepeatedViewId({
$core.Iterable<$core.String>? items,
}) {
final _result = create();
if (viewIds != null) {
_result.viewIds.addAll(viewIds);
if (items != null) {
_result.items.addAll(items);
}
return _result;
}
factory ViewIdentifiers.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory ViewIdentifiers.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
factory RepeatedViewId.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory RepeatedViewId.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
ViewIdentifiers clone() => ViewIdentifiers()..mergeFromMessage(this);
RepeatedViewId clone() => RepeatedViewId()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
ViewIdentifiers copyWith(void Function(ViewIdentifiers) updates) => super.copyWith((message) => updates(message as ViewIdentifiers)) as ViewIdentifiers; // ignore: deprecated_member_use
RepeatedViewId copyWith(void Function(RepeatedViewId) updates) => super.copyWith((message) => updates(message as RepeatedViewId)) as RepeatedViewId; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static ViewIdentifiers create() => ViewIdentifiers._();
ViewIdentifiers createEmptyInstance() => create();
static $pb.PbList<ViewIdentifiers> createRepeated() => $pb.PbList<ViewIdentifiers>();
static RepeatedViewId create() => RepeatedViewId._();
RepeatedViewId createEmptyInstance() => create();
static $pb.PbList<RepeatedViewId> createRepeated() => $pb.PbList<RepeatedViewId>();
@$core.pragma('dart2js:noInline')
static ViewIdentifiers getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ViewIdentifiers>(create);
static ViewIdentifiers? _defaultInstance;
static RepeatedViewId getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<RepeatedViewId>(create);
static RepeatedViewId? _defaultInstance;
@$pb.TagNumber(1)
$core.List<$core.String> get viewIds => $_getList(0);
$core.List<$core.String> get items => $_getList(0);
}

View File

@ -18,23 +18,23 @@ const QueryViewRequest$json = const {
/// Descriptor for `QueryViewRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List queryViewRequestDescriptor = $convert.base64Decode('ChBRdWVyeVZpZXdSZXF1ZXN0EhkKCHZpZXdfaWRzGAEgAygJUgd2aWV3SWRz');
@$core.Deprecated('Use viewIdentifierDescriptor instead')
const ViewIdentifier$json = const {
'1': 'ViewIdentifier',
@$core.Deprecated('Use viewIdDescriptor instead')
const ViewId$json = const {
'1': 'ViewId',
'2': const [
const {'1': 'view_id', '3': 1, '4': 1, '5': 9, '10': 'viewId'},
],
};
/// Descriptor for `ViewIdentifier`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List viewIdentifierDescriptor = $convert.base64Decode('Cg5WaWV3SWRlbnRpZmllchIXCgd2aWV3X2lkGAEgASgJUgZ2aWV3SWQ=');
@$core.Deprecated('Use viewIdentifiersDescriptor instead')
const ViewIdentifiers$json = const {
'1': 'ViewIdentifiers',
/// Descriptor for `ViewId`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List viewIdDescriptor = $convert.base64Decode('CgZWaWV3SWQSFwoHdmlld19pZBgBIAEoCVIGdmlld0lk');
@$core.Deprecated('Use repeatedViewIdDescriptor instead')
const RepeatedViewId$json = const {
'1': 'RepeatedViewId',
'2': const [
const {'1': 'view_ids', '3': 1, '4': 3, '5': 9, '10': 'viewIds'},
const {'1': 'items', '3': 1, '4': 3, '5': 9, '10': 'items'},
],
};
/// Descriptor for `ViewIdentifiers`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List viewIdentifiersDescriptor = $convert.base64Decode('Cg9WaWV3SWRlbnRpZmllcnMSGQoIdmlld19pZHMYASADKAlSB3ZpZXdJZHM=');
/// Descriptor for `RepeatedViewId`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List repeatedViewIdDescriptor = $convert.base64Decode('Cg5SZXBlYXRlZFZpZXdJZBIUCgVpdGVtcxgBIAMoCVIFaXRlbXM=');

View File

@ -69,24 +69,24 @@ class QueryWorkspaceRequest extends $pb.GeneratedMessage {
void clearWorkspaceId() => clearField(1);
}
enum WorkspaceIdentifier_OneOfWorkspaceId {
enum WorkspaceId_OneOfWorkspaceId {
workspaceId,
notSet
}
class WorkspaceIdentifier extends $pb.GeneratedMessage {
static const $core.Map<$core.int, WorkspaceIdentifier_OneOfWorkspaceId> _WorkspaceIdentifier_OneOfWorkspaceIdByTag = {
1 : WorkspaceIdentifier_OneOfWorkspaceId.workspaceId,
0 : WorkspaceIdentifier_OneOfWorkspaceId.notSet
class WorkspaceId extends $pb.GeneratedMessage {
static const $core.Map<$core.int, WorkspaceId_OneOfWorkspaceId> _WorkspaceId_OneOfWorkspaceIdByTag = {
1 : WorkspaceId_OneOfWorkspaceId.workspaceId,
0 : WorkspaceId_OneOfWorkspaceId.notSet
};
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'WorkspaceIdentifier', createEmptyInstance: create)
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'WorkspaceId', createEmptyInstance: create)
..oo(0, [1])
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'workspaceId')
..hasRequiredFields = false
;
WorkspaceIdentifier._() : super();
factory WorkspaceIdentifier({
WorkspaceId._() : super();
factory WorkspaceId({
$core.String? workspaceId,
}) {
final _result = create();
@ -95,28 +95,28 @@ class WorkspaceIdentifier extends $pb.GeneratedMessage {
}
return _result;
}
factory WorkspaceIdentifier.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory WorkspaceIdentifier.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
factory WorkspaceId.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory WorkspaceId.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
WorkspaceIdentifier clone() => WorkspaceIdentifier()..mergeFromMessage(this);
WorkspaceId clone() => WorkspaceId()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
WorkspaceIdentifier copyWith(void Function(WorkspaceIdentifier) updates) => super.copyWith((message) => updates(message as WorkspaceIdentifier)) as WorkspaceIdentifier; // ignore: deprecated_member_use
WorkspaceId copyWith(void Function(WorkspaceId) updates) => super.copyWith((message) => updates(message as WorkspaceId)) as WorkspaceId; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static WorkspaceIdentifier create() => WorkspaceIdentifier._();
WorkspaceIdentifier createEmptyInstance() => create();
static $pb.PbList<WorkspaceIdentifier> createRepeated() => $pb.PbList<WorkspaceIdentifier>();
static WorkspaceId create() => WorkspaceId._();
WorkspaceId createEmptyInstance() => create();
static $pb.PbList<WorkspaceId> createRepeated() => $pb.PbList<WorkspaceId>();
@$core.pragma('dart2js:noInline')
static WorkspaceIdentifier getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<WorkspaceIdentifier>(create);
static WorkspaceIdentifier? _defaultInstance;
static WorkspaceId getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<WorkspaceId>(create);
static WorkspaceId? _defaultInstance;
WorkspaceIdentifier_OneOfWorkspaceId whichOneOfWorkspaceId() => _WorkspaceIdentifier_OneOfWorkspaceIdByTag[$_whichOneof(0)]!;
WorkspaceId_OneOfWorkspaceId whichOneOfWorkspaceId() => _WorkspaceId_OneOfWorkspaceIdByTag[$_whichOneof(0)]!;
void clearOneOfWorkspaceId() => clearField($_whichOneof(0));
@$pb.TagNumber(1)

View File

@ -21,9 +21,9 @@ const QueryWorkspaceRequest$json = const {
/// Descriptor for `QueryWorkspaceRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List queryWorkspaceRequestDescriptor = $convert.base64Decode('ChVRdWVyeVdvcmtzcGFjZVJlcXVlc3QSIwoMd29ya3NwYWNlX2lkGAEgASgJSABSC3dvcmtzcGFjZUlkQhUKE29uZV9vZl93b3Jrc3BhY2VfaWQ=');
@$core.Deprecated('Use workspaceIdentifierDescriptor instead')
const WorkspaceIdentifier$json = const {
'1': 'WorkspaceIdentifier',
@$core.Deprecated('Use workspaceIdDescriptor instead')
const WorkspaceId$json = const {
'1': 'WorkspaceId',
'2': const [
const {'1': 'workspace_id', '3': 1, '4': 1, '5': 9, '9': 0, '10': 'workspaceId'},
],
@ -32,5 +32,5 @@ const WorkspaceIdentifier$json = const {
],
};
/// Descriptor for `WorkspaceIdentifier`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List workspaceIdentifierDescriptor = $convert.base64Decode('ChNXb3Jrc3BhY2VJZGVudGlmaWVyEiMKDHdvcmtzcGFjZV9pZBgBIAEoCUgAUgt3b3Jrc3BhY2VJZEIVChNvbmVfb2Zfd29ya3NwYWNlX2lk');
/// Descriptor for `WorkspaceId`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List workspaceIdDescriptor = $convert.base64Decode('CgtXb3Jrc3BhY2VJZBIjCgx3b3Jrc3BhY2VfaWQYASABKAlIAFILd29ya3NwYWNlSWRCFQoTb25lX29mX3dvcmtzcGFjZV9pZA==');

View File

@ -4,7 +4,7 @@ use crate::{
notify::{send_dart_notification, WorkspaceNotification},
services::workspace::sql::{WorkspaceTable, WorkspaceTableSql},
};
use flowy_core_data_model::entities::workspace::WorkspaceIdentifier;
use flowy_core_data_model::entities::workspace::WorkspaceId;
use lib_dispatch::prelude::Unit;
use std::sync::Arc;
@ -12,7 +12,7 @@ use std::sync::Arc;
pub fn read_workspaces_on_server(
core: Unit<Arc<CoreContext>>,
user_id: String,
params: WorkspaceIdentifier,
params: WorkspaceId,
) -> Result<(), FlowyError> {
let (token, server) = (core.user.token()?, core.server.clone());
let app_ctrl = core.app_controller.clone();

View File

@ -5,7 +5,7 @@ use crate::{
};
use flowy_core_data_model::entities::{
view::View,
workspace::{CurrentWorkspaceSetting, QueryWorkspaceRequest, RepeatedWorkspace, WorkspaceIdentifier},
workspace::{CurrentWorkspaceSetting, QueryWorkspaceRequest, RepeatedWorkspace, WorkspaceId},
};
use lib_dispatch::prelude::{data_result, Data, DataResult, Unit};
use std::{convert::TryInto, sync::Arc};
@ -15,7 +15,7 @@ pub(crate) async fn read_workspaces_handler(
data: Data<QueryWorkspaceRequest>,
core: Unit<Arc<CoreContext>>,
) -> DataResult<RepeatedWorkspace, FlowyError> {
let params: WorkspaceIdentifier = data.into_inner().try_into()?;
let params: WorkspaceId = data.into_inner().try_into()?;
let user_id = core.user.user_id()?;
let conn = &*core.database.db_connection()?;
let workspace_controller = core.workspace_controller.clone();
@ -41,7 +41,7 @@ pub async fn read_cur_workspace_handler(
) -> DataResult<CurrentWorkspaceSetting, FlowyError> {
let workspace_id = get_current_workspace()?;
let user_id = core.user.user_id()?;
let params = WorkspaceIdentifier {
let params = WorkspaceId {
workspace_id: Some(workspace_id.clone()),
};
let conn = &*core.database.db_connection()?;

View File

@ -61,10 +61,10 @@ pub enum WorkspaceEvent {
#[event(output = "RepeatedTrash")]
ReadTrash = 300,
#[event(input = "TrashIdentifier")]
#[event(input = "TrashId")]
PutbackTrash = 301,
#[event(input = "TrashIdentifiers")]
#[event(input = "RepeatedTrashId")]
DeleteTrash = 302,
#[event()]

View File

@ -67,7 +67,7 @@ impl AppController {
Ok(())
}
pub(crate) async fn read_app(&self, params: AppIdentifier) -> Result<App, FlowyError> {
pub(crate) async fn read_app(&self, params: AppId) -> Result<App, FlowyError> {
let conn = self.database.db_connection()?;
let app_table = AppTableSql::read_app(&params.app_id, &*conn)?;
@ -136,7 +136,7 @@ impl AppController {
}
#[tracing::instrument(level = "debug", skip(self), err)]
fn read_app_on_server(&self, params: AppIdentifier) -> Result<(), FlowyError> {
fn read_app_on_server(&self, params: AppId) -> Result<(), FlowyError> {
let token = self.user.token()?;
let server = self.server.clone();
let pool = self.database.db_pool()?;

View File

@ -1,14 +1,6 @@
use crate::{
entities::{
app::{
App,
AppIdentifier,
CreateAppParams,
CreateAppRequest,
QueryAppRequest,
UpdateAppParams,
UpdateAppRequest,
},
app::{App, AppId, CreateAppParams, CreateAppRequest, QueryAppRequest, UpdateAppParams, UpdateAppRequest},
trash::Trash,
},
errors::FlowyError,
@ -32,7 +24,7 @@ pub(crate) async fn delete_app_handler(
view_controller: Unit<Arc<AppController>>,
trash_controller: Unit<Arc<TrashController>>,
) -> Result<(), FlowyError> {
let params: AppIdentifier = data.into_inner().try_into()?;
let params: AppId = data.into_inner().try_into()?;
let trash = view_controller
.read_app_tables(vec![params.app_id])?
.into_iter()
@ -59,7 +51,7 @@ pub(crate) async fn read_app_handler(
app_controller: Unit<Arc<AppController>>,
view_controller: Unit<Arc<ViewController>>,
) -> DataResult<App, FlowyError> {
let params: AppIdentifier = data.into_inner().try_into()?;
let params: AppId = data.into_inner().try_into()?;
let mut app = app_controller.read_app(params.clone()).await?;
app.belongings = view_controller.read_views_belong_to(&params.app_id).await?;

View File

@ -7,10 +7,10 @@ pub use server_api_mock::*;
use crate::{
entities::{
app::{App, AppIdentifier, CreateAppParams, UpdateAppParams},
trash::{RepeatedTrash, TrashIdentifiers},
view::{CreateViewParams, UpdateViewParams, View, ViewIdentifier, ViewIdentifiers},
workspace::{CreateWorkspaceParams, RepeatedWorkspace, UpdateWorkspaceParams, Workspace, WorkspaceIdentifier},
app::{App, AppId, CreateAppParams, UpdateAppParams},
trash::{RepeatedTrash, RepeatedTrashId},
view::{CreateViewParams, RepeatedViewId, UpdateViewParams, View, ViewId},
workspace::{CreateWorkspaceParams, RepeatedWorkspace, UpdateWorkspaceParams, Workspace, WorkspaceId},
},
errors::FlowyError,
};
@ -26,34 +26,34 @@ pub trait WorkspaceServerAPI {
// Workspace
fn create_workspace(&self, token: &str, params: CreateWorkspaceParams) -> FutureResult<Workspace, FlowyError>;
fn read_workspace(&self, token: &str, params: WorkspaceIdentifier) -> FutureResult<RepeatedWorkspace, FlowyError>;
fn read_workspace(&self, token: &str, params: WorkspaceId) -> FutureResult<RepeatedWorkspace, FlowyError>;
fn update_workspace(&self, token: &str, params: UpdateWorkspaceParams) -> FutureResult<(), FlowyError>;
fn delete_workspace(&self, token: &str, params: WorkspaceIdentifier) -> FutureResult<(), FlowyError>;
fn delete_workspace(&self, token: &str, params: WorkspaceId) -> FutureResult<(), FlowyError>;
// View
fn create_view(&self, token: &str, params: CreateViewParams) -> FutureResult<View, FlowyError>;
fn read_view(&self, token: &str, params: ViewIdentifier) -> FutureResult<Option<View>, FlowyError>;
fn read_view(&self, token: &str, params: ViewId) -> FutureResult<Option<View>, FlowyError>;
fn delete_view(&self, token: &str, params: ViewIdentifiers) -> FutureResult<(), FlowyError>;
fn delete_view(&self, token: &str, params: RepeatedViewId) -> FutureResult<(), FlowyError>;
fn update_view(&self, token: &str, params: UpdateViewParams) -> FutureResult<(), FlowyError>;
// App
fn create_app(&self, token: &str, params: CreateAppParams) -> FutureResult<App, FlowyError>;
fn read_app(&self, token: &str, params: AppIdentifier) -> FutureResult<Option<App>, FlowyError>;
fn read_app(&self, token: &str, params: AppId) -> FutureResult<Option<App>, FlowyError>;
fn update_app(&self, token: &str, params: UpdateAppParams) -> FutureResult<(), FlowyError>;
fn delete_app(&self, token: &str, params: AppIdentifier) -> FutureResult<(), FlowyError>;
fn delete_app(&self, token: &str, params: AppId) -> FutureResult<(), FlowyError>;
// Trash
fn create_trash(&self, token: &str, params: TrashIdentifiers) -> FutureResult<(), FlowyError>;
fn create_trash(&self, token: &str, params: RepeatedTrashId) -> FutureResult<(), FlowyError>;
fn delete_trash(&self, token: &str, params: TrashIdentifiers) -> FutureResult<(), FlowyError>;
fn delete_trash(&self, token: &str, params: RepeatedTrashId) -> FutureResult<(), FlowyError>;
fn read_trash(&self, token: &str) -> FutureResult<RepeatedTrash, FlowyError>;
}

View File

@ -1,9 +1,9 @@
use crate::{
entities::{
app::{App, AppIdentifier, CreateAppParams, UpdateAppParams},
trash::{RepeatedTrash, TrashIdentifiers},
view::{CreateViewParams, UpdateViewParams, View, ViewIdentifier, ViewIdentifiers},
workspace::{CreateWorkspaceParams, RepeatedWorkspace, UpdateWorkspaceParams, Workspace, WorkspaceIdentifier},
app::{App, AppId, CreateAppParams, UpdateAppParams},
trash::{RepeatedTrash, RepeatedTrashId},
view::{CreateViewParams, RepeatedViewId, UpdateViewParams, View, ViewId},
workspace::{CreateWorkspaceParams, RepeatedWorkspace, UpdateWorkspaceParams, Workspace, WorkspaceId},
},
errors::{ErrorCode, FlowyError},
notify::{send_dart_notification, WorkspaceNotification},
@ -42,7 +42,7 @@ impl WorkspaceServerAPI for WorkspaceHttpServer {
})
}
fn read_workspace(&self, token: &str, params: WorkspaceIdentifier) -> FutureResult<RepeatedWorkspace, FlowyError> {
fn read_workspace(&self, token: &str, params: WorkspaceId) -> FutureResult<RepeatedWorkspace, FlowyError> {
let token = token.to_owned();
let url = self.config.workspace_url();
FutureResult::new(async move {
@ -60,7 +60,7 @@ impl WorkspaceServerAPI for WorkspaceHttpServer {
})
}
fn delete_workspace(&self, token: &str, params: WorkspaceIdentifier) -> FutureResult<(), FlowyError> {
fn delete_workspace(&self, token: &str, params: WorkspaceId) -> FutureResult<(), FlowyError> {
let token = token.to_owned();
let url = self.config.workspace_url();
FutureResult::new(async move {
@ -78,7 +78,7 @@ impl WorkspaceServerAPI for WorkspaceHttpServer {
})
}
fn read_view(&self, token: &str, params: ViewIdentifier) -> FutureResult<Option<View>, FlowyError> {
fn read_view(&self, token: &str, params: ViewId) -> FutureResult<Option<View>, FlowyError> {
let token = token.to_owned();
let url = self.config.view_url();
FutureResult::new(async move {
@ -87,7 +87,7 @@ impl WorkspaceServerAPI for WorkspaceHttpServer {
})
}
fn delete_view(&self, token: &str, params: ViewIdentifiers) -> FutureResult<(), FlowyError> {
fn delete_view(&self, token: &str, params: RepeatedViewId) -> FutureResult<(), FlowyError> {
let token = token.to_owned();
let url = self.config.view_url();
FutureResult::new(async move {
@ -114,7 +114,7 @@ impl WorkspaceServerAPI for WorkspaceHttpServer {
})
}
fn read_app(&self, token: &str, params: AppIdentifier) -> FutureResult<Option<App>, FlowyError> {
fn read_app(&self, token: &str, params: AppId) -> FutureResult<Option<App>, FlowyError> {
let token = token.to_owned();
let url = self.config.app_url();
FutureResult::new(async move {
@ -132,7 +132,7 @@ impl WorkspaceServerAPI for WorkspaceHttpServer {
})
}
fn delete_app(&self, token: &str, params: AppIdentifier) -> FutureResult<(), FlowyError> {
fn delete_app(&self, token: &str, params: AppId) -> FutureResult<(), FlowyError> {
let token = token.to_owned();
let url = self.config.app_url();
FutureResult::new(async move {
@ -141,7 +141,7 @@ impl WorkspaceServerAPI for WorkspaceHttpServer {
})
}
fn create_trash(&self, token: &str, params: TrashIdentifiers) -> FutureResult<(), FlowyError> {
fn create_trash(&self, token: &str, params: RepeatedTrashId) -> FutureResult<(), FlowyError> {
let token = token.to_owned();
let url = self.config.trash_url();
FutureResult::new(async move {
@ -150,7 +150,7 @@ impl WorkspaceServerAPI for WorkspaceHttpServer {
})
}
fn delete_trash(&self, token: &str, params: TrashIdentifiers) -> FutureResult<(), FlowyError> {
fn delete_trash(&self, token: &str, params: RepeatedTrashId) -> FutureResult<(), FlowyError> {
let token = token.to_owned();
let url = self.config.trash_url();
FutureResult::new(async move {

View File

@ -1,9 +1,9 @@
use crate::{
entities::{
app::{App, AppIdentifier, CreateAppParams, RepeatedApp, UpdateAppParams},
trash::{RepeatedTrash, TrashIdentifiers},
view::{CreateViewParams, RepeatedView, UpdateViewParams, View, ViewIdentifier, ViewIdentifiers},
workspace::{CreateWorkspaceParams, RepeatedWorkspace, UpdateWorkspaceParams, Workspace, WorkspaceIdentifier},
app::{App, AppId, CreateAppParams, RepeatedApp, UpdateAppParams},
trash::{RepeatedTrash, RepeatedTrashId},
view::{CreateViewParams, RepeatedView, RepeatedViewId, UpdateViewParams, View, ViewId},
workspace::{CreateWorkspaceParams, RepeatedWorkspace, UpdateWorkspaceParams, Workspace, WorkspaceId},
},
errors::FlowyError,
services::server::WorkspaceServerAPI,
@ -29,11 +29,7 @@ impl WorkspaceServerAPI for WorkspaceServerMock {
FutureResult::new(async { Ok(workspace) })
}
fn read_workspace(
&self,
_token: &str,
_params: WorkspaceIdentifier,
) -> FutureResult<RepeatedWorkspace, FlowyError> {
fn read_workspace(&self, _token: &str, _params: WorkspaceId) -> FutureResult<RepeatedWorkspace, FlowyError> {
FutureResult::new(async {
let repeated_workspace = RepeatedWorkspace { items: vec![] };
Ok(repeated_workspace)
@ -44,7 +40,7 @@ impl WorkspaceServerAPI for WorkspaceServerMock {
FutureResult::new(async { Ok(()) })
}
fn delete_workspace(&self, _token: &str, _params: WorkspaceIdentifier) -> FutureResult<(), FlowyError> {
fn delete_workspace(&self, _token: &str, _params: WorkspaceId) -> FutureResult<(), FlowyError> {
FutureResult::new(async { Ok(()) })
}
@ -64,11 +60,11 @@ impl WorkspaceServerAPI for WorkspaceServerMock {
FutureResult::new(async { Ok(view) })
}
fn read_view(&self, _token: &str, _params: ViewIdentifier) -> FutureResult<Option<View>, FlowyError> {
fn read_view(&self, _token: &str, _params: ViewId) -> FutureResult<Option<View>, FlowyError> {
FutureResult::new(async { Ok(None) })
}
fn delete_view(&self, _token: &str, _params: ViewIdentifiers) -> FutureResult<(), FlowyError> {
fn delete_view(&self, _token: &str, _params: RepeatedViewId) -> FutureResult<(), FlowyError> {
FutureResult::new(async { Ok(()) })
}
@ -91,7 +87,7 @@ impl WorkspaceServerAPI for WorkspaceServerMock {
FutureResult::new(async { Ok(app) })
}
fn read_app(&self, _token: &str, _params: AppIdentifier) -> FutureResult<Option<App>, FlowyError> {
fn read_app(&self, _token: &str, _params: AppId) -> FutureResult<Option<App>, FlowyError> {
FutureResult::new(async { Ok(None) })
}
@ -99,15 +95,15 @@ impl WorkspaceServerAPI for WorkspaceServerMock {
FutureResult::new(async { Ok(()) })
}
fn delete_app(&self, _token: &str, _params: AppIdentifier) -> FutureResult<(), FlowyError> {
fn delete_app(&self, _token: &str, _params: AppId) -> FutureResult<(), FlowyError> {
FutureResult::new(async { Ok(()) })
}
fn create_trash(&self, _token: &str, _params: TrashIdentifiers) -> FutureResult<(), FlowyError> {
fn create_trash(&self, _token: &str, _params: RepeatedTrashId) -> FutureResult<(), FlowyError> {
FutureResult::new(async { Ok(()) })
}
fn delete_trash(&self, _token: &str, _params: TrashIdentifiers) -> FutureResult<(), FlowyError> {
fn delete_trash(&self, _token: &str, _params: RepeatedTrashId) -> FutureResult<(), FlowyError> {
FutureResult::new(async { Ok(()) })
}

View File

@ -1,5 +1,5 @@
use crate::{
entities::trash::{RepeatedTrash, Trash, TrashIdentifier, TrashIdentifiers, TrashType},
entities::trash::{RepeatedTrash, RepeatedTrashId, Trash, TrashId, TrashType},
errors::{FlowyError, FlowyResult},
module::{WorkspaceDatabase, WorkspaceUser},
notify::{send_anonymous_dart_notification, WorkspaceNotification},
@ -47,12 +47,12 @@ impl TrashController {
})
.unwrap()?;
let identifier = TrashIdentifier {
let identifier = TrashId {
id: trash_table.id,
ty: trash_table.ty.into(),
};
let _ = self.delete_trash_on_server(TrashIdentifiers {
let _ = self.delete_trash_on_server(RepeatedTrashId {
items: vec![identifier.clone()],
delete_all: false,
})?;
@ -75,7 +75,7 @@ impl TrashController {
})
.unwrap()?;
let identifiers: TrashIdentifiers = repeated_trash.items.clone().into();
let identifiers: RepeatedTrashId = repeated_trash.items.clone().into();
let (tx, mut rx) = mpsc::channel::<FlowyResult<()>>(1);
let _ = self.notify.send(TrashEvent::Putback(identifiers, tx));
let _ = rx.recv().await;
@ -88,7 +88,7 @@ impl TrashController {
#[tracing::instrument(level = "debug", skip(self), err)]
pub async fn delete_all(&self) -> FlowyResult<()> {
let repeated_trash = TrashTableSql::read_all(&*(self.database.db_connection()?))?;
let trash_identifiers: TrashIdentifiers = repeated_trash.items.clone().into();
let trash_identifiers: RepeatedTrashId = repeated_trash.items.clone().into();
let _ = self.delete_with_identifiers(trash_identifiers.clone()).await?;
notify_trash_changed(RepeatedTrash { items: vec![] });
@ -97,7 +97,7 @@ impl TrashController {
}
#[tracing::instrument(level = "debug", skip(self), err)]
pub async fn delete(&self, trash_identifiers: TrashIdentifiers) -> FlowyResult<()> {
pub async fn delete(&self, trash_identifiers: RepeatedTrashId) -> FlowyResult<()> {
let _ = self.delete_with_identifiers(trash_identifiers.clone()).await?;
notify_trash_changed(TrashTableSql::read_all(&*(self.database.db_connection()?))?);
let _ = self.delete_trash_on_server(trash_identifiers)?;
@ -106,7 +106,7 @@ impl TrashController {
}
#[tracing::instrument(level = "debug", skip(self), fields(delete_trash_ids), err)]
pub async fn delete_with_identifiers(&self, trash_identifiers: TrashIdentifiers) -> FlowyResult<()> {
pub async fn delete_with_identifiers(&self, trash_identifiers: RepeatedTrashId) -> FlowyResult<()> {
let (tx, mut rx) = mpsc::channel::<FlowyResult<()>>(1);
tracing::Span::current().record("delete_trash_ids", &format!("{}", trash_identifiers).as_str());
let _ = self.notify.send(TrashEvent::Delete(trash_identifiers.clone(), tx));
@ -139,10 +139,7 @@ impl TrashController {
pub async fn add<T: Into<Trash>>(&self, trash: Vec<T>) -> Result<(), FlowyError> {
let (tx, mut rx) = mpsc::channel::<FlowyResult<()>>(1);
let repeated_trash = trash.into_iter().map(|t| t.into()).collect::<Vec<Trash>>();
let identifiers = repeated_trash
.iter()
.map(|t| t.into())
.collect::<Vec<TrashIdentifier>>();
let identifiers = repeated_trash.iter().map(|t| t.into()).collect::<Vec<TrashId>>();
tracing::Span::current().record(
"trash_ids",
@ -194,7 +191,7 @@ impl TrashController {
impl TrashController {
#[tracing::instrument(level = "debug", skip(self, trash), err)]
fn create_trash_on_server<T: Into<TrashIdentifiers>>(&self, trash: T) -> FlowyResult<()> {
fn create_trash_on_server<T: Into<RepeatedTrashId>>(&self, trash: T) -> FlowyResult<()> {
let token = self.user.token()?;
let trash_identifiers = trash.into();
let server = self.server.clone();
@ -209,7 +206,7 @@ impl TrashController {
}
#[tracing::instrument(level = "debug", skip(self, trash), err)]
fn delete_trash_on_server<T: Into<TrashIdentifiers>>(&self, trash: T) -> FlowyResult<()> {
fn delete_trash_on_server<T: Into<RepeatedTrashId>>(&self, trash: T) -> FlowyResult<()> {
let token = self.user.token()?;
let trash_identifiers = trash.into();
let server = self.server.clone();
@ -259,7 +256,7 @@ impl TrashController {
async fn delete_all_trash_on_server(&self) -> FlowyResult<()> {
let token = self.user.token()?;
let server = self.server.clone();
server.delete_trash(&token, TrashIdentifiers::all()).await
server.delete_trash(&token, RepeatedTrashId::all()).await
}
}
@ -273,9 +270,9 @@ fn notify_trash_changed(repeated_trash: RepeatedTrash) {
#[derive(Clone)]
pub enum TrashEvent {
NewTrash(TrashIdentifiers, mpsc::Sender<FlowyResult<()>>),
Putback(TrashIdentifiers, mpsc::Sender<FlowyResult<()>>),
Delete(TrashIdentifiers, mpsc::Sender<FlowyResult<()>>),
NewTrash(RepeatedTrashId, mpsc::Sender<FlowyResult<()>>),
Putback(RepeatedTrashId, mpsc::Sender<FlowyResult<()>>),
Delete(RepeatedTrashId, mpsc::Sender<FlowyResult<()>>),
}
impl std::fmt::Debug for TrashEvent {

View File

@ -1,5 +1,5 @@
use crate::{
entities::trash::{RepeatedTrash, TrashIdentifier, TrashIdentifiers},
entities::trash::{RepeatedTrash, RepeatedTrashId, TrashId},
errors::FlowyError,
services::TrashController,
};
@ -17,7 +17,7 @@ pub(crate) async fn read_trash_handler(
#[tracing::instrument(skip(identifier, controller), err)]
pub(crate) async fn putback_trash_handler(
identifier: Data<TrashIdentifier>,
identifier: Data<TrashId>,
controller: Unit<Arc<TrashController>>,
) -> Result<(), FlowyError> {
let _ = controller.putback(&identifier.id).await?;
@ -26,7 +26,7 @@ pub(crate) async fn putback_trash_handler(
#[tracing::instrument(skip(identifiers, controller), err)]
pub(crate) async fn delete_trash_handler(
identifiers: Data<TrashIdentifiers>,
identifiers: Data<RepeatedTrashId>,
controller: Unit<Arc<TrashController>>,
) -> Result<(), FlowyError> {
let _ = controller.delete(identifiers.into_inner()).await?;

View File

@ -1,14 +1,14 @@
use flowy_collaboration::entities::doc::{DocIdentifier, DocumentDelta};
use flowy_collaboration::entities::doc::{DocumentDelta, DocumentId};
use flowy_database::SqliteConnection;
use futures::{FutureExt, StreamExt};
use std::{collections::HashSet, sync::Arc};
use crate::{
entities::{
trash::{TrashIdentifiers, TrashType},
view::{CreateViewParams, RepeatedView, UpdateViewParams, View, ViewIdentifier},
trash::{RepeatedTrashId, TrashType},
view::{CreateViewParams, RepeatedView, UpdateViewParams, View, ViewId},
},
errors::{internal_error, FlowyError, FlowyResult},
errors::{FlowyError, FlowyResult},
module::{WorkspaceDatabase, WorkspaceUser},
notify::{send_dart_notification, WorkspaceNotification},
services::{
@ -85,7 +85,7 @@ impl ViewController {
}
#[tracing::instrument(skip(self, params), fields(view_id = %params.view_id), err)]
pub(crate) async fn read_view(&self, params: ViewIdentifier) -> Result<View, FlowyError> {
pub(crate) async fn read_view(&self, params: ViewId) -> Result<View, FlowyError> {
let conn = self.database.db_connection()?;
let view_table = ViewTableSql::read_view(&params.view_id, &*conn)?;
@ -113,23 +113,27 @@ impl ViewController {
}
#[tracing::instrument(level = "debug", skip(self, params), fields(doc_id = %params.doc_id), err)]
pub(crate) async fn open_view(&self, params: DocIdentifier) -> Result<DocumentDelta, FlowyError> {
pub(crate) async fn open_view(&self, params: DocumentId) -> Result<DocumentDelta, FlowyError> {
let doc_id = params.doc_id.clone();
let db_pool = self.database.db_pool()?;
let editor = self.document_ctx.controller.open(params, db_pool).await?;
let editor = self.document_ctx.controller.open(&params.doc_id, db_pool).await?;
KV::set_str(LATEST_VIEW_ID, doc_id);
Ok(editor.delta().await.map_err(internal_error)?)
KV::set_str(LATEST_VIEW_ID, doc_id.clone());
let document_json = editor.document_json().await?;
Ok(DocumentDelta {
doc_id,
delta_json: document_json,
})
}
#[tracing::instrument(level = "debug", skip(self,params), fields(doc_id = %params.doc_id), err)]
pub(crate) async fn close_view(&self, params: DocIdentifier) -> Result<(), FlowyError> {
pub(crate) async fn close_view(&self, params: DocumentId) -> Result<(), FlowyError> {
let _ = self.document_ctx.controller.close(&params.doc_id)?;
Ok(())
}
#[tracing::instrument(level = "debug", skip(self,params), fields(doc_id = %params.doc_id), err)]
pub(crate) async fn delete_view(&self, params: DocIdentifier) -> Result<(), FlowyError> {
pub(crate) async fn delete_view(&self, params: DocumentId) -> Result<(), FlowyError> {
if let Some(view_id) = KV::get_str(LATEST_VIEW_ID) {
if view_id == params.doc_id {
let _ = KV::remove(LATEST_VIEW_ID);
@ -140,22 +144,21 @@ impl ViewController {
}
#[tracing::instrument(level = "debug", skip(self, params), fields(doc_id = %params.doc_id), err)]
pub(crate) async fn duplicate_view(&self, params: DocIdentifier) -> Result<(), FlowyError> {
pub(crate) async fn duplicate_view(&self, params: DocumentId) -> Result<(), FlowyError> {
let view: View = ViewTableSql::read_view(&params.doc_id, &*self.database.db_connection()?)?.into();
let editor = self
.document_ctx
.controller
.open(params, self.database.db_pool()?)
.open(&params.doc_id, self.database.db_pool()?)
.await?;
let delta_data = editor.delta().await?.text;
let document_json = editor.document_json().await?;
let duplicate_params = CreateViewParams {
belong_to_id: view.belong_to_id.clone(),
name: format!("{} (copy)", &view.name),
desc: view.desc.clone(),
thumbnail: "".to_owned(),
view_type: view.view_type.clone(),
view_data: delta_data,
view_data: document_json,
view_id: uuid_string(),
};
@ -165,16 +168,14 @@ impl ViewController {
#[tracing::instrument(level = "debug", skip(self, params), err)]
pub(crate) async fn export_doc(&self, params: ExportParams) -> Result<ExportData, FlowyError> {
let doc_identifier: DocIdentifier = params.doc_id.into();
let editor = self
.document_ctx
.controller
.open(doc_identifier, self.database.db_pool()?)
.open(&params.doc_id, self.database.db_pool()?)
.await?;
let data = editor.delta().await?.text;
let delta_json = editor.document_json().await?;
Ok(ExportData {
data,
data: delta_json,
export_type: params.export_type,
})
}
@ -211,7 +212,11 @@ impl ViewController {
pub(crate) async fn receive_document_delta(&self, params: DocumentDelta) -> Result<DocumentDelta, FlowyError> {
let db_pool = self.document_ctx.user.db_pool()?;
let doc = self.document_ctx.controller.apply_local_delta(params, db_pool).await?;
let doc = self
.document_ctx
.controller
.apply_document_delta(params, db_pool)
.await?;
Ok(doc)
}
@ -254,7 +259,7 @@ impl ViewController {
}
#[tracing::instrument(skip(self), err)]
fn read_view_on_server(&self, params: ViewIdentifier) -> Result<(), FlowyError> {
fn read_view_on_server(&self, params: ViewId) -> Result<(), FlowyError> {
let token = self.user.token()?;
let server = self.server.clone();
let pool = self.database.db_pool()?;
@ -347,7 +352,7 @@ async fn handle_trash_event(
for identifier in identifiers.items {
let view_table = ViewTableSql::read_view(&identifier.id, conn)?;
let _ = ViewTableSql::delete_view(&identifier.id, conn)?;
let _ = context.controller.delete(identifier.id.clone().into())?;
let _ = context.controller.delete(&identifier.id)?;
notify_ids.insert(view_table.belong_to_id);
}
@ -364,7 +369,7 @@ async fn handle_trash_event(
}
}
fn read_view_tables(identifiers: TrashIdentifiers, conn: &SqliteConnection) -> Result<Vec<ViewTable>, FlowyError> {
fn read_view_tables(identifiers: RepeatedTrashId, conn: &SqliteConnection) -> Result<Vec<ViewTable>, FlowyError> {
let mut view_tables = vec![];
let _ = conn.immediate_transaction::<_, FlowyError, _>(|| {
for identifier in identifiers.items {

View File

@ -5,11 +5,11 @@ use crate::{
CreateViewParams,
CreateViewRequest,
QueryViewRequest,
RepeatedViewId,
UpdateViewParams,
UpdateViewRequest,
View,
ViewIdentifier,
ViewIdentifiers,
ViewId,
},
},
errors::FlowyError,
@ -33,7 +33,7 @@ pub(crate) async fn read_view_handler(
data: Data<QueryViewRequest>,
controller: Unit<Arc<ViewController>>,
) -> DataResult<View, FlowyError> {
let params: ViewIdentifier = data.into_inner().try_into()?;
let params: ViewId = data.into_inner().try_into()?;
let mut view = controller.read_view(params.clone()).await?;
view.belongings = controller.read_views_belong_to(&params.view_id).await?;
@ -64,13 +64,13 @@ pub(crate) async fn delete_view_handler(
view_controller: Unit<Arc<ViewController>>,
trash_controller: Unit<Arc<TrashController>>,
) -> Result<(), FlowyError> {
let params: ViewIdentifiers = data.into_inner().try_into()?;
for view_id in &params.view_ids {
let params: RepeatedViewId = data.into_inner().try_into()?;
for view_id in &params.items {
let _ = view_controller.delete_view(view_id.into()).await;
}
let trash = view_controller
.read_view_tables(params.view_ids)?
.read_view_tables(params.items)?
.into_iter()
.map(|view_table| view_table.into())
.collect::<Vec<Trash>>();
@ -83,7 +83,7 @@ pub(crate) async fn open_view_handler(
data: Data<QueryViewRequest>,
controller: Unit<Arc<ViewController>>,
) -> DataResult<DocumentDelta, FlowyError> {
let params: ViewIdentifier = data.into_inner().try_into()?;
let params: ViewId = data.into_inner().try_into()?;
let doc = controller.open_view(params.into()).await?;
data_result(doc)
}
@ -92,7 +92,7 @@ pub(crate) async fn close_view_handler(
data: Data<QueryViewRequest>,
controller: Unit<Arc<ViewController>>,
) -> Result<(), FlowyError> {
let params: ViewIdentifier = data.into_inner().try_into()?;
let params: ViewId = data.into_inner().try_into()?;
let _ = controller.close_view(params.into()).await?;
Ok(())
}
@ -102,7 +102,7 @@ pub(crate) async fn duplicate_view_handler(
data: Data<QueryViewRequest>,
controller: Unit<Arc<ViewController>>,
) -> Result<(), FlowyError> {
let params: ViewIdentifier = data.into_inner().try_into()?;
let params: ViewId = data.into_inner().try_into()?;
let _ = controller.duplicate_view(params.into()).await?;
Ok(())
}

View File

@ -116,7 +116,7 @@ impl WorkspaceController {
Ok(())
}
pub(crate) async fn open_workspace(&self, params: WorkspaceIdentifier) -> Result<Workspace, FlowyError> {
pub(crate) async fn open_workspace(&self, params: WorkspaceId) -> Result<Workspace, FlowyError> {
let user_id = self.user.user_id()?;
let conn = self.database.db_connection()?;
if let Some(workspace_id) = params.workspace_id {
@ -203,7 +203,7 @@ impl WorkspaceController {
#[tracing::instrument(level = "debug", skip(self), err)]
fn delete_workspace_on_server(&self, workspace_id: &str) -> Result<(), FlowyError> {
let params = WorkspaceIdentifier {
let params = WorkspaceId {
workspace_id: Some(workspace_id.to_string()),
};
let (token, server) = (self.user.token()?, self.server.clone());

View File

@ -28,7 +28,7 @@ pub(crate) async fn open_workspace_handler(
data: Data<QueryWorkspaceRequest>,
controller: Unit<Arc<WorkspaceController>>,
) -> DataResult<Workspace, FlowyError> {
let params: WorkspaceIdentifier = data.into_inner().try_into()?;
let params: WorkspaceId = data.into_inner().try_into()?;
let workspaces = controller.open_workspace(params).await?;
data_result(workspaces)
}

View File

@ -1,6 +1,6 @@
use flowy_core::entities::{
app::QueryAppRequest,
trash::{TrashIdentifier, TrashType},
trash::{TrashId, TrashType},
view::*,
};
use flowy_test::helper::*;
@ -22,7 +22,7 @@ async fn app_delete_then_putback() {
delete_app(&test.sdk, &test.app.id).await;
putback_trash(
&test.sdk,
TrashIdentifier {
TrashId {
id: test.app.id.clone(),
ty: TrashType::App,
},

View File

@ -1,6 +1,6 @@
use flowy_core::entities::{
app::QueryAppRequest,
trash::{TrashIdentifier, TrashType},
trash::{TrashId, TrashType},
view::*,
};
use flowy_test::{helper::*, FlowySDKTest};
@ -28,7 +28,7 @@ async fn view_delete_then_putback() {
test.delete_views(vec![test.view.id.clone()]).await;
putback_trash(
&test.sdk,
TrashIdentifier {
TrashId {
id: test.view.id.clone(),
ty: TrashType::View,
},

View File

@ -1,13 +1,13 @@
use crate::{
errors::FlowyError,
services::{
controller::DocController,
doc::{edit::ClientDocEditor, DocumentWSReceivers, DocumentWebSocket},
controller::DocumentController,
doc::{DocumentWSReceivers, DocumentWebSocket},
server::construct_doc_server,
},
};
use backend_service::configuration::ClientServerConfiguration;
use flowy_collaboration::entities::doc::{DocIdentifier, DocumentDelta};
use flowy_database::ConnectionPool;
use std::sync::Arc;
@ -19,7 +19,7 @@ pub trait DocumentUser: Send + Sync {
}
pub struct DocumentContext {
pub controller: Arc<DocController>,
pub controller: Arc<DocumentController>,
pub user: Arc<dyn DocumentUser>,
}
@ -31,7 +31,7 @@ impl DocumentContext {
server_config: &ClientServerConfiguration,
) -> DocumentContext {
let server = construct_doc_server(server_config);
let doc_ctrl = Arc::new(DocController::new(server, user.clone(), ws_receivers, ws_sender));
let doc_ctrl = Arc::new(DocumentController::new(server, user.clone(), ws_receivers, ws_sender));
Self {
controller: doc_ctrl,
user,

View File

@ -3,7 +3,7 @@ use crate::{
errors::FlowyError,
services::{
doc::{
edit::ClientDocEditor,
edit::ClientDocumentEditor,
revision::{RevisionCache, RevisionManager, RevisionServer},
DocumentWSReceivers,
DocumentWebSocket,
@ -14,13 +14,13 @@ use crate::{
};
use bytes::Bytes;
use dashmap::DashMap;
use flowy_collaboration::entities::doc::{DocIdentifier, DocumentDelta, DocumentInfo};
use flowy_collaboration::entities::doc::{DocumentDelta, DocumentId, DocumentInfo};
use flowy_database::ConnectionPool;
use flowy_error::FlowyResult;
use lib_infra::future::FutureResult;
use std::sync::Arc;
pub struct DocController {
pub struct DocumentController {
server: Server,
ws_receivers: Arc<DocumentWSReceivers>,
ws_sender: Arc<dyn DocumentWebSocket>,
@ -28,7 +28,7 @@ pub struct DocController {
user: Arc<dyn DocumentUser>,
}
impl DocController {
impl DocumentController {
pub(crate) fn new(
server: Server,
user: Arc<dyn DocumentUser>,
@ -52,56 +52,67 @@ impl DocController {
Ok(())
}
pub async fn open(
#[tracing::instrument(level = "debug", skip(self, doc_id, pool), fields(doc_id), err)]
pub async fn open<T: AsRef<str>>(
&self,
params: DocIdentifier,
doc_id: T,
pool: Arc<ConnectionPool>,
) -> Result<Arc<ClientDocEditor>, FlowyError> {
if !self.open_cache.contains(&params.doc_id) {
let editor = self.make_editor(&params.doc_id, pool.clone()).await?;
) -> Result<Arc<ClientDocumentEditor>, FlowyError> {
let doc_id = doc_id.as_ref();
tracing::Span::current().record("doc_id", &doc_id);
if !self.open_cache.contains(doc_id) {
let editor = self.make_editor(doc_id, pool.clone()).await?;
return Ok(editor);
}
self.open_cache.get(&params.doc_id)
self.open_cache.get(doc_id)
}
pub fn close(&self, doc_id: &str) -> Result<(), FlowyError> {
tracing::debug!("Close document {}", doc_id);
#[tracing::instrument(level = "debug", skip(self, doc_id), fields(doc_id), err)]
pub fn close<T: AsRef<str>>(&self, doc_id: T) -> Result<(), FlowyError> {
let doc_id = doc_id.as_ref();
tracing::Span::current().record("doc_id", &doc_id);
self.open_cache.remove(doc_id);
self.ws_receivers.remove(doc_id);
Ok(())
}
#[tracing::instrument(level = "debug", skip(self), err)]
pub fn delete(&self, params: DocIdentifier) -> Result<(), FlowyError> {
let doc_id = &params.doc_id;
#[tracing::instrument(level = "debug", skip(self, doc_id), fields(doc_id), err)]
pub fn delete<T: AsRef<str>>(&self, doc_id: T) -> Result<(), FlowyError> {
let doc_id = doc_id.as_ref();
tracing::Span::current().record("doc_id", &doc_id);
self.open_cache.remove(doc_id);
self.ws_receivers.remove(doc_id);
Ok(())
}
// the delta's data that contains attributes with null value will be considered
// as None e.g.
// json : {"retain":7,"attributes":{"bold":null}}
// deserialize delta: [ {retain: 7, attributes: {Bold: AttributeValue(None)}} ]
#[tracing::instrument(level = "debug", skip(self, delta, db_pool), fields(doc_id = %delta.doc_id), err)]
pub async fn apply_local_delta(
pub async fn apply_document_delta(
&self,
delta: DocumentDelta,
db_pool: Arc<ConnectionPool>,
) -> Result<DocumentDelta, FlowyError> {
if !self.open_cache.contains(&delta.doc_id) {
let doc_identifier: DocIdentifier = delta.doc_id.clone().into();
let _ = self.open(doc_identifier, db_pool).await?;
let _ = self.open(&delta.doc_id, db_pool).await?;
}
let edit_doc_ctx = self.open_cache.get(&delta.doc_id)?;
let _ = edit_doc_ctx.composing_local_delta(Bytes::from(delta.text)).await?;
Ok(edit_doc_ctx.delta().await?)
let editor = self.open_cache.get(&delta.doc_id)?;
let _ = editor.compose_local_delta(Bytes::from(delta.delta_json)).await?;
let document_json = editor.document_json().await?;
Ok(DocumentDelta {
doc_id: delta.doc_id.clone(),
delta_json: document_json,
})
}
pub async fn save_document_delta(&self, delta: DocumentDelta) {}
}
impl DocController {
async fn make_editor(&self, doc_id: &str, pool: Arc<ConnectionPool>) -> Result<Arc<ClientDocEditor>, FlowyError> {
impl DocumentController {
async fn make_editor(
&self,
doc_id: &str,
pool: Arc<ConnectionPool>,
) -> Result<Arc<ClientDocumentEditor>, FlowyError> {
let user = self.user.clone();
let token = self.user.token()?;
let rev_manager = self.make_rev_manager(doc_id, pool.clone())?;
@ -109,7 +120,8 @@ impl DocController {
token,
server: self.server.clone(),
});
let doc_editor = ClientDocEditor::new(doc_id, user, pool, rev_manager, self.ws_sender.clone(), server).await?;
let doc_editor =
ClientDocumentEditor::new(doc_id, user, pool, rev_manager, self.ws_sender.clone(), server).await?;
self.ws_receivers.add(doc_id, doc_editor.ws_handler());
self.open_cache.insert(&doc_id, &doc_editor);
Ok(doc_editor)
@ -130,7 +142,7 @@ struct RevisionServerImpl {
impl RevisionServer for RevisionServerImpl {
#[tracing::instrument(level = "debug", skip(self))]
fn fetch_document(&self, doc_id: &str) -> FutureResult<DocumentInfo, FlowyError> {
let params = DocIdentifier {
let params = DocumentId {
doc_id: doc_id.to_string(),
};
let server = self.server.clone();
@ -146,13 +158,13 @@ impl RevisionServer for RevisionServerImpl {
}
pub struct OpenDocCache {
inner: DashMap<String, Arc<ClientDocEditor>>,
inner: DashMap<String, Arc<ClientDocumentEditor>>,
}
impl OpenDocCache {
fn new() -> Self { Self { inner: DashMap::new() } }
pub(crate) fn insert(&self, doc_id: &str, doc: &Arc<ClientDocEditor>) {
pub(crate) fn insert(&self, doc_id: &str, doc: &Arc<ClientDocumentEditor>) {
if self.inner.contains_key(doc_id) {
log::warn!("Doc:{} already exists in cache", doc_id);
}
@ -161,7 +173,7 @@ impl OpenDocCache {
pub(crate) fn contains(&self, doc_id: &str) -> bool { self.inner.get(doc_id).is_some() }
pub(crate) fn get(&self, doc_id: &str) -> Result<Arc<ClientDocEditor>, FlowyError> {
pub(crate) fn get(&self, doc_id: &str) -> Result<Arc<ClientDocumentEditor>, FlowyError> {
if !self.contains(&doc_id) {
return Err(doc_not_found());
}

View File

@ -9,10 +9,7 @@ use crate::{
use bytes::Bytes;
use flowy_collaboration::{
document::history::UndoResult,
entities::{
doc::DocumentDelta,
revision::{RevId, RevType, Revision},
},
entities::revision::{RevId, RevType, Revision},
errors::CollaborateResult,
};
use flowy_database::ConnectionPool;
@ -24,7 +21,7 @@ use lib_ot::{
use std::sync::Arc;
use tokio::sync::{mpsc, mpsc::UnboundedSender, oneshot};
pub struct ClientDocEditor {
pub struct ClientDocumentEditor {
pub doc_id: String,
rev_manager: Arc<RevisionManager>,
ws_manager: Arc<dyn DocumentWebSocketManager>,
@ -32,7 +29,7 @@ pub struct ClientDocEditor {
user: Arc<dyn DocumentUser>,
}
impl ClientDocEditor {
impl ClientDocumentEditor {
pub(crate) async fn new(
doc_id: &str,
user: Arc<dyn DocumentUser>,
@ -143,16 +140,12 @@ impl ClientDocEditor {
Ok(r)
}
pub async fn delta(&self) -> FlowyResult<DocumentDelta> {
let (ret, rx) = oneshot::channel::<CollaborateResult<DocumentMD5>>();
pub async fn document_json(&self) -> FlowyResult<String> {
let (ret, rx) = oneshot::channel::<CollaborateResult<String>>();
let msg = EditorCommand::ReadDoc { ret };
let _ = self.edit_queue.send(msg);
let data = rx.await.map_err(internal_error)??;
Ok(DocumentDelta {
doc_id: self.doc_id.clone(),
text: data,
})
let json = rx.await.map_err(internal_error)??;
Ok(json)
}
async fn save_local_delta(&self, delta: RichTextDelta, md5: String) -> Result<RevId, FlowyError> {
@ -173,7 +166,7 @@ impl ClientDocEditor {
}
#[tracing::instrument(level = "debug", skip(self, data), err)]
pub(crate) async fn composing_local_delta(&self, data: Bytes) -> Result<(), FlowyError> {
pub(crate) async fn compose_local_delta(&self, data: Bytes) -> Result<(), FlowyError> {
let delta = RichTextDelta::from_bytes(&data)?;
let (ret, rx) = oneshot::channel::<CollaborateResult<DocumentMD5>>();
let msg = EditorCommand::ComposeDelta {
@ -201,7 +194,7 @@ fn spawn_edit_queue(doc_id: &str, delta: RichTextDelta, _pool: Arc<ConnectionPoo
}
#[cfg(feature = "flowy_unit_test")]
impl ClientDocEditor {
impl ClientDocumentEditor {
pub async fn doc_json(&self) -> FlowyResult<String> {
let (ret, rx) = oneshot::channel::<CollaborateResult<DocumentMD5>>();
let msg = EditorCommand::ReadDoc { ret };

View File

@ -6,7 +6,7 @@ pub use server_api::*;
// TODO: ignore mock files in production
use crate::errors::FlowyError;
use backend_service::configuration::ClientServerConfiguration;
use flowy_collaboration::entities::doc::{CreateDocParams, DocIdentifier, DocumentInfo, ResetDocumentParams};
use flowy_collaboration::entities::doc::{CreateDocParams, DocumentId, DocumentInfo, ResetDocumentParams};
use lib_infra::future::FutureResult;
pub use server_api_mock::*;
use std::sync::Arc;
@ -15,7 +15,7 @@ pub(crate) type Server = Arc<dyn DocumentServerAPI + Send + Sync>;
pub trait DocumentServerAPI {
fn create_doc(&self, token: &str, params: CreateDocParams) -> FutureResult<(), FlowyError>;
fn read_doc(&self, token: &str, params: DocIdentifier) -> FutureResult<Option<DocumentInfo>, FlowyError>;
fn read_doc(&self, token: &str, params: DocumentId) -> FutureResult<Option<DocumentInfo>, FlowyError>;
fn update_doc(&self, token: &str, params: ResetDocumentParams) -> FutureResult<(), FlowyError>;
}

View File

@ -1,6 +1,6 @@
use crate::{errors::FlowyError, services::server::DocumentServerAPI};
use backend_service::{configuration::*, request::HttpRequestBuilder};
use flowy_collaboration::entities::doc::{CreateDocParams, DocIdentifier, DocumentInfo, ResetDocumentParams};
use flowy_collaboration::entities::doc::{CreateDocParams, DocumentId, DocumentInfo, ResetDocumentParams};
use lib_infra::future::FutureResult;
pub struct DocServer {
@ -18,7 +18,7 @@ impl DocumentServerAPI for DocServer {
FutureResult::new(async move { create_doc_request(&token, params, &url).await })
}
fn read_doc(&self, token: &str, params: DocIdentifier) -> FutureResult<Option<DocumentInfo>, FlowyError> {
fn read_doc(&self, token: &str, params: DocumentId) -> FutureResult<Option<DocumentInfo>, FlowyError> {
let token = token.to_owned();
let url = self.config.doc_url();
FutureResult::new(async move { read_doc_request(&token, params, &url).await })
@ -45,11 +45,7 @@ pub async fn create_doc_request(token: &str, params: CreateDocParams, url: &str)
Ok(())
}
pub async fn read_doc_request(
token: &str,
params: DocIdentifier,
url: &str,
) -> Result<Option<DocumentInfo>, FlowyError> {
pub async fn read_doc_request(token: &str, params: DocumentId, url: &str) -> Result<Option<DocumentInfo>, FlowyError> {
let doc = request_builder()
.get(&url.to_owned())
.header(HEADER_TOKEN, token)

View File

@ -1,6 +1,6 @@
use flowy_collaboration::{
document::default::initial_delta_string,
entities::doc::{CreateDocParams, DocIdentifier, DocumentInfo, ResetDocumentParams},
entities::doc::{CreateDocParams, DocumentId, DocumentInfo, ResetDocumentParams},
};
use lib_infra::future::FutureResult;
@ -13,7 +13,7 @@ impl DocumentServerAPI for DocServerMock {
FutureResult::new(async { Ok(()) })
}
fn read_doc(&self, _token: &str, params: DocIdentifier) -> FutureResult<Option<DocumentInfo>, FlowyError> {
fn read_doc(&self, _token: &str, params: DocumentId) -> FutureResult<Option<DocumentInfo>, FlowyError> {
let doc = DocumentInfo {
doc_id: params.doc_id,
text: initial_delta_string(),

View File

@ -53,10 +53,10 @@ fn crate_log_filter(level: Option<String>) -> String {
let level = level.unwrap_or_else(|| std::env::var("RUST_LOG").unwrap_or_else(|_| "info".to_owned()));
let mut filters = vec![];
filters.push(format!("flowy_sdk={}", level));
filters.push(format!("flowy_workspace={}", level));
filters.push(format!("flowy_core={}", level));
filters.push(format!("flowy_user={}", level));
filters.push(format!("flowy_document={}", level));
filters.push(format!("flowy_document_infra={}", level));
filters.push(format!("flowy_collaboration={}", level));
filters.push(format!("flowy_net={}", level));
filters.push(format!("dart_notify={}", level));
filters.push(format!("lib_ot={}", level));

View File

@ -1,6 +1,6 @@
use crate::{helper::ViewTest, FlowySDKTest};
use flowy_collaboration::entities::{doc::DocIdentifier, revision::RevState};
use flowy_document::services::doc::{edit::ClientDocEditor, SYNC_INTERVAL_IN_MILLIS};
use flowy_collaboration::entities::revision::RevState;
use flowy_document::services::doc::{edit::ClientDocumentEditor, SYNC_INTERVAL_IN_MILLIS};
use lib_ot::{core::Interval, rich_text::RichTextDelta};
use std::sync::Arc;
use tokio::time::{sleep, Duration};
@ -22,7 +22,7 @@ pub enum EditorScript {
pub struct EditorTest {
pub sdk: FlowySDKTest,
pub editor: Arc<ClientDocEditor>,
pub editor: Arc<ClientDocumentEditor>,
}
impl EditorTest {
@ -30,10 +30,8 @@ impl EditorTest {
let sdk = FlowySDKTest::setup();
let _ = sdk.init_user().await;
let test = ViewTest::new(&sdk).await;
let doc_identifier: DocIdentifier = test.view.id.clone().into();
let db_pool = sdk.user_session.db_pool().unwrap();
let editor = sdk.document_ctx.controller.open(doc_identifier, db_pool).await.unwrap();
let editor = sdk.document_ctx.controller.open(&test.view.id, db_pool).await.unwrap();
Self { sdk, editor }
}

View File

@ -4,7 +4,7 @@ use flowy_collaboration::entities::doc::DocumentInfo;
use flowy_core::{
entities::{
app::*,
trash::{RepeatedTrash, TrashIdentifier},
trash::{RepeatedTrash, TrashId},
view::*,
workspace::{CreateWorkspaceRequest, QueryWorkspaceRequest, Workspace, *},
},
@ -176,7 +176,7 @@ pub async fn create_app(sdk: &FlowySDKTest, name: &str, desc: &str, workspace_id
}
pub async fn delete_app(sdk: &FlowySDKTest, app_id: &str) {
let delete_app_request = AppIdentifier {
let delete_app_request = AppId {
app_id: app_id.to_string(),
};
@ -261,7 +261,7 @@ pub async fn read_trash(sdk: &FlowySDKTest) -> RepeatedTrash {
.parse::<RepeatedTrash>()
}
pub async fn putback_trash(sdk: &FlowySDKTest, id: TrashIdentifier) {
pub async fn putback_trash(sdk: &FlowySDKTest, id: TrashId) {
CoreModuleEventBuilder::new(sdk.clone())
.event(PutbackTrash)
.request(id)

View File

@ -21,7 +21,7 @@ pub async fn create_workspace_request(
pub async fn read_workspaces_request(
token: &str,
params: WorkspaceIdentifier,
params: WorkspaceId,
url: &str,
) -> Result<RepeatedWorkspace, ServerError> {
let repeated_workspace = request_builder()
@ -48,7 +48,7 @@ pub async fn update_workspace_request(
Ok(())
}
pub async fn delete_workspace_request(token: &str, params: WorkspaceIdentifier, url: &str) -> Result<(), ServerError> {
pub async fn delete_workspace_request(token: &str, params: WorkspaceId, url: &str) -> Result<(), ServerError> {
let _ = request_builder()
.delete(url)
.header(HEADER_TOKEN, token)
@ -69,7 +69,7 @@ pub async fn create_app_request(token: &str, params: CreateAppParams, url: &str)
Ok(app)
}
pub async fn read_app_request(token: &str, params: AppIdentifier, url: &str) -> Result<Option<App>, ServerError> {
pub async fn read_app_request(token: &str, params: AppId, url: &str) -> Result<Option<App>, ServerError> {
let app = request_builder()
.get(&url.to_owned())
.header(HEADER_TOKEN, token)
@ -90,7 +90,7 @@ pub async fn update_app_request(token: &str, params: UpdateAppParams, url: &str)
Ok(())
}
pub async fn delete_app_request(token: &str, params: AppIdentifier, url: &str) -> Result<(), ServerError> {
pub async fn delete_app_request(token: &str, params: AppId, url: &str) -> Result<(), ServerError> {
let _ = request_builder()
.delete(&url.to_owned())
.header(HEADER_TOKEN, token)
@ -111,7 +111,7 @@ pub async fn create_view_request(token: &str, params: CreateViewParams, url: &st
Ok(view)
}
pub async fn read_view_request(token: &str, params: ViewIdentifier, url: &str) -> Result<Option<View>, ServerError> {
pub async fn read_view_request(token: &str, params: ViewId, url: &str) -> Result<Option<View>, ServerError> {
let view = request_builder()
.get(&url.to_owned())
.header(HEADER_TOKEN, token)
@ -132,7 +132,7 @@ pub async fn update_view_request(token: &str, params: UpdateViewParams, url: &st
Ok(())
}
pub async fn delete_view_request(token: &str, params: ViewIdentifiers, url: &str) -> Result<(), ServerError> {
pub async fn delete_view_request(token: &str, params: RepeatedViewId, url: &str) -> Result<(), ServerError> {
let _ = request_builder()
.delete(&url.to_owned())
.header(HEADER_TOKEN, token)
@ -142,7 +142,7 @@ pub async fn delete_view_request(token: &str, params: ViewIdentifiers, url: &str
Ok(())
}
pub async fn create_trash_request(token: &str, params: TrashIdentifiers, url: &str) -> Result<(), ServerError> {
pub async fn create_trash_request(token: &str, params: RepeatedTrashId, url: &str) -> Result<(), ServerError> {
let _ = request_builder()
.post(&url.to_owned())
.header(HEADER_TOKEN, token)
@ -152,7 +152,7 @@ pub async fn create_trash_request(token: &str, params: TrashIdentifiers, url: &s
Ok(())
}
pub async fn delete_trash_request(token: &str, params: TrashIdentifiers, url: &str) -> Result<(), ServerError> {
pub async fn delete_trash_request(token: &str, params: RepeatedTrashId, url: &str) -> Result<(), ServerError> {
let _ = request_builder()
.delete(&url.to_owned())
.header(HEADER_TOKEN, token)

View File

@ -96,7 +96,7 @@ pub struct DocumentDelta {
pub doc_id: String,
#[pb(index = 2)]
pub text: String, // RichTextDelta
pub delta_json: String,
}
#[derive(ProtoBuf, Default, Debug, Clone)]
@ -112,18 +112,18 @@ pub struct NewDocUser {
}
#[derive(ProtoBuf, Default, Debug, Clone)]
pub struct DocIdentifier {
pub struct DocumentId {
#[pb(index = 1)]
pub doc_id: String,
}
impl std::convert::From<String> for DocIdentifier {
fn from(doc_id: String) -> Self { DocIdentifier { doc_id } }
impl std::convert::From<String> for DocumentId {
fn from(doc_id: String) -> Self { DocumentId { doc_id } }
}
impl std::convert::From<&String> for DocIdentifier {
impl std::convert::From<&String> for DocumentId {
fn from(doc_id: &String) -> Self {
DocIdentifier {
DocumentId {
doc_id: doc_id.to_owned(),
}
}

View File

@ -1,8 +1,8 @@
#[derive(Debug)]
pub struct DocId(pub String);
pub struct DocumentIdentify(pub String);
impl DocId {
pub fn parse(s: String) -> Result<DocId, String> {
impl DocumentIdentify {
pub fn parse(s: String) -> Result<DocumentIdentify, String> {
if s.trim().is_empty() {
return Err("Doc id can not be empty or whitespace".to_string());
}
@ -11,6 +11,6 @@ impl DocId {
}
}
impl AsRef<str> for DocId {
impl AsRef<str> for DocumentIdentify {
fn as_ref(&self) -> &str { &self.0 }
}

View File

@ -730,7 +730,7 @@ impl ::protobuf::reflect::ProtobufValue for ResetDocumentParams {
pub struct DocumentDelta {
// message fields
pub doc_id: ::std::string::String,
pub text: ::std::string::String,
pub delta_json: ::std::string::String,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
@ -773,30 +773,30 @@ impl DocumentDelta {
::std::mem::replace(&mut self.doc_id, ::std::string::String::new())
}
// string text = 2;
// string delta_json = 2;
pub fn get_text(&self) -> &str {
&self.text
pub fn get_delta_json(&self) -> &str {
&self.delta_json
}
pub fn clear_text(&mut self) {
self.text.clear();
pub fn clear_delta_json(&mut self) {
self.delta_json.clear();
}
// Param is passed by value, moved
pub fn set_text(&mut self, v: ::std::string::String) {
self.text = v;
pub fn set_delta_json(&mut self, v: ::std::string::String) {
self.delta_json = v;
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_text(&mut self) -> &mut ::std::string::String {
&mut self.text
pub fn mut_delta_json(&mut self) -> &mut ::std::string::String {
&mut self.delta_json
}
// Take field
pub fn take_text(&mut self) -> ::std::string::String {
::std::mem::replace(&mut self.text, ::std::string::String::new())
pub fn take_delta_json(&mut self) -> ::std::string::String {
::std::mem::replace(&mut self.delta_json, ::std::string::String::new())
}
}
@ -813,7 +813,7 @@ impl ::protobuf::Message for DocumentDelta {
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.doc_id)?;
},
2 => {
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.text)?;
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.delta_json)?;
},
_ => {
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
@ -830,8 +830,8 @@ impl ::protobuf::Message for DocumentDelta {
if !self.doc_id.is_empty() {
my_size += ::protobuf::rt::string_size(1, &self.doc_id);
}
if !self.text.is_empty() {
my_size += ::protobuf::rt::string_size(2, &self.text);
if !self.delta_json.is_empty() {
my_size += ::protobuf::rt::string_size(2, &self.delta_json);
}
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
self.cached_size.set(my_size);
@ -842,8 +842,8 @@ impl ::protobuf::Message for DocumentDelta {
if !self.doc_id.is_empty() {
os.write_string(1, &self.doc_id)?;
}
if !self.text.is_empty() {
os.write_string(2, &self.text)?;
if !self.delta_json.is_empty() {
os.write_string(2, &self.delta_json)?;
}
os.write_unknown_fields(self.get_unknown_fields())?;
::std::result::Result::Ok(())
@ -889,9 +889,9 @@ impl ::protobuf::Message for DocumentDelta {
|m: &mut DocumentDelta| { &mut m.doc_id },
));
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
"text",
|m: &DocumentDelta| { &m.text },
|m: &mut DocumentDelta| { &mut m.text },
"delta_json",
|m: &DocumentDelta| { &m.delta_json },
|m: &mut DocumentDelta| { &mut m.delta_json },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<DocumentDelta>(
"DocumentDelta",
@ -910,7 +910,7 @@ impl ::protobuf::Message for DocumentDelta {
impl ::protobuf::Clear for DocumentDelta {
fn clear(&mut self) {
self.doc_id.clear();
self.text.clear();
self.delta_json.clear();
self.unknown_fields.clear();
}
}
@ -1164,7 +1164,7 @@ impl ::protobuf::reflect::ProtobufValue for NewDocUser {
}
#[derive(PartialEq,Clone,Default)]
pub struct DocIdentifier {
pub struct DocumentId {
// message fields
pub doc_id: ::std::string::String,
// special fields
@ -1172,14 +1172,14 @@ pub struct DocIdentifier {
pub cached_size: ::protobuf::CachedSize,
}
impl<'a> ::std::default::Default for &'a DocIdentifier {
fn default() -> &'a DocIdentifier {
<DocIdentifier as ::protobuf::Message>::default_instance()
impl<'a> ::std::default::Default for &'a DocumentId {
fn default() -> &'a DocumentId {
<DocumentId as ::protobuf::Message>::default_instance()
}
}
impl DocIdentifier {
pub fn new() -> DocIdentifier {
impl DocumentId {
pub fn new() -> DocumentId {
::std::default::Default::default()
}
@ -1210,7 +1210,7 @@ impl DocIdentifier {
}
}
impl ::protobuf::Message for DocIdentifier {
impl ::protobuf::Message for DocumentId {
fn is_initialized(&self) -> bool {
true
}
@ -1276,8 +1276,8 @@ impl ::protobuf::Message for DocIdentifier {
Self::descriptor_static()
}
fn new() -> DocIdentifier {
DocIdentifier::new()
fn new() -> DocumentId {
DocumentId::new()
}
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
@ -1286,37 +1286,37 @@ impl ::protobuf::Message for DocIdentifier {
let mut fields = ::std::vec::Vec::new();
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
"doc_id",
|m: &DocIdentifier| { &m.doc_id },
|m: &mut DocIdentifier| { &mut m.doc_id },
|m: &DocumentId| { &m.doc_id },
|m: &mut DocumentId| { &mut m.doc_id },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<DocIdentifier>(
"DocIdentifier",
::protobuf::reflect::MessageDescriptor::new_pb_name::<DocumentId>(
"DocumentId",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static DocIdentifier {
static instance: ::protobuf::rt::LazyV2<DocIdentifier> = ::protobuf::rt::LazyV2::INIT;
instance.get(DocIdentifier::new)
fn default_instance() -> &'static DocumentId {
static instance: ::protobuf::rt::LazyV2<DocumentId> = ::protobuf::rt::LazyV2::INIT;
instance.get(DocumentId::new)
}
}
impl ::protobuf::Clear for DocIdentifier {
impl ::protobuf::Clear for DocumentId {
fn clear(&mut self) {
self.doc_id.clear();
self.unknown_fields.clear();
}
}
impl ::std::fmt::Debug for DocIdentifier {
impl ::std::fmt::Debug for DocumentId {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for DocIdentifier {
impl ::protobuf::reflect::ProtobufValue for DocumentId {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Message(self)
}
@ -1330,12 +1330,12 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\x04text\x12\x15\n\x06rev_id\x18\x03\x20\x01(\x03R\x05revId\x12\x1e\n\
\x0bbase_rev_id\x18\x04\x20\x01(\x03R\tbaseRevId\"]\n\x13ResetDocumentPa\
rams\x12\x15\n\x06doc_id\x18\x01\x20\x01(\tR\x05docId\x12/\n\trevisions\
\x18\x02\x20\x01(\x0b2\x11.RepeatedRevisionR\trevisions\":\n\rDocumentDe\
lta\x12\x15\n\x06doc_id\x18\x01\x20\x01(\tR\x05docId\x12\x12\n\x04text\
\x18\x02\x20\x01(\tR\x04text\"S\n\nNewDocUser\x12\x17\n\x07user_id\x18\
\x01\x20\x01(\tR\x06userId\x12\x15\n\x06rev_id\x18\x02\x20\x01(\x03R\x05\
revId\x12\x15\n\x06doc_id\x18\x03\x20\x01(\tR\x05docId\"&\n\rDocIdentifi\
er\x12\x15\n\x06doc_id\x18\x01\x20\x01(\tR\x05docIdJ\xaf\x07\n\x06\x12\
\x18\x02\x20\x01(\x0b2\x11.RepeatedRevisionR\trevisions\"E\n\rDocumentDe\
lta\x12\x15\n\x06doc_id\x18\x01\x20\x01(\tR\x05docId\x12\x1d\n\ndelta_js\
on\x18\x02\x20\x01(\tR\tdeltaJson\"S\n\nNewDocUser\x12\x17\n\x07user_id\
\x18\x01\x20\x01(\tR\x06userId\x12\x15\n\x06rev_id\x18\x02\x20\x01(\x03R\
\x05revId\x12\x15\n\x06doc_id\x18\x03\x20\x01(\tR\x05docId\"#\n\nDocumen\
tId\x12\x15\n\x06doc_id\x18\x01\x20\x01(\tR\x05docIdJ\xaf\x07\n\x06\x12\
\x04\0\0\x1c\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\t\n\x02\x03\0\x12\x03\
\x01\0\x18\n\n\n\x02\x04\0\x12\x04\x03\0\x06\x01\n\n\n\x03\x04\0\x01\x12\
\x03\x03\x08\x17\n\x0b\n\x04\x04\0\x02\0\x12\x03\x04\x04\x12\n\x0c\n\x05\
@ -1366,9 +1366,9 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\x03\x01\x12\x03\x11\x08\x15\n\x0b\n\x04\x04\x03\x02\0\x12\x03\x12\x04\
\x16\n\x0c\n\x05\x04\x03\x02\0\x05\x12\x03\x12\x04\n\n\x0c\n\x05\x04\x03\
\x02\0\x01\x12\x03\x12\x0b\x11\n\x0c\n\x05\x04\x03\x02\0\x03\x12\x03\x12\
\x14\x15\n\x0b\n\x04\x04\x03\x02\x01\x12\x03\x13\x04\x14\n\x0c\n\x05\x04\
\x14\x15\n\x0b\n\x04\x04\x03\x02\x01\x12\x03\x13\x04\x1a\n\x0c\n\x05\x04\
\x03\x02\x01\x05\x12\x03\x13\x04\n\n\x0c\n\x05\x04\x03\x02\x01\x01\x12\
\x03\x13\x0b\x0f\n\x0c\n\x05\x04\x03\x02\x01\x03\x12\x03\x13\x12\x13\n\n\
\x03\x13\x0b\x15\n\x0c\n\x05\x04\x03\x02\x01\x03\x12\x03\x13\x18\x19\n\n\
\n\x02\x04\x04\x12\x04\x15\0\x19\x01\n\n\n\x03\x04\x04\x01\x12\x03\x15\
\x08\x12\n\x0b\n\x04\x04\x04\x02\0\x12\x03\x16\x04\x17\n\x0c\n\x05\x04\
\x04\x02\0\x05\x12\x03\x16\x04\n\n\x0c\n\x05\x04\x04\x02\0\x01\x12\x03\
@ -1379,7 +1379,7 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\x02\x02\x12\x03\x18\x04\x16\n\x0c\n\x05\x04\x04\x02\x02\x05\x12\x03\x18\
\x04\n\n\x0c\n\x05\x04\x04\x02\x02\x01\x12\x03\x18\x0b\x11\n\x0c\n\x05\
\x04\x04\x02\x02\x03\x12\x03\x18\x14\x15\n\n\n\x02\x04\x05\x12\x04\x1a\0\
\x1c\x01\n\n\n\x03\x04\x05\x01\x12\x03\x1a\x08\x15\n\x0b\n\x04\x04\x05\
\x1c\x01\n\n\n\x03\x04\x05\x01\x12\x03\x1a\x08\x12\n\x0b\n\x04\x04\x05\
\x02\0\x12\x03\x1b\x04\x16\n\x0c\n\x05\x04\x05\x02\0\x05\x12\x03\x1b\x04\
\n\n\x0c\n\x05\x04\x05\x02\0\x01\x12\x03\x1b\x0b\x11\n\x0c\n\x05\x04\x05\
\x02\0\x03\x12\x03\x1b\x14\x15b\x06proto3\

View File

@ -17,13 +17,13 @@ message ResetDocumentParams {
}
message DocumentDelta {
string doc_id = 1;
string text = 2;
string delta_json = 2;
}
message NewDocUser {
string user_id = 1;
int64 rev_id = 2;
string doc_id = 3;
}
message DocIdentifier {
message DocumentId {
string doc_id = 1;
}

View File

@ -4,7 +4,7 @@ use crate::{
impl_def_and_def_mut,
parser::{
app::{AppColorStyle, AppName},
workspace::WorkspaceId,
workspace::WorkspaceIdentify,
},
};
use flowy_derive::ProtoBuf;
@ -51,7 +51,7 @@ impl TryInto<CreateAppParams> for CreateAppRequest {
fn try_into(self) -> Result<CreateAppParams, Self::Error> {
let name = AppName::parse(self.name)?;
let id = WorkspaceId::parse(self.workspace_id)?;
let id = WorkspaceIdentify::parse(self.workspace_id)?;
let color_style = AppColorStyle::parse(self.color_style.theme_color.clone())?;
Ok(CreateAppParams {

View File

@ -1,4 +1,4 @@
use crate::{errors::ErrorCode, parser::app::AppId};
use crate::{errors::ErrorCode, parser::app::AppIdentify};
use flowy_derive::ProtoBuf;
use std::convert::TryInto;
@ -9,12 +9,12 @@ pub struct QueryAppRequest {
}
#[derive(ProtoBuf, Default, Clone, Debug)]
pub struct AppIdentifier {
pub struct AppId {
#[pb(index = 1)]
pub app_id: String,
}
impl AppIdentifier {
impl AppId {
pub fn new(app_id: &str) -> Self {
Self {
app_id: app_id.to_string(),
@ -22,10 +22,10 @@ impl AppIdentifier {
}
}
impl TryInto<AppIdentifier> for QueryAppRequest {
impl TryInto<AppId> for QueryAppRequest {
type Error = ErrorCode;
fn try_into(self) -> Result<AppIdentifier, Self::Error> {
fn try_into(self) -> Result<AppId, Self::Error> {
debug_assert!(self.app_ids.len() == 1);
if self.app_ids.len() != 1 {
log::error!("The len of app_ids should be equal to 1");
@ -33,7 +33,7 @@ impl TryInto<AppIdentifier> for QueryAppRequest {
}
let app_id = self.app_ids.first().unwrap().clone();
let app_id = AppId::parse(app_id)?.0;
Ok(AppIdentifier { app_id })
let app_id = AppIdentify::parse(app_id)?.0;
Ok(AppId { app_id })
}
}

View File

@ -1,7 +1,7 @@
use crate::{
entities::app::ColorStyle,
errors::ErrorCode,
parser::app::{AppColorStyle, AppId, AppName},
parser::app::{AppColorStyle, AppIdentify, AppName},
};
use flowy_derive::ProtoBuf;
use std::convert::TryInto;
@ -70,7 +70,7 @@ impl TryInto<UpdateAppParams> for UpdateAppRequest {
type Error = ErrorCode;
fn try_into(self) -> Result<UpdateAppParams, Self::Error> {
let app_id = AppId::parse(self.app_id)?.0;
let app_id = AppIdentify::parse(self.app_id)?.0;
let name = match self.name {
None => None,

View File

@ -27,15 +27,15 @@ impl std::default::Default for TrashType {
}
#[derive(PartialEq, ProtoBuf, Default, Debug, Clone)]
pub struct TrashIdentifiers {
pub struct RepeatedTrashId {
#[pb(index = 1)]
pub items: Vec<TrashIdentifier>,
pub items: Vec<TrashId>,
#[pb(index = 2)]
pub delete_all: bool,
}
impl std::fmt::Display for TrashIdentifiers {
impl std::fmt::Display for RepeatedTrashId {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
f.write_str(&format!(
"{:?}",
@ -44,32 +44,32 @@ impl std::fmt::Display for TrashIdentifiers {
}
}
impl TrashIdentifiers {
pub fn all() -> TrashIdentifiers {
TrashIdentifiers {
impl RepeatedTrashId {
pub fn all() -> RepeatedTrashId {
RepeatedTrashId {
items: vec![],
delete_all: true,
}
}
}
impl std::convert::From<Vec<TrashIdentifier>> for TrashIdentifiers {
fn from(items: Vec<TrashIdentifier>) -> Self {
TrashIdentifiers {
impl std::convert::From<Vec<TrashId>> for RepeatedTrashId {
fn from(items: Vec<TrashId>) -> Self {
RepeatedTrashId {
items,
delete_all: false,
}
}
}
impl std::convert::From<Vec<Trash>> for TrashIdentifiers {
impl std::convert::From<Vec<Trash>> for RepeatedTrashId {
fn from(trash: Vec<Trash>) -> Self {
let items = trash
.into_iter()
.map(|t| TrashIdentifier { id: t.id, ty: t.ty })
.map(|t| TrashId { id: t.id, ty: t.ty })
.collect::<Vec<_>>();
TrashIdentifiers {
RepeatedTrashId {
items,
delete_all: false,
}
@ -77,7 +77,7 @@ impl std::convert::From<Vec<Trash>> for TrashIdentifiers {
}
#[derive(PartialEq, ProtoBuf, Default, Debug, Clone)]
pub struct TrashIdentifier {
pub struct TrashId {
#[pb(index = 1)]
pub id: String,
@ -85,16 +85,16 @@ pub struct TrashIdentifier {
pub ty: TrashType,
}
impl std::convert::From<&Trash> for TrashIdentifier {
impl std::convert::From<&Trash> for TrashId {
fn from(trash: &Trash) -> Self {
TrashIdentifier {
TrashId {
id: trash.id.clone(),
ty: trash.ty.clone(),
}
}
}
impl std::fmt::Display for TrashIdentifier {
impl std::fmt::Display for TrashId {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.write_str(&format!("{:?}:{}", self.ty, self.id)) }
}

View File

@ -3,7 +3,7 @@ use crate::{
errors::ErrorCode,
impl_def_and_def_mut,
parser::{
app::AppId,
app::AppIdentify,
view::{ViewName, ViewThumbnail},
},
};
@ -103,7 +103,7 @@ impl TryInto<CreateViewParams> for CreateViewRequest {
fn try_into(self) -> Result<CreateViewParams, Self::Error> {
let name = ViewName::parse(self.name)?.0;
let belong_to_id = AppId::parse(self.belong_to_id)?.0;
let belong_to_id = AppIdentify::parse(self.belong_to_id)?.0;
let view_data = initial_delta_string();
let view_id = uuid::Uuid::new_v4().to_string();
let thumbnail = match self.thumbnail {

View File

@ -1,5 +1,5 @@
use crate::{errors::ErrorCode, parser::view::ViewId};
use flowy_collaboration::entities::doc::DocIdentifier;
use crate::{errors::ErrorCode, parser::view::ViewIdentify};
use flowy_collaboration::entities::doc::DocumentId;
use flowy_derive::ProtoBuf;
use std::convert::TryInto;
@ -10,26 +10,26 @@ pub struct QueryViewRequest {
}
#[derive(Default, ProtoBuf, Clone, Debug)]
pub struct ViewIdentifier {
pub struct ViewId {
#[pb(index = 1)]
pub view_id: String,
}
impl std::convert::From<String> for ViewIdentifier {
fn from(view_id: String) -> Self { ViewIdentifier { view_id } }
impl std::convert::From<String> for ViewId {
fn from(view_id: String) -> Self { ViewId { view_id } }
}
impl std::convert::From<ViewIdentifier> for DocIdentifier {
fn from(identifier: ViewIdentifier) -> Self {
DocIdentifier {
impl std::convert::From<ViewId> for DocumentId {
fn from(identifier: ViewId) -> Self {
DocumentId {
doc_id: identifier.view_id,
}
}
}
impl TryInto<ViewIdentifier> for QueryViewRequest {
impl TryInto<ViewId> for QueryViewRequest {
type Error = ErrorCode;
fn try_into(self) -> Result<ViewIdentifier, Self::Error> {
fn try_into(self) -> Result<ViewId, Self::Error> {
debug_assert!(self.view_ids.len() == 1);
if self.view_ids.len() != 1 {
log::error!("The len of view_ids should be equal to 1");
@ -37,29 +37,29 @@ impl TryInto<ViewIdentifier> for QueryViewRequest {
}
let view_id = self.view_ids.first().unwrap().clone();
let view_id = ViewId::parse(view_id)?.0;
let view_id = ViewIdentify::parse(view_id)?.0;
Ok(ViewIdentifier { view_id })
Ok(ViewId { view_id })
}
}
#[derive(Default, ProtoBuf)]
pub struct ViewIdentifiers {
pub struct RepeatedViewId {
#[pb(index = 1)]
pub view_ids: Vec<String>,
pub items: Vec<String>,
}
impl TryInto<ViewIdentifiers> for QueryViewRequest {
impl TryInto<RepeatedViewId> for QueryViewRequest {
type Error = ErrorCode;
fn try_into(self) -> Result<ViewIdentifiers, Self::Error> {
fn try_into(self) -> Result<RepeatedViewId, Self::Error> {
let mut view_ids = vec![];
for view_id in self.view_ids {
let view_id = ViewId::parse(view_id)?.0;
let view_id = ViewIdentify::parse(view_id)?.0;
view_ids.push(view_id);
}
Ok(ViewIdentifiers { view_ids })
Ok(RepeatedViewId { items: view_ids })
}
}

View File

@ -1,6 +1,6 @@
use crate::{
errors::ErrorCode,
parser::view::{ViewDesc, ViewId, ViewName, ViewThumbnail},
parser::view::{ViewDesc, ViewIdentify, ViewName, ViewThumbnail},
};
use flowy_derive::ProtoBuf;
use std::convert::TryInto;
@ -58,7 +58,7 @@ impl TryInto<UpdateViewParams> for UpdateViewRequest {
type Error = ErrorCode;
fn try_into(self) -> Result<UpdateViewParams, Self::Error> {
let view_id = ViewId::parse(self.view_id)?.0;
let view_id = ViewIdentify::parse(self.view_id)?.0;
let name = match self.name {
None => None,

View File

@ -1,4 +1,4 @@
use crate::{errors::*, parser::workspace::WorkspaceId};
use crate::{errors::*, parser::workspace::WorkspaceIdentify};
use flowy_derive::ProtoBuf;
use std::convert::TryInto;
@ -15,24 +15,24 @@ impl QueryWorkspaceRequest {
// Read all workspaces if the workspace_id is None
#[derive(Clone, ProtoBuf, Default, Debug)]
pub struct WorkspaceIdentifier {
pub struct WorkspaceId {
#[pb(index = 1, one_of)]
pub workspace_id: Option<String>,
}
impl WorkspaceIdentifier {
impl WorkspaceId {
pub fn new(workspace_id: Option<String>) -> Self { Self { workspace_id } }
}
impl TryInto<WorkspaceIdentifier> for QueryWorkspaceRequest {
impl TryInto<WorkspaceId> for QueryWorkspaceRequest {
type Error = ErrorCode;
fn try_into(self) -> Result<WorkspaceIdentifier, Self::Error> {
fn try_into(self) -> Result<WorkspaceId, Self::Error> {
let workspace_id = match self.workspace_id {
None => None,
Some(workspace_id) => Some(WorkspaceId::parse(workspace_id)?.0),
Some(workspace_id) => Some(WorkspaceIdentify::parse(workspace_id)?.0),
};
Ok(WorkspaceIdentifier { workspace_id })
Ok(WorkspaceId { workspace_id })
}
}

View File

@ -1,6 +1,6 @@
use crate::{
errors::*,
parser::workspace::{WorkspaceId, WorkspaceName},
parser::workspace::{WorkspaceIdentify, WorkspaceName},
};
use flowy_derive::ProtoBuf;
use std::convert::TryInto;
@ -37,7 +37,7 @@ impl TryInto<UpdateWorkspaceParams> for UpdateWorkspaceRequest {
None => None,
Some(name) => Some(WorkspaceName::parse(name)?.0),
};
let id = WorkspaceId::parse(self.id)?;
let id = WorkspaceIdentify::parse(self.id)?;
Ok(UpdateWorkspaceParams {
id: id.0,

View File

@ -1,10 +1,10 @@
use crate::errors::ErrorCode;
#[derive(Debug)]
pub struct AppId(pub String);
pub struct AppIdentify(pub String);
impl AppId {
pub fn parse(s: String) -> Result<AppId, ErrorCode> {
impl AppIdentify {
pub fn parse(s: String) -> Result<AppIdentify, ErrorCode> {
if s.trim().is_empty() {
return Err(ErrorCode::AppIdInvalid);
}
@ -13,6 +13,6 @@ impl AppId {
}
}
impl AsRef<str> for AppId {
impl AsRef<str> for AppIdentify {
fn as_ref(&self) -> &str { &self.0 }
}

View File

@ -1,8 +1,8 @@
#[derive(Debug)]
pub struct TrashId(pub String);
pub struct TrashIdentify(pub String);
impl TrashId {
pub fn parse(s: String) -> Result<TrashId, String> {
impl TrashIdentify {
pub fn parse(s: String) -> Result<TrashIdentify, String> {
if s.trim().is_empty() {
return Err("Trash id can not be empty or whitespace".to_string());
}
@ -11,7 +11,7 @@ impl TrashId {
}
}
impl AsRef<str> for TrashId {
impl AsRef<str> for TrashIdentify {
fn as_ref(&self) -> &str { &self.0 }
}
@ -22,7 +22,7 @@ impl TrashIds {
pub fn parse(ids: Vec<String>) -> Result<TrashIds, String> {
let mut trash_ids = vec![];
for id in ids {
let id = TrashId::parse(id)?;
let id = TrashIdentify::parse(id)?;
trash_ids.push(id.0);
}
Ok(Self(trash_ids))

View File

@ -1,10 +1,10 @@
use crate::errors::ErrorCode;
#[derive(Debug)]
pub struct ViewId(pub String);
pub struct ViewIdentify(pub String);
impl ViewId {
pub fn parse(s: String) -> Result<ViewId, ErrorCode> {
impl ViewIdentify {
pub fn parse(s: String) -> Result<ViewIdentify, ErrorCode> {
if s.trim().is_empty() {
return Err(ErrorCode::ViewIdInvalid);
}
@ -13,6 +13,6 @@ impl ViewId {
}
}
impl AsRef<str> for ViewId {
impl AsRef<str> for ViewIdentify {
fn as_ref(&self) -> &str { &self.0 }
}

View File

@ -1,10 +1,10 @@
use crate::errors::ErrorCode;
#[derive(Debug)]
pub struct WorkspaceId(pub String);
pub struct WorkspaceIdentify(pub String);
impl WorkspaceId {
pub fn parse(s: String) -> Result<WorkspaceId, ErrorCode> {
impl WorkspaceIdentify {
pub fn parse(s: String) -> Result<WorkspaceIdentify, ErrorCode> {
if s.trim().is_empty() {
return Err(ErrorCode::WorkspaceIdInvalid);
}
@ -13,6 +13,6 @@ impl WorkspaceId {
}
}
impl AsRef<str> for WorkspaceId {
impl AsRef<str> for WorkspaceIdentify {
fn as_ref(&self) -> &str { &self.0 }
}

View File

@ -182,7 +182,7 @@ impl ::protobuf::reflect::ProtobufValue for QueryAppRequest {
}
#[derive(PartialEq,Clone,Default)]
pub struct AppIdentifier {
pub struct AppId {
// message fields
pub app_id: ::std::string::String,
// special fields
@ -190,14 +190,14 @@ pub struct AppIdentifier {
pub cached_size: ::protobuf::CachedSize,
}
impl<'a> ::std::default::Default for &'a AppIdentifier {
fn default() -> &'a AppIdentifier {
<AppIdentifier as ::protobuf::Message>::default_instance()
impl<'a> ::std::default::Default for &'a AppId {
fn default() -> &'a AppId {
<AppId as ::protobuf::Message>::default_instance()
}
}
impl AppIdentifier {
pub fn new() -> AppIdentifier {
impl AppId {
pub fn new() -> AppId {
::std::default::Default::default()
}
@ -228,7 +228,7 @@ impl AppIdentifier {
}
}
impl ::protobuf::Message for AppIdentifier {
impl ::protobuf::Message for AppId {
fn is_initialized(&self) -> bool {
true
}
@ -294,8 +294,8 @@ impl ::protobuf::Message for AppIdentifier {
Self::descriptor_static()
}
fn new() -> AppIdentifier {
AppIdentifier::new()
fn new() -> AppId {
AppId::new()
}
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
@ -304,37 +304,37 @@ impl ::protobuf::Message for AppIdentifier {
let mut fields = ::std::vec::Vec::new();
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
"app_id",
|m: &AppIdentifier| { &m.app_id },
|m: &mut AppIdentifier| { &mut m.app_id },
|m: &AppId| { &m.app_id },
|m: &mut AppId| { &mut m.app_id },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<AppIdentifier>(
"AppIdentifier",
::protobuf::reflect::MessageDescriptor::new_pb_name::<AppId>(
"AppId",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static AppIdentifier {
static instance: ::protobuf::rt::LazyV2<AppIdentifier> = ::protobuf::rt::LazyV2::INIT;
instance.get(AppIdentifier::new)
fn default_instance() -> &'static AppId {
static instance: ::protobuf::rt::LazyV2<AppId> = ::protobuf::rt::LazyV2::INIT;
instance.get(AppId::new)
}
}
impl ::protobuf::Clear for AppIdentifier {
impl ::protobuf::Clear for AppId {
fn clear(&mut self) {
self.app_id.clear();
self.unknown_fields.clear();
}
}
impl ::std::fmt::Debug for AppIdentifier {
impl ::std::fmt::Debug for AppId {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for AppIdentifier {
impl ::protobuf::reflect::ProtobufValue for AppId {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Message(self)
}
@ -342,14 +342,14 @@ impl ::protobuf::reflect::ProtobufValue for AppIdentifier {
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x0fapp_query.proto\"*\n\x0fQueryAppRequest\x12\x17\n\x07app_ids\x18\
\x01\x20\x03(\tR\x06appIds\"&\n\rAppIdentifier\x12\x15\n\x06app_id\x18\
\x01\x20\x01(\tR\x05appIdJ\xbe\x01\n\x06\x12\x04\0\0\x07\x01\n\x08\n\x01\
\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x04\x01\n\n\n\x03\x04\
\0\x01\x12\x03\x02\x08\x17\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x20\n\
\x01\x20\x03(\tR\x06appIds\"\x1e\n\x05AppId\x12\x15\n\x06app_id\x18\x01\
\x20\x01(\tR\x05appIdJ\xbe\x01\n\x06\x12\x04\0\0\x07\x01\n\x08\n\x01\x0c\
\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x04\x01\n\n\n\x03\x04\0\
\x01\x12\x03\x02\x08\x17\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x20\n\
\x0c\n\x05\x04\0\x02\0\x04\x12\x03\x03\x04\x0c\n\x0c\n\x05\x04\0\x02\0\
\x05\x12\x03\x03\r\x13\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x03\x14\x1b\n\
\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x1e\x1f\n\n\n\x02\x04\x01\x12\x04\
\x05\0\x07\x01\n\n\n\x03\x04\x01\x01\x12\x03\x05\x08\x15\n\x0b\n\x04\x04\
\x05\0\x07\x01\n\n\n\x03\x04\x01\x01\x12\x03\x05\x08\r\n\x0b\n\x04\x04\
\x01\x02\0\x12\x03\x06\x04\x16\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\x06\
\x04\n\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x06\x0b\x11\n\x0c\n\x05\x04\
\x01\x02\0\x03\x12\x03\x06\x14\x15b\x06proto3\

View File

@ -24,30 +24,30 @@
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_1;
#[derive(PartialEq,Clone,Default)]
pub struct TrashIdentifiers {
pub struct RepeatedTrashId {
// message fields
pub items: ::protobuf::RepeatedField<TrashIdentifier>,
pub items: ::protobuf::RepeatedField<TrashId>,
pub delete_all: bool,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
}
impl<'a> ::std::default::Default for &'a TrashIdentifiers {
fn default() -> &'a TrashIdentifiers {
<TrashIdentifiers as ::protobuf::Message>::default_instance()
impl<'a> ::std::default::Default for &'a RepeatedTrashId {
fn default() -> &'a RepeatedTrashId {
<RepeatedTrashId as ::protobuf::Message>::default_instance()
}
}
impl TrashIdentifiers {
pub fn new() -> TrashIdentifiers {
impl RepeatedTrashId {
pub fn new() -> RepeatedTrashId {
::std::default::Default::default()
}
// repeated .TrashIdentifier items = 1;
// repeated .TrashId items = 1;
pub fn get_items(&self) -> &[TrashIdentifier] {
pub fn get_items(&self) -> &[TrashId] {
&self.items
}
pub fn clear_items(&mut self) {
@ -55,17 +55,17 @@ impl TrashIdentifiers {
}
// Param is passed by value, moved
pub fn set_items(&mut self, v: ::protobuf::RepeatedField<TrashIdentifier>) {
pub fn set_items(&mut self, v: ::protobuf::RepeatedField<TrashId>) {
self.items = v;
}
// Mutable pointer to the field.
pub fn mut_items(&mut self) -> &mut ::protobuf::RepeatedField<TrashIdentifier> {
pub fn mut_items(&mut self) -> &mut ::protobuf::RepeatedField<TrashId> {
&mut self.items
}
// Take field
pub fn take_items(&mut self) -> ::protobuf::RepeatedField<TrashIdentifier> {
pub fn take_items(&mut self) -> ::protobuf::RepeatedField<TrashId> {
::std::mem::replace(&mut self.items, ::protobuf::RepeatedField::new())
}
@ -85,7 +85,7 @@ impl TrashIdentifiers {
}
}
impl ::protobuf::Message for TrashIdentifiers {
impl ::protobuf::Message for RepeatedTrashId {
fn is_initialized(&self) -> bool {
for v in &self.items {
if !v.is_initialized() {
@ -172,39 +172,39 @@ impl ::protobuf::Message for TrashIdentifiers {
Self::descriptor_static()
}
fn new() -> TrashIdentifiers {
TrashIdentifiers::new()
fn new() -> RepeatedTrashId {
RepeatedTrashId::new()
}
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
descriptor.get(|| {
let mut fields = ::std::vec::Vec::new();
fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<TrashIdentifier>>(
fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<TrashId>>(
"items",
|m: &TrashIdentifiers| { &m.items },
|m: &mut TrashIdentifiers| { &mut m.items },
|m: &RepeatedTrashId| { &m.items },
|m: &mut RepeatedTrashId| { &mut m.items },
));
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
"delete_all",
|m: &TrashIdentifiers| { &m.delete_all },
|m: &mut TrashIdentifiers| { &mut m.delete_all },
|m: &RepeatedTrashId| { &m.delete_all },
|m: &mut RepeatedTrashId| { &mut m.delete_all },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<TrashIdentifiers>(
"TrashIdentifiers",
::protobuf::reflect::MessageDescriptor::new_pb_name::<RepeatedTrashId>(
"RepeatedTrashId",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static TrashIdentifiers {
static instance: ::protobuf::rt::LazyV2<TrashIdentifiers> = ::protobuf::rt::LazyV2::INIT;
instance.get(TrashIdentifiers::new)
fn default_instance() -> &'static RepeatedTrashId {
static instance: ::protobuf::rt::LazyV2<RepeatedTrashId> = ::protobuf::rt::LazyV2::INIT;
instance.get(RepeatedTrashId::new)
}
}
impl ::protobuf::Clear for TrashIdentifiers {
impl ::protobuf::Clear for RepeatedTrashId {
fn clear(&mut self) {
self.items.clear();
self.delete_all = false;
@ -212,20 +212,20 @@ impl ::protobuf::Clear for TrashIdentifiers {
}
}
impl ::std::fmt::Debug for TrashIdentifiers {
impl ::std::fmt::Debug for RepeatedTrashId {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for TrashIdentifiers {
impl ::protobuf::reflect::ProtobufValue for RepeatedTrashId {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Message(self)
}
}
#[derive(PartialEq,Clone,Default)]
pub struct TrashIdentifier {
pub struct TrashId {
// message fields
pub id: ::std::string::String,
pub ty: TrashType,
@ -234,14 +234,14 @@ pub struct TrashIdentifier {
pub cached_size: ::protobuf::CachedSize,
}
impl<'a> ::std::default::Default for &'a TrashIdentifier {
fn default() -> &'a TrashIdentifier {
<TrashIdentifier as ::protobuf::Message>::default_instance()
impl<'a> ::std::default::Default for &'a TrashId {
fn default() -> &'a TrashId {
<TrashId as ::protobuf::Message>::default_instance()
}
}
impl TrashIdentifier {
pub fn new() -> TrashIdentifier {
impl TrashId {
pub fn new() -> TrashId {
::std::default::Default::default()
}
@ -287,7 +287,7 @@ impl TrashIdentifier {
}
}
impl ::protobuf::Message for TrashIdentifier {
impl ::protobuf::Message for TrashId {
fn is_initialized(&self) -> bool {
true
}
@ -362,8 +362,8 @@ impl ::protobuf::Message for TrashIdentifier {
Self::descriptor_static()
}
fn new() -> TrashIdentifier {
TrashIdentifier::new()
fn new() -> TrashId {
TrashId::new()
}
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
@ -372,29 +372,29 @@ impl ::protobuf::Message for TrashIdentifier {
let mut fields = ::std::vec::Vec::new();
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
"id",
|m: &TrashIdentifier| { &m.id },
|m: &mut TrashIdentifier| { &mut m.id },
|m: &TrashId| { &m.id },
|m: &mut TrashId| { &mut m.id },
));
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum<TrashType>>(
"ty",
|m: &TrashIdentifier| { &m.ty },
|m: &mut TrashIdentifier| { &mut m.ty },
|m: &TrashId| { &m.ty },
|m: &mut TrashId| { &mut m.ty },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<TrashIdentifier>(
"TrashIdentifier",
::protobuf::reflect::MessageDescriptor::new_pb_name::<TrashId>(
"TrashId",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static TrashIdentifier {
static instance: ::protobuf::rt::LazyV2<TrashIdentifier> = ::protobuf::rt::LazyV2::INIT;
instance.get(TrashIdentifier::new)
fn default_instance() -> &'static TrashId {
static instance: ::protobuf::rt::LazyV2<TrashId> = ::protobuf::rt::LazyV2::INIT;
instance.get(TrashId::new)
}
}
impl ::protobuf::Clear for TrashIdentifier {
impl ::protobuf::Clear for TrashId {
fn clear(&mut self) {
self.id.clear();
self.ty = TrashType::Unknown;
@ -402,13 +402,13 @@ impl ::protobuf::Clear for TrashIdentifier {
}
}
impl ::std::fmt::Debug for TrashIdentifier {
impl ::std::fmt::Debug for TrashId {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for TrashIdentifier {
impl ::protobuf::reflect::ProtobufValue for TrashId {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Message(self)
}
@ -936,26 +936,26 @@ impl ::protobuf::reflect::ProtobufValue for TrashType {
}
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x12trash_create.proto\"Y\n\x10TrashIdentifiers\x12&\n\x05items\x18\
\x01\x20\x03(\x0b2\x10.TrashIdentifierR\x05items\x12\x1d\n\ndelete_all\
\x18\x02\x20\x01(\x08R\tdeleteAll\"=\n\x0fTrashIdentifier\x12\x0e\n\x02i\
d\x18\x01\x20\x01(\tR\x02id\x12\x1a\n\x02ty\x18\x02\x20\x01(\x0e2\n.Tras\
hTypeR\x02ty\"\x8d\x01\n\x05Trash\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\
\x02id\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12#\n\rmodified_ti\
me\x18\x03\x20\x01(\x03R\x0cmodifiedTime\x12\x1f\n\x0bcreate_time\x18\
\x04\x20\x01(\x03R\ncreateTime\x12\x1a\n\x02ty\x18\x05\x20\x01(\x0e2\n.T\
rashTypeR\x02ty\"-\n\rRepeatedTrash\x12\x1c\n\x05items\x18\x01\x20\x03(\
\x0b2\x06.TrashR\x05items*+\n\tTrashType\x12\x0b\n\x07Unknown\x10\0\x12\
\x08\n\x04View\x10\x01\x12\x07\n\x03App\x10\x02J\xc7\x06\n\x06\x12\x04\0\
\0\x18\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\
\x05\x01\n\n\n\x03\x04\0\x01\x12\x03\x02\x08\x18\n\x0b\n\x04\x04\0\x02\0\
\x12\x03\x03\x04'\n\x0c\n\x05\x04\0\x02\0\x04\x12\x03\x03\x04\x0c\n\x0c\
\n\x05\x04\0\x02\0\x06\x12\x03\x03\r\x1c\n\x0c\n\x05\x04\0\x02\0\x01\x12\
\x03\x03\x1d\"\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03%&\n\x0b\n\x04\x04\
\n\x12trash_create.proto\"P\n\x0fRepeatedTrashId\x12\x1e\n\x05items\x18\
\x01\x20\x03(\x0b2\x08.TrashIdR\x05items\x12\x1d\n\ndelete_all\x18\x02\
\x20\x01(\x08R\tdeleteAll\"5\n\x07TrashId\x12\x0e\n\x02id\x18\x01\x20\
\x01(\tR\x02id\x12\x1a\n\x02ty\x18\x02\x20\x01(\x0e2\n.TrashTypeR\x02ty\
\"\x8d\x01\n\x05Trash\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\x12\x12\
\n\x04name\x18\x02\x20\x01(\tR\x04name\x12#\n\rmodified_time\x18\x03\x20\
\x01(\x03R\x0cmodifiedTime\x12\x1f\n\x0bcreate_time\x18\x04\x20\x01(\x03\
R\ncreateTime\x12\x1a\n\x02ty\x18\x05\x20\x01(\x0e2\n.TrashTypeR\x02ty\"\
-\n\rRepeatedTrash\x12\x1c\n\x05items\x18\x01\x20\x03(\x0b2\x06.TrashR\
\x05items*+\n\tTrashType\x12\x0b\n\x07Unknown\x10\0\x12\x08\n\x04View\
\x10\x01\x12\x07\n\x03App\x10\x02J\xc7\x06\n\x06\x12\x04\0\0\x18\x01\n\
\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x05\x01\n\n\
\n\x03\x04\0\x01\x12\x03\x02\x08\x17\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\
\x04\x1f\n\x0c\n\x05\x04\0\x02\0\x04\x12\x03\x03\x04\x0c\n\x0c\n\x05\x04\
\0\x02\0\x06\x12\x03\x03\r\x14\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x03\
\x15\x1a\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x1d\x1e\n\x0b\n\x04\x04\
\0\x02\x01\x12\x03\x04\x04\x18\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x04\
\x04\x08\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x04\t\x13\n\x0c\n\x05\x04\
\0\x02\x01\x03\x12\x03\x04\x16\x17\n\n\n\x02\x04\x01\x12\x04\x06\0\t\x01\
\n\n\n\x03\x04\x01\x01\x12\x03\x06\x08\x17\n\x0b\n\x04\x04\x01\x02\0\x12\
\n\n\n\x03\x04\x01\x01\x12\x03\x06\x08\x0f\n\x0b\n\x04\x04\x01\x02\0\x12\
\x03\x07\x04\x12\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\x07\x04\n\n\x0c\n\
\x05\x04\x01\x02\0\x01\x12\x03\x07\x0b\r\n\x0c\n\x05\x04\x01\x02\0\x03\
\x12\x03\x07\x10\x11\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\x08\x04\x15\n\

View File

@ -182,7 +182,7 @@ impl ::protobuf::reflect::ProtobufValue for QueryViewRequest {
}
#[derive(PartialEq,Clone,Default)]
pub struct ViewIdentifier {
pub struct ViewId {
// message fields
pub view_id: ::std::string::String,
// special fields
@ -190,14 +190,14 @@ pub struct ViewIdentifier {
pub cached_size: ::protobuf::CachedSize,
}
impl<'a> ::std::default::Default for &'a ViewIdentifier {
fn default() -> &'a ViewIdentifier {
<ViewIdentifier as ::protobuf::Message>::default_instance()
impl<'a> ::std::default::Default for &'a ViewId {
fn default() -> &'a ViewId {
<ViewId as ::protobuf::Message>::default_instance()
}
}
impl ViewIdentifier {
pub fn new() -> ViewIdentifier {
impl ViewId {
pub fn new() -> ViewId {
::std::default::Default::default()
}
@ -228,7 +228,7 @@ impl ViewIdentifier {
}
}
impl ::protobuf::Message for ViewIdentifier {
impl ::protobuf::Message for ViewId {
fn is_initialized(&self) -> bool {
true
}
@ -294,8 +294,8 @@ impl ::protobuf::Message for ViewIdentifier {
Self::descriptor_static()
}
fn new() -> ViewIdentifier {
ViewIdentifier::new()
fn new() -> ViewId {
ViewId::new()
}
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
@ -304,89 +304,89 @@ impl ::protobuf::Message for ViewIdentifier {
let mut fields = ::std::vec::Vec::new();
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
"view_id",
|m: &ViewIdentifier| { &m.view_id },
|m: &mut ViewIdentifier| { &mut m.view_id },
|m: &ViewId| { &m.view_id },
|m: &mut ViewId| { &mut m.view_id },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<ViewIdentifier>(
"ViewIdentifier",
::protobuf::reflect::MessageDescriptor::new_pb_name::<ViewId>(
"ViewId",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static ViewIdentifier {
static instance: ::protobuf::rt::LazyV2<ViewIdentifier> = ::protobuf::rt::LazyV2::INIT;
instance.get(ViewIdentifier::new)
fn default_instance() -> &'static ViewId {
static instance: ::protobuf::rt::LazyV2<ViewId> = ::protobuf::rt::LazyV2::INIT;
instance.get(ViewId::new)
}
}
impl ::protobuf::Clear for ViewIdentifier {
impl ::protobuf::Clear for ViewId {
fn clear(&mut self) {
self.view_id.clear();
self.unknown_fields.clear();
}
}
impl ::std::fmt::Debug for ViewIdentifier {
impl ::std::fmt::Debug for ViewId {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for ViewIdentifier {
impl ::protobuf::reflect::ProtobufValue for ViewId {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Message(self)
}
}
#[derive(PartialEq,Clone,Default)]
pub struct ViewIdentifiers {
pub struct RepeatedViewId {
// message fields
pub view_ids: ::protobuf::RepeatedField<::std::string::String>,
pub items: ::protobuf::RepeatedField<::std::string::String>,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
}
impl<'a> ::std::default::Default for &'a ViewIdentifiers {
fn default() -> &'a ViewIdentifiers {
<ViewIdentifiers as ::protobuf::Message>::default_instance()
impl<'a> ::std::default::Default for &'a RepeatedViewId {
fn default() -> &'a RepeatedViewId {
<RepeatedViewId as ::protobuf::Message>::default_instance()
}
}
impl ViewIdentifiers {
pub fn new() -> ViewIdentifiers {
impl RepeatedViewId {
pub fn new() -> RepeatedViewId {
::std::default::Default::default()
}
// repeated string view_ids = 1;
// repeated string items = 1;
pub fn get_view_ids(&self) -> &[::std::string::String] {
&self.view_ids
pub fn get_items(&self) -> &[::std::string::String] {
&self.items
}
pub fn clear_view_ids(&mut self) {
self.view_ids.clear();
pub fn clear_items(&mut self) {
self.items.clear();
}
// Param is passed by value, moved
pub fn set_view_ids(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) {
self.view_ids = v;
pub fn set_items(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) {
self.items = v;
}
// Mutable pointer to the field.
pub fn mut_view_ids(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> {
&mut self.view_ids
pub fn mut_items(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> {
&mut self.items
}
// Take field
pub fn take_view_ids(&mut self) -> ::protobuf::RepeatedField<::std::string::String> {
::std::mem::replace(&mut self.view_ids, ::protobuf::RepeatedField::new())
pub fn take_items(&mut self) -> ::protobuf::RepeatedField<::std::string::String> {
::std::mem::replace(&mut self.items, ::protobuf::RepeatedField::new())
}
}
impl ::protobuf::Message for ViewIdentifiers {
impl ::protobuf::Message for RepeatedViewId {
fn is_initialized(&self) -> bool {
true
}
@ -396,7 +396,7 @@ impl ::protobuf::Message for ViewIdentifiers {
let (field_number, wire_type) = is.read_tag_unpack()?;
match field_number {
1 => {
::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.view_ids)?;
::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.items)?;
},
_ => {
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
@ -410,7 +410,7 @@ impl ::protobuf::Message for ViewIdentifiers {
#[allow(unused_variables)]
fn compute_size(&self) -> u32 {
let mut my_size = 0;
for value in &self.view_ids {
for value in &self.items {
my_size += ::protobuf::rt::string_size(1, &value);
};
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
@ -419,7 +419,7 @@ impl ::protobuf::Message for ViewIdentifiers {
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
for v in &self.view_ids {
for v in &self.items {
os.write_string(1, &v)?;
};
os.write_unknown_fields(self.get_unknown_fields())?;
@ -452,8 +452,8 @@ impl ::protobuf::Message for ViewIdentifiers {
Self::descriptor_static()
}
fn new() -> ViewIdentifiers {
ViewIdentifiers::new()
fn new() -> RepeatedViewId {
RepeatedViewId::new()
}
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
@ -461,38 +461,38 @@ impl ::protobuf::Message for ViewIdentifiers {
descriptor.get(|| {
let mut fields = ::std::vec::Vec::new();
fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
"view_ids",
|m: &ViewIdentifiers| { &m.view_ids },
|m: &mut ViewIdentifiers| { &mut m.view_ids },
"items",
|m: &RepeatedViewId| { &m.items },
|m: &mut RepeatedViewId| { &mut m.items },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<ViewIdentifiers>(
"ViewIdentifiers",
::protobuf::reflect::MessageDescriptor::new_pb_name::<RepeatedViewId>(
"RepeatedViewId",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static ViewIdentifiers {
static instance: ::protobuf::rt::LazyV2<ViewIdentifiers> = ::protobuf::rt::LazyV2::INIT;
instance.get(ViewIdentifiers::new)
fn default_instance() -> &'static RepeatedViewId {
static instance: ::protobuf::rt::LazyV2<RepeatedViewId> = ::protobuf::rt::LazyV2::INIT;
instance.get(RepeatedViewId::new)
}
}
impl ::protobuf::Clear for ViewIdentifiers {
impl ::protobuf::Clear for RepeatedViewId {
fn clear(&mut self) {
self.view_ids.clear();
self.items.clear();
self.unknown_fields.clear();
}
}
impl ::std::fmt::Debug for ViewIdentifiers {
impl ::std::fmt::Debug for RepeatedViewId {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for ViewIdentifiers {
impl ::protobuf::reflect::ProtobufValue for RepeatedViewId {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Message(self)
}
@ -500,23 +500,23 @@ impl ::protobuf::reflect::ProtobufValue for ViewIdentifiers {
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x10view_query.proto\"-\n\x10QueryViewRequest\x12\x19\n\x08view_ids\
\x18\x01\x20\x03(\tR\x07viewIds\")\n\x0eViewIdentifier\x12\x17\n\x07view\
_id\x18\x01\x20\x01(\tR\x06viewId\",\n\x0fViewIdentifiers\x12\x19\n\x08v\
iew_ids\x18\x01\x20\x03(\tR\x07viewIdsJ\x9b\x02\n\x06\x12\x04\0\0\n\x01\
\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x04\x01\n\
\n\n\x03\x04\0\x01\x12\x03\x02\x08\x18\n\x0b\n\x04\x04\0\x02\0\x12\x03\
\x03\x04!\n\x0c\n\x05\x04\0\x02\0\x04\x12\x03\x03\x04\x0c\n\x0c\n\x05\
\x04\0\x02\0\x05\x12\x03\x03\r\x13\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\
\x03\x14\x1c\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x1f\x20\n\n\n\x02\
\x04\x01\x12\x04\x05\0\x07\x01\n\n\n\x03\x04\x01\x01\x12\x03\x05\x08\x16\
\n\x0b\n\x04\x04\x01\x02\0\x12\x03\x06\x04\x17\n\x0c\n\x05\x04\x01\x02\0\
\x05\x12\x03\x06\x04\n\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x06\x0b\x12\
\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x06\x15\x16\n\n\n\x02\x04\x02\x12\
\x04\x08\0\n\x01\n\n\n\x03\x04\x02\x01\x12\x03\x08\x08\x17\n\x0b\n\x04\
\x04\x02\x02\0\x12\x03\t\x04!\n\x0c\n\x05\x04\x02\x02\0\x04\x12\x03\t\
\x04\x0c\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\t\r\x13\n\x0c\n\x05\x04\
\x02\x02\0\x01\x12\x03\t\x14\x1c\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03\t\
\x1f\x20b\x06proto3\
\x18\x01\x20\x03(\tR\x07viewIds\"!\n\x06ViewId\x12\x17\n\x07view_id\x18\
\x01\x20\x01(\tR\x06viewId\"&\n\x0eRepeatedViewId\x12\x14\n\x05items\x18\
\x01\x20\x03(\tR\x05itemsJ\x9b\x02\n\x06\x12\x04\0\0\n\x01\n\x08\n\x01\
\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x04\x01\n\n\n\x03\x04\
\0\x01\x12\x03\x02\x08\x18\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04!\n\
\x0c\n\x05\x04\0\x02\0\x04\x12\x03\x03\x04\x0c\n\x0c\n\x05\x04\0\x02\0\
\x05\x12\x03\x03\r\x13\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x03\x14\x1c\n\
\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x1f\x20\n\n\n\x02\x04\x01\x12\x04\
\x05\0\x07\x01\n\n\n\x03\x04\x01\x01\x12\x03\x05\x08\x0e\n\x0b\n\x04\x04\
\x01\x02\0\x12\x03\x06\x04\x17\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\x06\
\x04\n\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x06\x0b\x12\n\x0c\n\x05\x04\
\x01\x02\0\x03\x12\x03\x06\x15\x16\n\n\n\x02\x04\x02\x12\x04\x08\0\n\x01\
\n\n\n\x03\x04\x02\x01\x12\x03\x08\x08\x16\n\x0b\n\x04\x04\x02\x02\0\x12\
\x03\t\x04\x1e\n\x0c\n\x05\x04\x02\x02\0\x04\x12\x03\t\x04\x0c\n\x0c\n\
\x05\x04\x02\x02\0\x05\x12\x03\t\r\x13\n\x0c\n\x05\x04\x02\x02\0\x01\x12\
\x03\t\x14\x19\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03\t\x1c\x1db\x06proto\
3\
";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

View File

@ -222,27 +222,27 @@ impl ::protobuf::reflect::ProtobufValue for QueryWorkspaceRequest {
}
#[derive(PartialEq,Clone,Default)]
pub struct WorkspaceIdentifier {
pub struct WorkspaceId {
// message oneof groups
pub one_of_workspace_id: ::std::option::Option<WorkspaceIdentifier_oneof_one_of_workspace_id>,
pub one_of_workspace_id: ::std::option::Option<WorkspaceId_oneof_one_of_workspace_id>,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
}
impl<'a> ::std::default::Default for &'a WorkspaceIdentifier {
fn default() -> &'a WorkspaceIdentifier {
<WorkspaceIdentifier as ::protobuf::Message>::default_instance()
impl<'a> ::std::default::Default for &'a WorkspaceId {
fn default() -> &'a WorkspaceId {
<WorkspaceId as ::protobuf::Message>::default_instance()
}
}
#[derive(Clone,PartialEq,Debug)]
pub enum WorkspaceIdentifier_oneof_one_of_workspace_id {
pub enum WorkspaceId_oneof_one_of_workspace_id {
workspace_id(::std::string::String),
}
impl WorkspaceIdentifier {
pub fn new() -> WorkspaceIdentifier {
impl WorkspaceId {
pub fn new() -> WorkspaceId {
::std::default::Default::default()
}
@ -251,7 +251,7 @@ impl WorkspaceIdentifier {
pub fn get_workspace_id(&self) -> &str {
match self.one_of_workspace_id {
::std::option::Option::Some(WorkspaceIdentifier_oneof_one_of_workspace_id::workspace_id(ref v)) => v,
::std::option::Option::Some(WorkspaceId_oneof_one_of_workspace_id::workspace_id(ref v)) => v,
_ => "",
}
}
@ -261,24 +261,24 @@ impl WorkspaceIdentifier {
pub fn has_workspace_id(&self) -> bool {
match self.one_of_workspace_id {
::std::option::Option::Some(WorkspaceIdentifier_oneof_one_of_workspace_id::workspace_id(..)) => true,
::std::option::Option::Some(WorkspaceId_oneof_one_of_workspace_id::workspace_id(..)) => true,
_ => false,
}
}
// Param is passed by value, moved
pub fn set_workspace_id(&mut self, v: ::std::string::String) {
self.one_of_workspace_id = ::std::option::Option::Some(WorkspaceIdentifier_oneof_one_of_workspace_id::workspace_id(v))
self.one_of_workspace_id = ::std::option::Option::Some(WorkspaceId_oneof_one_of_workspace_id::workspace_id(v))
}
// Mutable pointer to the field.
pub fn mut_workspace_id(&mut self) -> &mut ::std::string::String {
if let ::std::option::Option::Some(WorkspaceIdentifier_oneof_one_of_workspace_id::workspace_id(_)) = self.one_of_workspace_id {
if let ::std::option::Option::Some(WorkspaceId_oneof_one_of_workspace_id::workspace_id(_)) = self.one_of_workspace_id {
} else {
self.one_of_workspace_id = ::std::option::Option::Some(WorkspaceIdentifier_oneof_one_of_workspace_id::workspace_id(::std::string::String::new()));
self.one_of_workspace_id = ::std::option::Option::Some(WorkspaceId_oneof_one_of_workspace_id::workspace_id(::std::string::String::new()));
}
match self.one_of_workspace_id {
::std::option::Option::Some(WorkspaceIdentifier_oneof_one_of_workspace_id::workspace_id(ref mut v)) => v,
::std::option::Option::Some(WorkspaceId_oneof_one_of_workspace_id::workspace_id(ref mut v)) => v,
_ => panic!(),
}
}
@ -287,7 +287,7 @@ impl WorkspaceIdentifier {
pub fn take_workspace_id(&mut self) -> ::std::string::String {
if self.has_workspace_id() {
match self.one_of_workspace_id.take() {
::std::option::Option::Some(WorkspaceIdentifier_oneof_one_of_workspace_id::workspace_id(v)) => v,
::std::option::Option::Some(WorkspaceId_oneof_one_of_workspace_id::workspace_id(v)) => v,
_ => panic!(),
}
} else {
@ -296,7 +296,7 @@ impl WorkspaceIdentifier {
}
}
impl ::protobuf::Message for WorkspaceIdentifier {
impl ::protobuf::Message for WorkspaceId {
fn is_initialized(&self) -> bool {
true
}
@ -309,7 +309,7 @@ impl ::protobuf::Message for WorkspaceIdentifier {
if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited {
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
}
self.one_of_workspace_id = ::std::option::Option::Some(WorkspaceIdentifier_oneof_one_of_workspace_id::workspace_id(is.read_string()?));
self.one_of_workspace_id = ::std::option::Option::Some(WorkspaceId_oneof_one_of_workspace_id::workspace_id(is.read_string()?));
},
_ => {
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
@ -325,7 +325,7 @@ impl ::protobuf::Message for WorkspaceIdentifier {
let mut my_size = 0;
if let ::std::option::Option::Some(ref v) = self.one_of_workspace_id {
match v {
&WorkspaceIdentifier_oneof_one_of_workspace_id::workspace_id(ref v) => {
&WorkspaceId_oneof_one_of_workspace_id::workspace_id(ref v) => {
my_size += ::protobuf::rt::string_size(1, &v);
},
};
@ -338,7 +338,7 @@ impl ::protobuf::Message for WorkspaceIdentifier {
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
if let ::std::option::Option::Some(ref v) = self.one_of_workspace_id {
match v {
&WorkspaceIdentifier_oneof_one_of_workspace_id::workspace_id(ref v) => {
&WorkspaceId_oneof_one_of_workspace_id::workspace_id(ref v) => {
os.write_string(1, v)?;
},
};
@ -373,8 +373,8 @@ impl ::protobuf::Message for WorkspaceIdentifier {
Self::descriptor_static()
}
fn new() -> WorkspaceIdentifier {
WorkspaceIdentifier::new()
fn new() -> WorkspaceId {
WorkspaceId::new()
}
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
@ -383,37 +383,37 @@ impl ::protobuf::Message for WorkspaceIdentifier {
let mut fields = ::std::vec::Vec::new();
fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>(
"workspace_id",
WorkspaceIdentifier::has_workspace_id,
WorkspaceIdentifier::get_workspace_id,
WorkspaceId::has_workspace_id,
WorkspaceId::get_workspace_id,
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<WorkspaceIdentifier>(
"WorkspaceIdentifier",
::protobuf::reflect::MessageDescriptor::new_pb_name::<WorkspaceId>(
"WorkspaceId",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static WorkspaceIdentifier {
static instance: ::protobuf::rt::LazyV2<WorkspaceIdentifier> = ::protobuf::rt::LazyV2::INIT;
instance.get(WorkspaceIdentifier::new)
fn default_instance() -> &'static WorkspaceId {
static instance: ::protobuf::rt::LazyV2<WorkspaceId> = ::protobuf::rt::LazyV2::INIT;
instance.get(WorkspaceId::new)
}
}
impl ::protobuf::Clear for WorkspaceIdentifier {
impl ::protobuf::Clear for WorkspaceId {
fn clear(&mut self) {
self.one_of_workspace_id = ::std::option::Option::None;
self.unknown_fields.clear();
}
}
impl ::std::fmt::Debug for WorkspaceIdentifier {
impl ::std::fmt::Debug for WorkspaceId {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for WorkspaceIdentifier {
impl ::protobuf::reflect::ProtobufValue for WorkspaceId {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Message(self)
}
@ -422,15 +422,15 @@ impl ::protobuf::reflect::ProtobufValue for WorkspaceIdentifier {
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x15workspace_query.proto\"S\n\x15QueryWorkspaceRequest\x12#\n\x0cwork\
space_id\x18\x01\x20\x01(\tH\0R\x0bworkspaceIdB\x15\n\x13one_of_workspac\
e_id\"Q\n\x13WorkspaceIdentifier\x12#\n\x0cworkspace_id\x18\x01\x20\x01(\
\tH\0R\x0bworkspaceIdB\x15\n\x13one_of_workspace_idJ\xe6\x01\n\x06\x12\
\x04\0\0\x07\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\
\x02\0\x04\x01\n\n\n\x03\x04\0\x01\x12\x03\x02\x08\x1d\n\x0b\n\x04\x04\0\
\x08\0\x12\x03\x03\x04:\n\x0c\n\x05\x04\0\x08\0\x01\x12\x03\x03\n\x1d\n\
\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x208\n\x0c\n\x05\x04\0\x02\0\x05\x12\
\x03\x03\x20&\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x03'3\n\x0c\n\x05\x04\
\0\x02\0\x03\x12\x03\x0367\n\n\n\x02\x04\x01\x12\x04\x05\0\x07\x01\n\n\n\
\x03\x04\x01\x01\x12\x03\x05\x08\x1b\n\x0b\n\x04\x04\x01\x08\0\x12\x03\
e_id\"I\n\x0bWorkspaceId\x12#\n\x0cworkspace_id\x18\x01\x20\x01(\tH\0R\
\x0bworkspaceIdB\x15\n\x13one_of_workspace_idJ\xe6\x01\n\x06\x12\x04\0\0\
\x07\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\
\x04\x01\n\n\n\x03\x04\0\x01\x12\x03\x02\x08\x1d\n\x0b\n\x04\x04\0\x08\0\
\x12\x03\x03\x04:\n\x0c\n\x05\x04\0\x08\0\x01\x12\x03\x03\n\x1d\n\x0b\n\
\x04\x04\0\x02\0\x12\x03\x03\x208\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\
\x03\x20&\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x03'3\n\x0c\n\x05\x04\0\
\x02\0\x03\x12\x03\x0367\n\n\n\x02\x04\x01\x12\x04\x05\0\x07\x01\n\n\n\
\x03\x04\x01\x01\x12\x03\x05\x08\x13\n\x0b\n\x04\x04\x01\x08\0\x12\x03\
\x06\x04:\n\x0c\n\x05\x04\x01\x08\0\x01\x12\x03\x06\n\x1d\n\x0b\n\x04\
\x04\x01\x02\0\x12\x03\x06\x208\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\
\x06\x20&\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x06'3\n\x0c\n\x05\x04\

View File

@ -3,6 +3,6 @@ syntax = "proto3";
message QueryAppRequest {
repeated string app_ids = 1;
}
message AppIdentifier {
message AppId {
string app_id = 1;
}

View File

@ -1,10 +1,10 @@
syntax = "proto3";
message TrashIdentifiers {
repeated TrashIdentifier items = 1;
message RepeatedTrashId {
repeated TrashId items = 1;
bool delete_all = 2;
}
message TrashIdentifier {
message TrashId {
string id = 1;
TrashType ty = 2;
}

View File

@ -3,9 +3,9 @@ syntax = "proto3";
message QueryViewRequest {
repeated string view_ids = 1;
}
message ViewIdentifier {
message ViewId {
string view_id = 1;
}
message ViewIdentifiers {
repeated string view_ids = 1;
message RepeatedViewId {
repeated string items = 1;
}

View File

@ -3,6 +3,6 @@ syntax = "proto3";
message QueryWorkspaceRequest {
oneof one_of_workspace_id { string workspace_id = 1; };
}
message WorkspaceIdentifier {
message WorkspaceId {
oneof one_of_workspace_id { string workspace_id = 1; };
}

View File

@ -36,7 +36,7 @@ pub fn category_from_str(type_str: &str) -> TypeCategory {
| "ResetDocumentParams"
| "DocumentDelta"
| "NewDocUser"
| "DocIdentifier"
| "DocumentId"
| "Revision"
| "RepeatedRevision"
| "RevId"
@ -45,7 +45,7 @@ pub fn category_from_str(type_str: &str) -> TypeCategory {
| "DocumentServerWSData"
| "NewDocumentUser"
| "QueryAppRequest"
| "AppIdentifier"
| "AppId"
| "CreateAppRequest"
| "ColorStyle"
| "CreateAppParams"
@ -61,16 +61,16 @@ pub fn category_from_str(type_str: &str) -> TypeCategory {
| "Workspace"
| "RepeatedWorkspace"
| "QueryWorkspaceRequest"
| "WorkspaceIdentifier"
| "TrashIdentifiers"
| "TrashIdentifier"
| "WorkspaceId"
| "RepeatedTrashId"
| "TrashId"
| "Trash"
| "RepeatedTrash"
| "UpdateViewRequest"
| "UpdateViewParams"
| "QueryViewRequest"
| "ViewIdentifier"
| "ViewIdentifiers"
| "ViewId"
| "RepeatedViewId"
| "CreateViewRequest"
| "CreateViewParams"
| "View"